mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-10-01 03:43:42 +08:00
added display mode support
This commit is contained in:
@@ -207,6 +207,9 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"UpdaterTargetBranch", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterLastFetchTime", PERSISTENT},
|
||||
{"Version", PERSISTENT},
|
||||
|
||||
// dp
|
||||
{"dp_device_display_off_mode", PERSISTENT},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -40,6 +40,9 @@ def manager_init() -> None:
|
||||
("LanguageSetting", "main_en"),
|
||||
("OpenpilotEnabledToggle", "1"),
|
||||
("LongitudinalPersonality", str(log.LongitudinalPersonality.standard)),
|
||||
|
||||
# dp
|
||||
("dp_device_display_off_mode", "0"),
|
||||
]
|
||||
if not PC:
|
||||
default_params.append(("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')))
|
||||
|
||||
@@ -297,6 +297,12 @@ Device::Device(QObject *parent) : brightness_filter(BACKLIGHT_OFFROAD, BACKLIGHT
|
||||
resetInteractiveTimeout();
|
||||
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &Device::update);
|
||||
#ifdef DP
|
||||
display_mode_handler = new DisplayModeHandler;
|
||||
QObject::connect(display_mode_handler, &DisplayModeHandler::reset_interactive_timeout, [=](bool timeout) {
|
||||
resetInteractiveTimeout(timeout);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void Device::update(const UIState &s) {
|
||||
@@ -359,7 +365,11 @@ void Device::updateWakefulness(const UIState &s) {
|
||||
emit interactiveTimeout();
|
||||
}
|
||||
|
||||
#ifdef DP
|
||||
setAwake(display_mode_handler->get_awake(s, interactive_timeout));
|
||||
#else
|
||||
setAwake(s.scene.ignition || interactive_timeout > 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
UIState *uiState() {
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
#include "common/timing.h"
|
||||
#include "system/hardware/hw.h"
|
||||
|
||||
#ifdef DP
|
||||
#include "dp_priv/selfdrive/ui/ui.h"
|
||||
class DisplayModeHandler;
|
||||
#endif
|
||||
|
||||
const int UI_BORDER_SIZE = 30;
|
||||
const int UI_HEADER_HEIGHT = 420;
|
||||
|
||||
@@ -128,6 +133,9 @@ public:
|
||||
|
||||
QTransform car_space_transform;
|
||||
|
||||
// dp
|
||||
QString gps_service = "gpsLocationExternal";
|
||||
|
||||
signals:
|
||||
void uiUpdate(const UIState &s);
|
||||
void offroadTransition(bool offroad);
|
||||
@@ -170,6 +178,10 @@ private:
|
||||
void updateWakefulness(const UIState &s);
|
||||
void setAwake(bool on);
|
||||
|
||||
#ifdef DP
|
||||
DisplayModeHandler *display_mode_handler;
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void displayPowerChanged(bool on);
|
||||
void interactiveTimeout();
|
||||
|
||||
Reference in New Issue
Block a user