Screen Management

Added toggles to adjust the screen brightness, timeout settings, and other UI changes.
This commit is contained in:
FrogAi
2024-03-06 18:53:46 -07:00
parent 2fb03067a8
commit d2ea059013
10 changed files with 173 additions and 60 deletions

View File

@@ -280,8 +280,15 @@ std::unordered_map<std::string, uint32_t> keys = {
{"GMapKey", PERSISTENT}, {"GMapKey", PERSISTENT},
{"GoatScream", PERSISTENT}, {"GoatScream", PERSISTENT},
{"GreenLightAlert", PERSISTENT}, {"GreenLightAlert", PERSISTENT},
{"HideAlerts", PERSISTENT},
{"HideAOLStatusBar", PERSISTENT},
{"HideCEMStatusBar", PERSISTENT},
{"HideLeadMarker", PERSISTENT},
{"HideMapIcon", PERSISTENT},
{"HideMaxSpeed", PERSISTENT},
{"HideSpeed", PERSISTENT}, {"HideSpeed", PERSISTENT},
{"HideSpeedUI", PERSISTENT}, {"HideSpeedUI", PERSISTENT},
{"HideUIElements", PERSISTENT},
{"HigherBitrate", PERSISTENT}, {"HigherBitrate", PERSISTENT},
{"HolidayThemes", PERSISTENT}, {"HolidayThemes", PERSISTENT},
{"LaneChangeTime", PERSISTENT}, {"LaneChangeTime", PERSISTENT},
@@ -343,6 +350,11 @@ std::unordered_map<std::string, uint32_t> keys = {
{"RotatingWheel", PERSISTENT}, {"RotatingWheel", PERSISTENT},
{"SchedulePending", PERSISTENT}, {"SchedulePending", PERSISTENT},
{"ScreenBrightness", PERSISTENT}, {"ScreenBrightness", PERSISTENT},
{"ScreenBrightnessOnroad", PERSISTENT},
{"ScreenManagement", PERSISTENT},
{"ScreenRecorder", PERSISTENT},
{"ScreenTimeout", PERSISTENT},
{"ScreenTimeoutOnroad", PERSISTENT},
{"SearchInput", PERSISTENT}, {"SearchInput", PERSISTENT},
{"SilentMode", PERSISTENT}, {"SilentMode", PERSISTENT},
{"ShowCPU", PERSISTENT}, {"ShowCPU", PERSISTENT},
@@ -352,6 +364,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"ShowStorageUsed", PERSISTENT}, {"ShowStorageUsed", PERSISTENT},
{"StandardFollow", PERSISTENT}, {"StandardFollow", PERSISTENT},
{"StandardJerk", PERSISTENT}, {"StandardJerk", PERSISTENT},
{"StandbyMode", PERSISTENT},
{"StockTune", PERSISTENT}, {"StockTune", PERSISTENT},
{"StoppingDistance", PERSISTENT}, {"StoppingDistance", PERSISTENT},
{"TetheringEnabled", PERSISTENT}, {"TetheringEnabled", PERSISTENT},

View File

@@ -441,26 +441,30 @@ def transform_lng(lng, lat):
def get_all_toggle_values(): def get_all_toggle_values():
all_keys = [ all_keys = [
"AdjustablePersonalities", "PersonalitiesViaWheel", "PersonalitiesViaScreen", "AlwaysOnLateral", "AlwaysOnLateralMain", "AdjustablePersonalities", "PersonalitiesViaWheel", "PersonalitiesViaScreen", "AlwaysOnLateral", "AlwaysOnLateralMain", "HideAOLStatusBar",
"ConditionalExperimental", "CESpeed", "CESpeedLead", "CECurves", "CECurvesLead", "CENavigation", "CENavigationIntersections", "ConditionalExperimental", "CESpeed", "CESpeedLead", "CECurves", "CECurvesLead", "CENavigation", "CENavigationIntersections",
"CENavigationLead", "CENavigationTurns", "CESlowerLead", "CEStopLights", "CEStopLightsLead", "CESignal", "CustomPersonalities", "CENavigationLead", "CENavigationTurns", "CESlowerLead", "CEStopLights", "CEStopLightsLead", "CESignal", "HideCEMStatusBar",
"AggressiveFollow", "AggressiveJerk", "StandardFollow", "StandardJerk", "RelaxedFollow", "RelaxedJerk", "DeviceShutdown", "CustomPersonalities", "AggressiveFollow", "AggressiveJerk", "StandardFollow", "StandardJerk", "RelaxedFollow", "RelaxedJerk", "DeviceShutdown",
"ExperimentalModeActivation", "ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen", "FireTheBabysitter", "ExperimentalModeActivation", "ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen", "FireTheBabysitter",
"NoLogging", "MuteOverheated", "OfflineMode", "LateralTune", "ForceAutoTune", "NNFF", "SteerRatio", "UseLateralJerk", "LongitudinalTune", "NoLogging", "NoUploads", "MuteOverheated", "OfflineMode", "LateralTune", "ForceAutoTune", "NNFF", "SteerRatio", "UseLateralJerk", "LongitudinalTune",
"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration", "StoppingDistance", "SmoothBraking", "Model", "MTSCEnabled", "AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration", "StoppingDistance", "SmoothBraking", "Model", "MTSCEnabled",
"DisableMTSCSmoothing", "MTSCAggressiveness", "MTSCCurvatureCheck", "MTSCLimit", "NudgelessLaneChange", "LaneChangeTime", "LaneDetection", "DisableMTSCSmoothing", "MTSCAggressiveness", "MTSCCurvatureCheck", "MTSCLimit", "NudgelessLaneChange", "LaneChangeTime", "LaneDetection",
"LaneDetectionWidth", "OneLaneChange", "QOLControls", "DisableOnroadUploads", "HigherBitrate", "NavChill", "PauseLateralOnSignal", "LaneDetectionWidth", "OneLaneChange", "QOLControls", "DisableOnroadUploads", "HigherBitrate", "NavChill", "PauseLateralOnSignal",
"ReverseCruise", "ReverseCruiseUI", "SetSpeedLimit", "SetSpeedOffset", "SpeedLimitController", "Offset1", "Offset2", "Offset3", "Offset4", "ReverseCruise", "ReverseCruiseUI", "SetSpeedLimit", "SetSpeedOffset", "SpeedLimitController", "Offset1", "Offset2", "Offset3", "Offset4",
"SLCConfirmation", "SLCFallback", "SLCPriority1", "SLCPriority2", "SLCPriority3", "SLCOverride", "TurnDesires", "VisionTurnControl", "SLCConfirmation", "SLCConfirmationLower", "SLCConfirmationHigher", "SLCFallback", "SLCPriority1", "SLCPriority2", "SLCPriority3", "SLCOverride",
"DisableVTSCSmoothing", "CurveSensitivity", "TurnAggressiveness", "EVTable", "GasRegenCmd", "LongPitch", "LowerVolt", "CrosstrekTorque", "TurnDesires", "VisionTurnControl", "DisableVTSCSmoothing", "CurveSensitivity", "TurnAggressiveness",
"CydiaTune", "DragonPilotTune", "FrogsGoMooTune", "LockDoors", "SNGHack", "CustomTheme", "CustomColors", "CustomIcons", "CustomSignals",
"CustomSounds", "GoatScream", "AlertVolumeControl", "DisengageVolume", "EngageVolume", "PromptVolume", "PromptDistractedVolume", "RefuseVolume", "EVTable", "GasRegenCmd", "LongPitch", "LowerVolt", "CrosstrekTorque", "CydiaTune", "DragonPilotTune", "FrogsGoMooTune", "LockDoors", "SNGHack",
"WarningSoftVolume", "WarningImmediateVolume", "CameraView", "Compass", "CustomAlerts", "GreenLightAlert", "LeadDepartingAlert", "LoudBlindspotAlert",
"SpeedLimitChangedAlert", "CustomUI", "AccelerationPath", "AdjacentPath", "AdjacentPathMetrics", "BlindSpotPath", "FPSCounter", "LeadInfo", "UseSI", "CustomTheme", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds", "GoatScream", "AlertVolumeControl", "DisengageVolume",
"PedalsOnUI", "RoadNameUI", "UseVienna", "DriverCamera", "ModelUI", "DynamicPathWidth", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "EngageVolume", "PromptVolume", "PromptDistractedVolume", "RefuseVolume", "WarningSoftVolume", "WarningImmediateVolume", "CameraView",
"RoadEdgesWidth", "UnlimitedLength", "QOLVisuals", "DriveStats", "FullMap", "HideSpeed", "HideSpeedUI", "ShowSLCOffset", "WheelSpeed", "Compass", "CustomAlerts", "GreenLightAlert", "LeadDepartingAlert", "LoudBlindspotAlert", "SpeedLimitChangedAlert", "CustomUI", "AccelerationPath",
"RandomEvents", "ScreenBrightness", "WheelIcon", "RotatingWheel", "NumericalTemp", "Fahrenheit", "ShowCPU", "ShowGPU", "ShowIP", "ShowMemoryUsage", "AdjacentPath", "AdjacentPathMetrics", "BlindSpotPath", "FPSCounter", "LeadInfo", "UseSI", "PedalsOnUI", "RoadNameUI", "UseVienna", "DriverCamera",
"ShowStorageLeft", "ShowStorageUsed", "Sidebar" "ModelUI", "DynamicPathWidth", "HideLeadMarker", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength", "QOLVisuals",
"DriveStats", "FullMap", "HideSpeed", "HideSpeedUI", "ShowSLCOffset", "SpeedLimitChangedAlert", "WheelSpeed", "RandomEvents", "ScreenManagement",
"HideUIElements", "HideAlerts", "HideMapIcon", "HideMaxSpeed", "ScreenBrightness", "ScreenBrightnessOnroad", "ScreenTimeout", "ScreenTimeoutOnroad",
"ScreenRecorder", "StandbyMode", "WheelIcon", "RotatingWheel", "NumericalTemp", "Fahrenheit", "ShowCPU", "ShowGPU", "ShowIP", "ShowMemoryUsage",
"ShowStorageLeft", "ShowStorageUsed", "Sidebar",
] ]
toggle_values = {} toggle_values = {}

View File

@@ -3,6 +3,8 @@
FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPilotListWidget(parent) { FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPilotListWidget(parent) {
const std::vector<std::tuple<QString, QString, QString, QString>> controlToggles { const std::vector<std::tuple<QString, QString, QString, QString>> controlToggles {
{"AlwaysOnLateral", "Always on Lateral", "Maintain openpilot lateral control when the brake or gas pedals are used.\n\nDeactivation occurs only through the 'Cruise Control' button.", "../frogpilot/assets/toggle_icons/icon_always_on_lateral.png"}, {"AlwaysOnLateral", "Always on Lateral", "Maintain openpilot lateral control when the brake or gas pedals are used.\n\nDeactivation occurs only through the 'Cruise Control' button.", "../frogpilot/assets/toggle_icons/icon_always_on_lateral.png"},
{"AlwaysOnLateralMain", "Enable On Cruise Main", "Enable 'Always On Lateral' by simply turning on 'Cruise Control'.", ""},
{"HideAOLStatusBar", "Hide the Status Bar", "Don't use the status bar for 'Always On Lateral'.", ""},
{"ConditionalExperimental", "Conditional Experimental Mode", "Automatically switches to 'Experimental Mode' under predefined conditions.", "../frogpilot/assets/toggle_icons/icon_conditional.png"}, {"ConditionalExperimental", "Conditional Experimental Mode", "Automatically switches to 'Experimental Mode' under predefined conditions.", "../frogpilot/assets/toggle_icons/icon_conditional.png"},
{"CECurves", "Curve Detected Ahead", "Switch to 'Experimental Mode' when a curve is detected.", ""}, {"CECurves", "Curve Detected Ahead", "Switch to 'Experimental Mode' when a curve is detected.", ""},
@@ -10,6 +12,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
{"CESlowerLead", "Slower Lead Detected Ahead", "Switch to 'Experimental Mode' when a slower lead vehicle is detected ahead.", ""}, {"CESlowerLead", "Slower Lead Detected Ahead", "Switch to 'Experimental Mode' when a slower lead vehicle is detected ahead.", ""},
{"CEStopLights", "Stop Lights and Stop Signs", "Switch to 'Experimental Mode' when a stop light or stop sign is detected.", ""}, {"CEStopLights", "Stop Lights and Stop Signs", "Switch to 'Experimental Mode' when a stop light or stop sign is detected.", ""},
{"CESignal", "Turn Signal When Below Highway Speeds", "Switch to 'Experimental Mode' when using turn signals below highway speeds to help assit with turns.", ""}, {"CESignal", "Turn Signal When Below Highway Speeds", "Switch to 'Experimental Mode' when using turn signals below highway speeds to help assit with turns.", ""},
{"HideCEMStatusBar", "Hide the Status Bar", "Don't use the status bar for 'Conditional Experimental Mode'.", ""},
{"CustomPersonalities", "Custom Driving Personalities", "Customize the driving personality profiles to your driving style.", "../frogpilot/assets/toggle_icons/icon_custom.png"}, {"CustomPersonalities", "Custom Driving Personalities", "Customize the driving personality profiles to your driving style.", "../frogpilot/assets/toggle_icons/icon_custom.png"},
{"DeviceShutdown", "Device Shutdown Timer", "Configure the timer for automatic device shutdown when offroad conserving energy and preventing battery drain.", "../frogpilot/assets/toggle_icons/icon_time.png"}, {"DeviceShutdown", "Device Shutdown Timer", "Configure the timer for automatic device shutdown when offroad conserving energy and preventing battery drain.", "../frogpilot/assets/toggle_icons/icon_time.png"},
@@ -61,21 +64,14 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
ParamControl *toggle; ParamControl *toggle;
if (param == "AlwaysOnLateral") { if (param == "AlwaysOnLateral") {
std::vector<QString> aolToggles{"AlwaysOnLateralMain"}; FrogPilotParamManageControl *aolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
std::vector<QString> aolToggleNames{tr("Enable On Cruise Main")}; QObject::connect(aolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, aolToggles, aolToggleNames); parentToggleClicked();
for (auto &[key, toggle] : toggles) {
QObject::connect(static_cast<FrogPilotParamToggleControl*>(toggle), &FrogPilotParamToggleControl::buttonClicked, [this](const bool checked) { toggle->setVisible(aolKeys.find(key.c_str()) != aolKeys.end());
if (checked) {
FrogPilotConfirmationDialog::toggleAlert("WARNING: This is very experimental and isn't guaranteed to work. If you run into any issues, please report it in the FrogPilot Discord!",
"I understand the risks.", this);
}
if (started) {
if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) {
Hardware::soft_reboot();
}
} }
}); });
toggle = aolToggle;
} else if (param == "ConditionalExperimental") { } else if (param == "ConditionalExperimental") {
FrogPilotParamManageControl *conditionalExperimentalToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); FrogPilotParamManageControl *conditionalExperimentalToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
@@ -335,6 +331,14 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
}); });
} }
QObject::connect(toggles["AlwaysOnLateralMain"], &ToggleControl::toggleFlipped, [this]() {
if (params.getBool("AlwaysOnLateralMain")) {
FrogPilotConfirmationDialog::toggleAlert(
"WARNING: This isn't guaranteed to work, so if you run into any issues, please report it in the FrogPilot Discord!",
"I understand the risks.", this);
}
});
QObject::connect(toggles["MuteOverheated"], &ToggleControl::toggleFlipped, [this]() { QObject::connect(toggles["MuteOverheated"], &ToggleControl::toggleFlipped, [this]() {
if (params.getBool("MuteOverheated")) { if (params.getBool("MuteOverheated")) {
FrogPilotConfirmationDialog::toggleAlert( FrogPilotConfirmationDialog::toggleAlert(
@@ -448,7 +452,8 @@ void FrogPilotControlsPanel::hideSubToggles() {
relaxedProfile->setVisible(false); relaxedProfile->setVisible(false);
for (auto &[key, toggle] : toggles) { for (auto &[key, toggle] : toggles) {
bool subToggles = conditionalExperimentalKeys.find(key.c_str()) != conditionalExperimentalKeys.end() || bool subToggles = aolKeys.find(key.c_str()) != aolKeys.end() ||
conditionalExperimentalKeys.find(key.c_str()) != conditionalExperimentalKeys.end() ||
experimentalModeActivationKeys.find(key.c_str()) != experimentalModeActivationKeys.end() || experimentalModeActivationKeys.find(key.c_str()) != experimentalModeActivationKeys.end() ||
fireTheBabysitterKeys.find(key.c_str()) != fireTheBabysitterKeys.end() || fireTheBabysitterKeys.find(key.c_str()) != fireTheBabysitterKeys.end() ||
laneChangeKeys.find(key.c_str()) != laneChangeKeys.end() || laneChangeKeys.find(key.c_str()) != laneChangeKeys.end() ||

View File

@@ -37,7 +37,8 @@ private:
FrogPilotDualParamControl *standardProfile; FrogPilotDualParamControl *standardProfile;
FrogPilotDualParamControl *relaxedProfile; FrogPilotDualParamControl *relaxedProfile;
std::set<QString> conditionalExperimentalKeys = {"CECurves", "CECurvesLead", "CESlowerLead", "CENavigation", "CEStopLights", "CESignal"}; std::set<QString> aolKeys = {"AlwaysOnLateralMain", "HideAOLStatusBar"};
std::set<QString> conditionalExperimentalKeys = {"CECurves", "CECurvesLead", "CESlowerLead", "CENavigation", "CEStopLights", "CESignal", "HideCEMStatusBar"};
std::set<QString> experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen"}; std::set<QString> experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen"};
std::set<QString> fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads", "OfflineMode"}; std::set<QString> fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads", "OfflineMode"};
std::set<QString> laneChangeKeys = {"LaneChangeTime", "LaneDetection", "LaneDetectionWidth", "OneLaneChange"}; std::set<QString> laneChangeKeys = {"LaneChangeTime", "LaneDetection", "LaneDetectionWidth", "OneLaneChange"};

View File

@@ -39,6 +39,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
{"ModelUI", "Model UI", "Personalize how the model's visualizations appear on your screen.", "../assets/offroad/icon_calibration.png"}, {"ModelUI", "Model UI", "Personalize how the model's visualizations appear on your screen.", "../assets/offroad/icon_calibration.png"},
{"DynamicPathWidth", "Dynamic Path Width", "Have the path width dynamically adjust based on the current engagement state of openpilot.", ""}, {"DynamicPathWidth", "Dynamic Path Width", "Have the path width dynamically adjust based on the current engagement state of openpilot.", ""},
{"HideLeadMarker", "Hide Lead Marker", "Hide the lead marker from the onroad UI.", ""},
{"LaneLinesWidth", "Lane Lines", "Adjust the visual thickness of lane lines on your display.\n\nDefault matches the MUTCD average of 4 inches.", ""}, {"LaneLinesWidth", "Lane Lines", "Adjust the visual thickness of lane lines on your display.\n\nDefault matches the MUTCD average of 4 inches.", ""},
{"PathEdgeWidth", "Path Edges", "Adjust the width of the path edges shown on your UI to represent different driving modes and statuses.\n\nDefault is 20% of the total path.\n\nBlue = Navigation\nLight Blue = Always On Lateral\nGreen = Default with 'FrogPilot Colors'\nLight Green = Default with stock colors\nOrange = Experimental Mode Active\nYellow = Conditional Overriden", ""}, {"PathEdgeWidth", "Path Edges", "Adjust the width of the path edges shown on your UI to represent different driving modes and statuses.\n\nDefault is 20% of the total path.\n\nBlue = Navigation\nLight Blue = Always On Lateral\nGreen = Default with 'FrogPilot Colors'\nLight Green = Default with stock colors\nOrange = Experimental Mode Active\nYellow = Conditional Overriden", ""},
{"PathWidth", "Path Width", "Customize the width of the driving path shown on your UI.\n\nDefault matches the width of a 2019 Lexus ES 350.", ""}, {"PathWidth", "Path Width", "Customize the width of the driving path shown on your UI.\n\nDefault matches the width of a 2019 Lexus ES 350.", ""},
@@ -52,7 +53,14 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
{"FullMap", "Full Sized Map", "Maximize the size of the map in the onroad UI.", ""}, {"FullMap", "Full Sized Map", "Maximize the size of the map in the onroad UI.", ""},
{"HideSpeed", "Hide Speed", "Hide the speed indicator in the onroad UI. Additional toggle allows it to be hidden/shown via tapping the speed itself.", ""}, {"HideSpeed", "Hide Speed", "Hide the speed indicator in the onroad UI. Additional toggle allows it to be hidden/shown via tapping the speed itself.", ""},
{"ScreenBrightness", "Screen Brightness", "Customize your screen brightness.", "../frogpilot/assets/toggle_icons/icon_light.png"}, {"ScreenManagement", "Screen Management", "Manage your screen's brightness, timeout settings, and hide specific onroad UI elements.", "../frogpilot/assets/toggle_icons/icon_light.png"},
{"HideUIElements", "Hide UI Elements", "Hide the selected UI elements from the onroad screen.", ""},
{"ScreenBrightness", "Screen Brightness", "Customize your screen brightness when offroad.", ""},
{"ScreenBrightnessOnroad", "Screen Brightness (Onroad)", "Customize your screen brightness when onroad.", ""},
{"ScreenRecorder", "Screen Recorder", "Enable the screen recorder button to record the screen.", ""},
{"ScreenTimeout", "Screen Timeout", "Customize how long it takes for your screen to turn off.", ""},
{"ScreenTimeoutOnroad", "Screen Timeout (Onroad)", "Customize how long it takes for your screen to turn off after going onroad.", ""},
{"StandbyMode", "Standby Mode", "Turn the screen off after your screen times out when onroad but wake it back up when engagement state changes or important alerts are triggered.", ""},
}; };
for (const auto &[param, title, desc, icon] : visualToggles) { for (const auto &[param, title, desc, icon] : visualToggles) {
@@ -168,12 +176,27 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
std::vector<QString> hideSpeedToggleNames{tr("Control Via UI")}; std::vector<QString> hideSpeedToggleNames{tr("Control Via UI")};
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, hideSpeedToggles, hideSpeedToggleNames); toggle = new FrogPilotParamToggleControl(param, title, desc, icon, hideSpeedToggles, hideSpeedToggleNames);
} else if (param == "ScreenBrightness") { } else if (param == "ScreenManagement") {
FrogPilotParamManageControl *screenToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
QObject::connect(screenToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
parentToggleClicked();
for (auto &[key, toggle] : toggles) {
toggle->setVisible(screenKeys.find(key.c_str()) != screenKeys.end());
}
});
toggle = screenToggle;
} else if (param == "HideUIElements") {
std::vector<QString> uiElementsToggles{"HideAlerts", "HideMapIcon", "HideMaxSpeed"};
std::vector<QString> uiElementsToggleNames{tr("Alerts"), tr("Map Icon"), tr("Max Speed")};
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, uiElementsToggles, uiElementsToggleNames);
} else if (param == "ScreenBrightness" || param == "ScreenBrightnessOnroad") {
std::map<int, QString> brightnessLabels; std::map<int, QString> brightnessLabels;
for (int i = 0; i <= 101; ++i) { for (int i = 0; i <= 101; ++i) {
brightnessLabels[i] = i == 0 ? "Screen Off" : i == 101 ? "Auto" : QString::number(i) + "%"; brightnessLabels[i] = i == 0 ? "Screen Off" : i == 101 ? "Auto" : QString::number(i) + "%";
} }
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 101, brightnessLabels, this, false); toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 101, brightnessLabels, this, false);
} else if (param == "ScreenTimeout" || param == "ScreenTimeoutOnroad") {
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 5, 60, std::map<int, QString>(), this, false, " seconds");
} else { } else {
toggle = new ParamControl(param, title, desc, icon, this); toggle = new ParamControl(param, title, desc, icon, this);
@@ -289,7 +312,8 @@ void FrogPilotVisualsPanel::hideSubToggles() {
customOnroadUIKeys.find(key.c_str()) != customOnroadUIKeys.end() || customOnroadUIKeys.find(key.c_str()) != customOnroadUIKeys.end() ||
customThemeKeys.find(key.c_str()) != customThemeKeys.end() || customThemeKeys.find(key.c_str()) != customThemeKeys.end() ||
modelUIKeys.find(key.c_str()) != modelUIKeys.end() || modelUIKeys.find(key.c_str()) != modelUIKeys.end() ||
qolKeys.find(key.c_str()) != qolKeys.end(); qolKeys.find(key.c_str()) != qolKeys.end() ||
screenKeys.find(key.c_str()) != screenKeys.end();
toggle->setVisible(!subToggles); toggle->setVisible(!subToggles);
} }

View File

@@ -32,8 +32,9 @@ private:
std::set<QString> customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert", "LoudBlindspotAlert"}; std::set<QString> customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert", "LoudBlindspotAlert"};
std::set<QString> customOnroadUIKeys = {"AccelerationPath", "AdjacentPath", "BlindSpotPath", "FPSCounter", "LeadInfo", "PedalsOnUI", "RoadNameUI"}; std::set<QString> customOnroadUIKeys = {"AccelerationPath", "AdjacentPath", "BlindSpotPath", "FPSCounter", "LeadInfo", "PedalsOnUI", "RoadNameUI"};
std::set<QString> customThemeKeys = {"HolidayThemes", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds"}; std::set<QString> customThemeKeys = {"HolidayThemes", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds"};
std::set<QString> modelUIKeys = {"DynamicPathWidth", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"}; std::set<QString> modelUIKeys = {"DynamicPathWidth", "HideLeadMarker", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};
std::set<QString> qolKeys = {"DriveStats", "FullMap", "HideSpeed"}; std::set<QString> qolKeys = {"DriveStats", "FullMap", "HideSpeed"};
std::set<QString> screenKeys = {"HideUIElements", "ScreenBrightness", "ScreenBrightnessOnroad", "ScreenRecorder", "ScreenTimeout", "ScreenTimeoutOnroad", "StandbyMode"};
std::map<std::string, ParamControl*> toggles; std::map<std::string, ParamControl*> toggles;

View File

@@ -289,6 +289,11 @@ void OnroadAlerts::paintEvent(QPaintEvent *event) {
if (alert.size == cereal::ControlsState::AlertSize::NONE || scene.show_driver_camera && alert.status != cereal::ControlsState::AlertStatus::CRITICAL) { if (alert.size == cereal::ControlsState::AlertSize::NONE || scene.show_driver_camera && alert.status != cereal::ControlsState::AlertStatus::CRITICAL) {
return; return;
} }
if (scene.hide_alerts && alert.size == cereal::ControlsState::AlertSize::SMALL) {
return;
}
static std::map<cereal::ControlsState::AlertSize, const int> alert_heights = { static std::map<cereal::ControlsState::AlertSize, const int> alert_heights = {
{cereal::ControlsState::AlertSize::SMALL, 271}, {cereal::ControlsState::AlertSize::SMALL, 271},
{cereal::ControlsState::AlertSize::MID, 420}, {cereal::ControlsState::AlertSize::MID, 420},
@@ -390,6 +395,10 @@ void ExperimentalButton::updateState(const UIState &s, bool leadInfo) {
} }
void ExperimentalButton::paintEvent(QPaintEvent *event) { void ExperimentalButton::paintEvent(QPaintEvent *event) {
if (wheelIcon < 0) {
return;
}
QPainter p(this); QPainter p(this);
QPixmap img = experimental_mode ? experimental_img : engage_img; QPixmap img = experimental_mode ? experimental_img : engage_img;
@@ -499,7 +508,7 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
// hide map settings button for alerts and flip for right hand DM // hide map settings button for alerts and flip for right hand DM
if (map_settings_btn->isEnabled()) { if (map_settings_btn->isEnabled()) {
map_settings_btn->setVisible(!hideBottomIcons && compass); map_settings_btn->setVisible(!hideBottomIcons && compass && !scene.hide_map_icon);
main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | (compass ? Qt::AlignTop : Qt::AlignBottom)); main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | (compass ? Qt::AlignTop : Qt::AlignBottom));
} }
} }
@@ -517,7 +526,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
QString speedStr = QString::number(std::nearbyint(speed)); QString speedStr = QString::number(std::nearbyint(speed));
QString setSpeedStr = is_cruise_set ? QString::number(std::nearbyint(setSpeed - cruiseAdjustment)) : ""; QString setSpeedStr = is_cruise_set ? QString::number(std::nearbyint(setSpeed - cruiseAdjustment)) : "";
if (!showDriverCamera) { if (!(scene.hide_max_speed || showDriverCamera)) {
// Draw outer box + border to contain set speed and speed limit // Draw outer box + border to contain set speed and speed limit
const int sign_margin = 12; const int sign_margin = 12;
const int us_sign_height = 186; const int us_sign_height = 186;
@@ -1005,17 +1014,19 @@ void AnnotatedCameraWidget::paintGL() {
CameraWidget::setStreamType(cameraView == 3 || showDriverCamera ? VISION_STREAM_DRIVER : CameraWidget::setStreamType(cameraView == 3 || showDriverCamera ? VISION_STREAM_DRIVER :
cameraView == 2 || wide_cam_requested ? VISION_STREAM_WIDE_ROAD : cameraView == 2 || wide_cam_requested ? VISION_STREAM_WIDE_ROAD :
VISION_STREAM_ROAD); VISION_STREAM_ROAD);
s->scene.wide_cam = CameraWidget::getStreamType() == VISION_STREAM_WIDE_ROAD;
if (s->scene.calibration_valid) {
auto calib = s->scene.wide_cam ? s->scene.view_from_wide_calib : s->scene.view_from_calib;
CameraWidget::updateCalibration(calib);
} else {
CameraWidget::updateCalibration(DEFAULT_CALIBRATION);
} }
CameraWidget::setFrameId(model.getFrameId());
CameraWidget::paintGL(); s->scene.wide_cam = CameraWidget::getStreamType() == VISION_STREAM_WIDE_ROAD;
if (s->scene.calibration_valid) {
auto calib = s->scene.wide_cam ? s->scene.view_from_wide_calib : s->scene.view_from_calib;
CameraWidget::updateCalibration(calib);
} else {
CameraWidget::updateCalibration(DEFAULT_CALIBRATION);
} }
painter.beginNativePainting();
CameraWidget::setFrameId(model.getFrameId());
CameraWidget::paintGL();
painter.endNativePainting();
QPainter painter(this); QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::Antialiasing);
@@ -1025,7 +1036,7 @@ void AnnotatedCameraWidget::paintGL() {
update_model(s, model, sm["uiPlan"].getUiPlan()); update_model(s, model, sm["uiPlan"].getUiPlan());
drawLaneLines(painter, s); drawLaneLines(painter, s);
if (s->scene.longitudinal_control && sm.rcv_frame("radarState") > s->scene.started_frame) { if (s->scene.longitudinal_control && sm.rcv_frame("radarState") > s->scene.started_frame && !scene.hide_lead_marker) {
auto radar_state = sm["radarState"].getRadarState(); auto radar_state = sm["radarState"].getRadarState();
update_leads(s, radar_state, model.getPosition()); update_leads(s, radar_state, model.getPosition());
auto lead_one = radar_state.getLeadOne(); auto lead_one = radar_state.getLeadOne();
@@ -1145,7 +1156,7 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() {
} }
void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) { void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
alwaysOnLateral = scene.always_on_lateral; alwaysOnLateral = scene.always_on_lateral && !scene.hide_aol_status_bar;
alwaysOnLateralActive = scene.always_on_lateral_active; alwaysOnLateralActive = scene.always_on_lateral_active;
blindSpotLeft = scene.blind_spot_left; blindSpotLeft = scene.blind_spot_left;
@@ -1155,7 +1166,7 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
compass = scene.compass; compass = scene.compass;
conditionalExperimental = scene.conditional_experimental; conditionalExperimental = scene.conditional_experimental && !scene.hide_cem_status_bar;
conditionalSpeed = scene.conditional_speed; conditionalSpeed = scene.conditional_speed;
conditionalSpeedLead = scene.conditional_speed_lead; conditionalSpeedLead = scene.conditional_speed_lead;
conditionalStatus = scene.conditional_status; conditionalStatus = scene.conditional_status;
@@ -1220,10 +1231,12 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
map_settings_btn_bottom->setEnabled(map_settings_btn->isEnabled()); map_settings_btn_bottom->setEnabled(map_settings_btn->isEnabled());
if (map_settings_btn_bottom->isEnabled()) { if (map_settings_btn_bottom->isEnabled()) {
map_settings_btn_bottom->setVisible(!hideBottomIcons && !compass); map_settings_btn_bottom->setVisible(!hideBottomIcons && !compass && !scene.hide_map_icon);
bottom_layout->setAlignment(map_settings_btn_bottom, rightHandDM ? Qt::AlignLeft : Qt::AlignRight); bottom_layout->setAlignment(map_settings_btn_bottom, rightHandDM ? Qt::AlignLeft : Qt::AlignRight);
} }
recorder_btn->setVisible(scene.screen_recorder && !mapOpen);
// Update the turn signal animation images upon toggle change // Update the turn signal animation images upon toggle change
if (customSignals != scene.custom_signals || currentHolidayTheme != scene.current_holiday_theme) { if (customSignals != scene.custom_signals || currentHolidayTheme != scene.current_holiday_theme) {
currentHolidayTheme = scene.current_holiday_theme; currentHolidayTheme = scene.current_holiday_theme;

View File

@@ -92,7 +92,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
case QEvent::MouseMove: { case QEvent::MouseMove: {
// ignore events when device is awakened by resetInteractiveTimeout // ignore events when device is awakened by resetInteractiveTimeout
ignore = !device()->isAwake(); ignore = !device()->isAwake();
device()->resetInteractiveTimeout(); device()->resetInteractiveTimeout(uiState()->scene.screen_timeout, uiState()->scene.screen_timeout_onroad);
break; break;
} }
default: default:

View File

@@ -303,12 +303,15 @@ void ui_update_frogpilot_params(UIState *s) {
UIScene &scene = s->scene; UIScene &scene = s->scene;
scene.always_on_lateral = params.getBool("AlwaysOnLateral"); scene.always_on_lateral = params.getBool("AlwaysOnLateral");
scene.hide_aol_status_bar = scene.always_on_lateral && params.getBool("HideAOLStatusBar");
scene.camera_view = params.getInt("CameraView"); scene.camera_view = params.getInt("CameraView");
scene.compass = params.getBool("Compass"); scene.compass = params.getBool("Compass");
scene.conditional_experimental = params.getBool("ConditionalExperimental"); scene.conditional_experimental = params.getBool("ConditionalExperimental");
scene.conditional_speed = params.getInt("CESpeed"); scene.conditional_speed = scene.conditional_experimental ? params.getInt("CESpeed") : 0;
scene.conditional_speed_lead = params.getInt("CESpeedLead"); scene.conditional_speed_lead = scene.conditional_experimental ? params.getInt("CESpeedLead") : 0;
scene.hide_cem_status_bar = scene.conditional_experimental && params.getBool("HideCEMStatusBar");
bool custom_onroad_ui = params.getBool("CustomUI"); bool custom_onroad_ui = params.getBool("CustomUI");
scene.acceleration_path = custom_onroad_ui && params.getBool("AccelerationPath"); scene.acceleration_path = custom_onroad_ui && params.getBool("AccelerationPath");
@@ -334,6 +337,7 @@ void ui_update_frogpilot_params(UIState *s) {
scene.model_ui = params.getBool("ModelUI"); scene.model_ui = params.getBool("ModelUI");
scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth"); scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth");
scene.hide_lead_marker = scene.model_ui && params.getBool("HideLeadMarker");
scene.lane_line_width = params.getInt("LaneLinesWidth") * (scene.is_metric ? 1.0f : INCH_TO_CM) / 200.0f; scene.lane_line_width = params.getInt("LaneLinesWidth") * (scene.is_metric ? 1.0f : INCH_TO_CM) / 200.0f;
scene.path_edge_width = params.getInt("PathEdgeWidth"); scene.path_edge_width = params.getInt("PathEdgeWidth");
scene.path_width = params.getInt("PathWidth") / 10.0f * (scene.is_metric ? 1.0f : FOOT_TO_METER) / 2.0f; scene.path_width = params.getInt("PathWidth") / 10.0f * (scene.is_metric ? 1.0f : FOOT_TO_METER) / 2.0f;
@@ -352,7 +356,18 @@ void ui_update_frogpilot_params(UIState *s) {
scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI"); scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI");
scene.rotating_wheel = params.getBool("RotatingWheel"); scene.rotating_wheel = params.getBool("RotatingWheel");
scene.screen_brightness = params.getInt("ScreenBrightness");
bool screen_management = params.getBool("ScreenManagement");
bool hide_ui_elements = screen_management && params.getBool("HideUIElements");
scene.hide_alerts = hide_ui_elements && params.getBool("HideAlerts");
scene.hide_map_icon = hide_ui_elements && params.getBool("HideMapIcon");
scene.hide_max_speed = hide_ui_elements && params.getBool("HideMaxSpeed");
scene.screen_brightness = screen_management ? params.getInt("ScreenBrightness") : 101;
scene.screen_brightness_onroad = screen_management ? params.getInt("ScreenBrightnessOnroad") : 101;
scene.screen_recorder = screen_management && params.getBool("ScreenRecorder");
scene.screen_timeout = screen_management ? params.getInt("ScreenTimeout") : 30;
scene.screen_timeout_onroad = screen_management ? params.getInt("ScreenTimeoutOnroad") : 10;
scene.standby_mode = screen_management && params.getBool("StandbyMode");
} }
void UIState::updateStatus() { void UIState::updateStatus() {
@@ -366,6 +381,12 @@ void UIState::updateStatus() {
} else { } else {
status = controls_state.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED; status = controls_state.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED;
} }
// Trigger standby mode on alerts and status changes
scene.active_alert = controls_state.getAlertStatus() != cereal::ControlsState::AlertStatus::NORMAL;
scene.status_changed = status != previous_status;
previous_status = status;
} }
// Handle onroad/offroad transition // Handle onroad/offroad transition
@@ -468,9 +489,11 @@ void Device::setAwake(bool on) {
} }
} }
void Device::resetInteractiveTimeout(int timeout) { void Device::resetInteractiveTimeout(int timeout, int timeout_onroad) {
if (timeout == -1) { if (timeout == -1) {
timeout = 30; timeout = (ignition_on ? 10 : 30);
} else {
timeout = (ignition_on ? timeout_onroad : timeout);
} }
interactive_timeout = timeout * UI_FREQ; interactive_timeout = timeout * UI_FREQ;
} }
@@ -494,8 +517,10 @@ void Device::updateBrightness(const UIState &s) {
int brightness = brightness_filter.update(clipped_brightness); int brightness = brightness_filter.update(clipped_brightness);
if (!awake) { if (!awake) {
brightness = 0; brightness = 0;
} else if (s.scene.screen_brightness <= 100) { } else if (s.scene.started && s.scene.screen_brightness_onroad != 101) {
// Bring the screen brightness up to 5% upon screen tap // Bring the screen brightness up to 5% upon screen tap
brightness = interactive_timeout > 0 ? fmax(5, s.scene.screen_brightness_onroad) : s.scene.screen_brightness_onroad;
} else if (s.scene.screen_brightness != 101) {
brightness = fmax(5, s.scene.screen_brightness); brightness = fmax(5, s.scene.screen_brightness);
} }
@@ -508,16 +533,27 @@ void Device::updateBrightness(const UIState &s) {
} }
void Device::updateWakefulness(const UIState &s) { void Device::updateWakefulness(const UIState &s) {
bool ignition_just_turned_off = !s.scene.ignition && ignition_on; bool ignition_state_changed = s.scene.ignition != ignition_on;
ignition_on = s.scene.ignition; ignition_on = s.scene.ignition;
if (ignition_just_turned_off) { if (ignition_on && s.scene.standby_mode) {
resetInteractiveTimeout(); if (s.scene.active_alert || s.scene.speed_limit_changed || s.scene.status_changed) {
resetInteractiveTimeout(s.scene.screen_timeout, s.scene.screen_timeout_onroad);
}
}
if (ignition_state_changed) {
// Instantly turn off the screen if the onroad brightness is set to 0%
if (ignition_on && s.scene.screen_brightness_onroad == 0 && !s.scene.standby_mode) {
resetInteractiveTimeout(0, 0);
} else {
resetInteractiveTimeout(s.scene.screen_timeout, s.scene.screen_timeout_onroad);
}
} else if (interactive_timeout > 0 && --interactive_timeout == 0) { } else if (interactive_timeout > 0 && --interactive_timeout == 0) {
emit interactiveTimeout(); emit interactiveTimeout();
} }
if (s.scene.screen_brightness != 0) { if (s.scene.screen_brightness_onroad != 0) {
setAwake(s.scene.ignition || interactive_timeout > 0); setAwake(s.scene.ignition || interactive_timeout > 0);
} else { } else {
setAwake(interactive_timeout > 0); setAwake(interactive_timeout > 0);

View File

@@ -176,6 +176,7 @@ typedef struct UIScene {
// FrogPilot variables // FrogPilot variables
bool acceleration_path; bool acceleration_path;
bool active_alert;
bool adjacent_path; bool adjacent_path;
bool adjacent_path_metrics; bool adjacent_path_metrics;
bool always_on_lateral; bool always_on_lateral;
@@ -194,6 +195,12 @@ typedef struct UIScene {
bool fahrenheit; bool fahrenheit;
bool fps_counter; bool fps_counter;
bool full_map; bool full_map;
bool hide_alerts;
bool hide_aol_status_bar;
bool hide_cem_status_bar;
bool hide_lead_marker;
bool hide_map_icon;
bool hide_max_speed;
bool hide_speed; bool hide_speed;
bool hide_speed_ui; bool hide_speed_ui;
bool holiday_themes; bool holiday_themes;
@@ -207,8 +214,11 @@ typedef struct UIScene {
bool reverse_cruise_ui; bool reverse_cruise_ui;
bool road_name_ui; bool road_name_ui;
bool rotating_wheel; bool rotating_wheel;
bool screen_recorder;
bool show_driver_camera; bool show_driver_camera;
bool standby_mode;
bool standstill; bool standstill;
bool status_changed;
bool tethering_enabled; bool tethering_enabled;
bool turn_signal_left; bool turn_signal_left;
bool turn_signal_right; bool turn_signal_right;
@@ -237,6 +247,9 @@ typedef struct UIScene {
int obstacle_distance; int obstacle_distance;
int obstacle_distance_stock; int obstacle_distance_stock;
int screen_brightness; int screen_brightness;
int screen_brightness_onroad;
int screen_timeout;
int screen_timeout_onroad;
int steering_angle_deg; int steering_angle_deg;
int stopped_equivalence; int stopped_equivalence;
@@ -270,8 +283,11 @@ public:
QTransform car_space_transform; QTransform car_space_transform;
// FrogPilot variables
WifiManager *wifi = nullptr; WifiManager *wifi = nullptr;
UIStatus previous_status;
signals: signals:
void uiUpdate(const UIState &s); void uiUpdate(const UIState &s);
void offroadTransition(bool offroad); void offroadTransition(bool offroad);
@@ -319,7 +335,7 @@ signals:
void interactiveTimeout(); void interactiveTimeout();
public slots: public slots:
void resetInteractiveTimeout(int timeout = -1); void resetInteractiveTimeout(int timeout = -1, int timeout_onroad = -1);
void update(const UIState &s); void update(const UIState &s);
}; };