diff --git a/common/params.cc b/common/params.cc index 3b93663..8efbe29 100644 --- a/common/params.cc +++ b/common/params.cc @@ -259,11 +259,13 @@ std::unordered_map keys = { {"Fahrenheit", PERSISTENT}, {"FireTheBabysitter", PERSISTENT}, {"FrogPilotTogglesUpdated", PERSISTENT}, + {"FullMap", PERSISTENT}, {"GasRegenCmd", PERSISTENT}, {"GMapKey", PERSISTENT}, {"GoatScream", PERSISTENT}, {"GreenLightAlert", PERSISTENT}, {"HideSpeed", PERSISTENT}, + {"HigherBitrate", PERSISTENT}, {"LaneChangeTime", PERSISTENT}, {"LaneDetection", PERSISTENT}, {"LaneLinesWidth", PERSISTENT}, @@ -313,6 +315,8 @@ std::unordered_map keys = { {"PersonalityChangedViaWheel", PERSISTENT}, {"PreferredSchedule", PERSISTENT}, {"PreviousSpeedLimit", PERSISTENT}, + {"QOLControls", PERSISTENT}, + {"QOLVisuals", PERSISTENT}, {"RelaxedFollow", PERSISTENT}, {"RelaxedJerk", PERSISTENT}, {"ReverseCruise", PERSISTENT}, @@ -323,6 +327,7 @@ std::unordered_map keys = { {"SchedulePending", PERSISTENT}, {"ScreenBrightness", PERSISTENT}, {"SearchInput", PERSISTENT}, + {"SetSpeedOffset", PERSISTENT}, {"ShowCPU", PERSISTENT}, {"ShowFPS", PERSISTENT}, {"ShowGPU", PERSISTENT}, diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 1981810..5196397 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -216,16 +216,16 @@ def crash_log(candidate): "AggressiveJerk", "StandardFollow", "StandardJerk", "RelaxedFollow", "RelaxedJerk", "DeviceShutdown", "ExperimentalModeViaPress", "FireTheBabysitter", "NoLogging", "MuteDM", "MuteDoor", "MuteSeatbelt", "MuteOverheated", "LateralTune", "AverageCurvature", "NNFF", "LongitudinalTune", "AccelerationProfile", "StoppingDistance", "AggressiveAcceleration", "SmoothBraking", "Model", "MTSCEnabled", - "NudgelessLaneChange", "LaneChangeTime", "LaneDetection", "OneLaneChange", "PauseLateralOnSignal", "SpeedLimitController", "SLCFallback", - "SLCOverride", "SLCPriority", "Offset1", "Offset2", "Offset3", "Offset4", "TurnDesires", "VisionTurnControl", "CurveSensitivity", "TurnAggressiveness", - "DisableOnroadUploads", "OfflineMode", "ReverseCruise" + "NudgelessLaneChange", "LaneChangeTime", "LaneDetection", "OneLaneChange", "QOLControls", "HigherBitrate", "PauseLateralOnSignal", "ReverseCruise", + "SetSpeedOffset", "SpeedLimitController", "SLCFallback","SLCOverride", "SLCPriority", "Offset1", "Offset2", "Offset3", "Offset4", "TurnDesires", + "VisionTurnControl", "CurveSensitivity", "TurnAggressiveness", "DisableOnroadUploads", "OfflineMode" ], [ "EVTable", "GasRegenCmd", "LongPitch", "LowerVolt", "LockDoors", "SNGHack", "TSS2Tune" ], [ "CustomTheme", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds", "GoatScream", "CameraView", "Compass", "CustomUI", "LaneLinesWidth", "RoadEdgesWidth", "PathWidth", "PathEdgeWidth", "AccelerationPath", "AdjacentPath", "BlindSpotPath", "ShowFPS", "LeadInfo", "RoadNameUI", "UnlimitedLength", - "DriverCamera", "GreenLightAlert", "ModelUI", "RandomEvents", "RotatingWheel", "ScreenBrightness", "Sidebar", "SilentMode", "WheelIcon", "HideSpeed", - "NumericalTemp", "Fahrenheit", "ShowCPU", "ShowGPU", "ShowMemoryUsage", "ShowSLCOffset", "ShowStorageLeft", "ShowStorageUsed", "UseSI" + "DriverCamera", "GreenLightAlert", "ModelUI", "QOLVisuals", "FullMap", "HideSpeed", "RandomEvents", "RotatingWheel", "ScreenBrightness", "Sidebar", "SilentMode", + "WheelIcon", "NumericalTemp", "Fahrenheit", "ShowCPU", "ShowGPU", "ShowMemoryUsage", "ShowSLCOffset", "ShowStorageLeft", "ShowStorageUsed", "UseSI" ] control_params, vehicle_params, visual_params = map(lambda keys: get_frogpilot_params(params, keys), [control_keys, vehicle_keys, visual_keys]) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 6d2b715..aa077a1 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -18,7 +18,6 @@ from openpilot.system.version import get_short_branch from openpilot.selfdrive.boardd.boardd import can_list_to_can_capnp from openpilot.selfdrive.car.car_helpers import get_car, get_startup_event, get_one_can from openpilot.selfdrive.controls.lib.lateral_planner import CAMERA_OFFSET -from openpilot.selfdrive.controls.lib.desire_helper import LANE_CHANGE_SPEED_MIN from openpilot.selfdrive.controls.lib.drive_helpers import VCruiseHelper, get_lag_adjusted_curvature from openpilot.selfdrive.controls.lib.latcontrol import LatControl, MIN_LATERAL_CONTROL_SPEED from openpilot.selfdrive.controls.lib.longcontrol import LongControl @@ -527,7 +526,7 @@ class Controls: def state_transition(self, CS): """Compute conditional state transitions and execute actions on state transitions""" - self.v_cruise_helper.update_v_cruise(CS, self.enabled, self.is_metric, self.reverse_cruise_increase) + self.v_cruise_helper.update_v_cruise(CS, self.enabled, self.is_metric, self.reverse_cruise_increase, self.set_speed_offset) # decrement the soft disable timer at every step, as it's reset on # entrance in SOFT_DISABLING state @@ -641,7 +640,7 @@ class Controls: gear = car.CarState.GearShifter driving_gear = CS.gearShifter not in (gear.neutral, gear.park, gear.reverse, gear.unknown) - signal_check = not ((CS.leftBlinker or CS.rightBlinker) and self.pause_lateral_on_signal and CS.vEgo < LANE_CHANGE_SPEED_MIN) + signal_check = not ((CS.leftBlinker or CS.rightBlinker) and CS.vEgo < self.pause_lateral_on_signal and not CS.standstill) # Always on lateral if self.always_on_lateral: @@ -1000,8 +999,10 @@ class Controls: longitudinal_tune = self.params.get_bool("LongitudinalTune") self.sport_plus = self.params.get_int("AccelerationProfile") == 3 and longitudinal_tune - self.pause_lateral_on_signal = self.params.get_bool("PauseLateralOnSignal") - self.reverse_cruise_increase = self.params.get_bool("ReverseCruise") + quality_of_life = self.params.get_bool("QOLControls") + self.pause_lateral_on_signal = self.params.get_int("PauseLateralOnSignal") * (CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS) if quality_of_life else 0 + self.reverse_cruise_increase = self.params.get_bool("ReverseCruise") and quality_of_life + self.set_speed_offset = self.params.get_int("SetSpeedOffset") * (1 if self.is_metric else CV.MPH_TO_KPH) if quality_of_life else 0 def main(): controls = Controls() diff --git a/selfdrive/controls/lib/drive_helpers.py b/selfdrive/controls/lib/drive_helpers.py index 0e2862e..d6186be 100644 --- a/selfdrive/controls/lib/drive_helpers.py +++ b/selfdrive/controls/lib/drive_helpers.py @@ -52,13 +52,13 @@ class VCruiseHelper: def v_cruise_initialized(self): return self.v_cruise_kph != V_CRUISE_UNSET - def update_v_cruise(self, CS, enabled, is_metric, reverse_cruise_increase): + def update_v_cruise(self, CS, enabled, is_metric, reverse_cruise_increase, set_speed_offset): self.v_cruise_kph_last = self.v_cruise_kph if CS.cruiseState.available: if not self.CP.pcmCruise: # if stock cruise is completely disabled, then we can use our own set speed logic - self._update_v_cruise_non_pcm(CS, enabled, is_metric, reverse_cruise_increase) + self._update_v_cruise_non_pcm(CS, enabled, is_metric, reverse_cruise_increase, set_speed_offset) self.v_cruise_cluster_kph = self.v_cruise_kph self.update_button_timers(CS, enabled) else: @@ -68,7 +68,7 @@ class VCruiseHelper: self.v_cruise_kph = V_CRUISE_UNSET self.v_cruise_cluster_kph = V_CRUISE_UNSET - def _update_v_cruise_non_pcm(self, CS, enabled, is_metric, reverse_cruise_increase): + def _update_v_cruise_non_pcm(self, CS, enabled, is_metric, reverse_cruise_increase, set_speed_offset): # handle button presses. TODO: this should be in state_control, but a decelCruise press # would have the effect of both enabling and changing speed is checked after the state transition if not enabled: @@ -110,6 +110,12 @@ class VCruiseHelper: else: self.v_cruise_kph += v_cruise_delta * CRUISE_INTERVAL_SIGN[button_type] + # Apply offset + v_cruise_offset = (set_speed_offset * CRUISE_INTERVAL_SIGN[button_type]) if long_press else 0 + if v_cruise_offset < 0: + v_cruise_offset = set_speed_offset - v_cruise_delta + self.v_cruise_kph += v_cruise_offset + # If set is pressed while overriding, clip cruise speed to minimum of vEgo if CS.gasPressed and button_type in (ButtonType.decelCruise, ButtonType.setCruise): self.v_cruise_kph = max(self.v_cruise_kph, CS.vEgo * CV.MS_TO_KPH) diff --git a/selfdrive/frogpilot/assets/toggle_icons/quality_of_life.png b/selfdrive/frogpilot/assets/toggle_icons/quality_of_life.png new file mode 100644 index 0000000..1719a60 Binary files /dev/null and b/selfdrive/frogpilot/assets/toggle_icons/quality_of_life.png differ diff --git a/selfdrive/frogpilot/ui/control_settings.cc b/selfdrive/frogpilot/ui/control_settings.cc index 70e43d6..5d9ce55 100644 --- a/selfdrive/frogpilot/ui/control_settings.cc +++ b/selfdrive/frogpilot/ui/control_settings.cc @@ -42,7 +42,12 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil {"LaneChangeTime", "Lane Change Timer", "Specify a delay before executing a nudgeless lane change.", ""}, {"LaneDetection", "Lane Detection", "Block nudgeless lane changes when a lane isn't detected.", ""}, {"OneLaneChange", "One Lane Change Per Signal", "Limit to one nudgeless lane change per turn signal activation.", ""}, - {"PauseLateralOnSignal", "Pause Lateral On Turn Signal", "Temporarily disable lateral control during turn signal use.", ""}, + + {"QOLControls", "Quality of Life", "Miscellaneous quality of life changes to improve your overall openpilot experience.", "../frogpilot/assets/toggle_icons/quality_of_life.png"}, + {"HigherBitrate", "Higher Bitrate Recording", "Increases the quality of the footage uploaded to comma connect.", ""}, + {"PauseLateralOnSignal", "Pause Lateral On Turn Signal Below", "Temporarily disable lateral control during turn signal use below the set speed.", ""}, + {"ReverseCruise", "Reverse Cruise Increase", "Reverses the 'long press' functionality when increasing the max set speed. Useful to increase the max speed quickly.", ""}, + {"SetSpeedOffset", "Set Speed Offset", "Set an offset for your desired set speed.", ""}, {"SpeedLimitController", "Speed Limit Controller", "Automatically adjust vehicle speed to match speed limits using 'Open Street Map's, 'Navigate On openpilot', or your car's dashboard (TSS2 Toyotas only).", "../assets/offroad/icon_speed_limit.png"}, {"Offset1", "Speed Limit Offset (0-34 mph)", "Speed limit offset for speed limits between 0-34 mph.", ""}, @@ -94,16 +99,16 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil toggle = conditionalExperimentalToggle; } else if (param == "CECurves") { FrogPilotParamValueControl *CESpeedImperial = new FrogPilotParamValueControl("CESpeed", "Below", "Switch to 'Experimental Mode' below this speed in absence of a lead vehicle.", "", 0, 99, - std::map(), this, false, " mph"); + std::map(), this, false, " mph"); FrogPilotParamValueControl *CESpeedLeadImperial = new FrogPilotParamValueControl("CESpeedLead", " w/Lead", "Switch to 'Experimental Mode' below this speed when following a lead vehicle.", "", 0, 99, - std::map(), this, false, " mph"); + std::map(), this, false, " mph"); conditionalSpeedsImperial = new FrogPilotDualParamControl(CESpeedImperial, CESpeedLeadImperial, this); addItem(conditionalSpeedsImperial); FrogPilotParamValueControl *CESpeedMetric = new FrogPilotParamValueControl("CESpeed", "Below", "Switch to 'Experimental Mode' below this speed in absence of a lead vehicle.", "", 0, 150, - std::map(), this, false, " kph"); - FrogPilotParamValueControl *CESpeedLeadMetric = new FrogPilotParamValueControl("CESpeedLead", " w/Lead", "Switch to 'Experimental Mode' below this speed when following a lead vehicle.", "", - 0, 150, std::map(), this, false, " kph"); + std::map(), this, false, " kph"); + FrogPilotParamValueControl *CESpeedLeadMetric = new FrogPilotParamValueControl("CESpeedLead", " w/Lead", "Switch to 'Experimental Mode' below this speed when following a lead vehicle.", "", 0, 150, + std::map(), this, false, " kph"); conditionalSpeedsMetric = new FrogPilotDualParamControl(CESpeedMetric, CESpeedLeadMetric, this); addItem(conditionalSpeedsMetric); @@ -245,6 +250,20 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil } toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 10, laneChangeTimeLabels, this, false); + } else if (param == "QOLControls") { + FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); + QObject::connect(qolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() { + parentToggleClicked(); + for (auto &[key, toggle] : toggles) { + toggle->setVisible(qolKeys.find(key.c_str()) != qolKeys.end()); + } + }); + toggle = qolToggle; + } else if (param == "PauseLateralOnSignal") { + toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 99, std::map(), this, false, " mph"); + } else if (param == "SetSpeedOffset") { + toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 99, std::map(), this, false, " mph"); + } else if (param == "SpeedLimitController") { FrogPilotParamManageControl *speedLimitControllerToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); QObject::connect(speedLimitControllerToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() { @@ -366,7 +385,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil }); } - std::set rebootKeys = {"AlwaysOnLateral", "FireTheBabysitter", "MuteDM", "NNFF"}; + std::set rebootKeys = {"AlwaysOnLateral", "FireTheBabysitter", "HigherBitrate", "MuteDM", "NNFF"}; for (const std::string &key : rebootKeys) { QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this]() { if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) { @@ -377,9 +396,10 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil conditionalExperimentalKeys = {"CECurves", "CECurvesLead", "CESlowerLead", "CENavigation", "CEStopLights", "CESignal"}; fireTheBabysitterKeys = {"NoLogging", "MuteDM", "MuteDoor", "MuteOverheated", "MuteSeatbelt"}; - laneChangeKeys = {"LaneChangeTime", "LaneDetection", "OneLaneChange", "PauseLateralOnSignal"}; + laneChangeKeys = {"LaneChangeTime", "LaneDetection", "OneLaneChange"}; lateralTuneKeys = {"AverageCurvature", "NNFF", "SteerRatio"}; longitudinalTuneKeys = {"AccelerationProfile", "AggressiveAcceleration", "SmoothBraking", "StoppingDistance"}; + qolKeys = {"HigherBitrate", "PauseLateralOnSignal", "ReverseCruise", "SetSpeedOffset"}; speedLimitControllerKeys = {"Offset1", "Offset2", "Offset3", "Offset4", "SLCFallback", "SLCOverride", "SLCPriority"}; visionTurnControlKeys = {"CurveSensitivity", "TurnAggressiveness"}; @@ -426,6 +446,8 @@ void FrogPilotControlsPanel::updateMetric() { params.putInt("Offset2", std::nearbyint(params.getInt("Offset2") * speedConversion)); params.putInt("Offset3", std::nearbyint(params.getInt("Offset3") * speedConversion)); params.putInt("Offset4", std::nearbyint(params.getInt("Offset4") * speedConversion)); + params.putInt("PauseLateralOnSignal", std::nearbyint(params.getInt("PauseLateralOnSignal") * speedConversion)); + params.putInt("SetSpeedOffset", std::nearbyint(params.getInt("SetSpeedOffset") * speedConversion)); params.putInt("StoppingDistance", std::nearbyint(params.getInt("StoppingDistance") * distanceConversion)); } @@ -433,6 +455,8 @@ void FrogPilotControlsPanel::updateMetric() { FrogPilotParamValueControl *offset2Toggle = static_cast(toggles["Offset2"]); FrogPilotParamValueControl *offset3Toggle = static_cast(toggles["Offset3"]); FrogPilotParamValueControl *offset4Toggle = static_cast(toggles["Offset4"]); + FrogPilotParamValueControl *pauseLateralToggle = static_cast(toggles["PauseLateralOnSignal"]); + FrogPilotParamValueControl *setSpeedOffsetToggle = static_cast(toggles["SetSpeedOffset"]); FrogPilotParamValueControl *stoppingDistanceToggle = static_cast(toggles["StoppingDistance"]); if (isMetric) { @@ -446,10 +470,12 @@ void FrogPilotControlsPanel::updateMetric() { offset3Toggle->setDescription("Set speed limit offset for limits between 55-64 kph."); offset4Toggle->setDescription("Set speed limit offset for limits between 65-99 kph."); - offset1Toggle->updateControl(0, 99, " kph"); - offset2Toggle->updateControl(0, 99, " kph"); - offset3Toggle->updateControl(0, 99, " kph"); - offset4Toggle->updateControl(0, 99, " kph"); + offset1Toggle->updateControl(0, 150, " kph"); + offset2Toggle->updateControl(0, 150, " kph"); + offset3Toggle->updateControl(0, 150, " kph"); + offset4Toggle->updateControl(0, 150, " kph"); + pauseLateralToggle->updateControl(0, 150, " kph"); + setSpeedOffsetToggle->updateControl(0, 150, " kph"); stoppingDistanceToggle->updateControl(0, 5, " meters"); } else { offset1Toggle->setTitle("Speed Limit Offset (0-34 mph)"); @@ -466,6 +492,8 @@ void FrogPilotControlsPanel::updateMetric() { offset2Toggle->updateControl(0, 99, " mph"); offset3Toggle->updateControl(0, 99, " mph"); offset4Toggle->updateControl(0, 99, " mph"); + pauseLateralToggle->updateControl(0, 99, " mph"); + setSpeedOffsetToggle->updateControl(0, 99, " mph"); stoppingDistanceToggle->updateControl(0, 10, " feet"); } @@ -473,6 +501,8 @@ void FrogPilotControlsPanel::updateMetric() { offset2Toggle->refresh(); offset3Toggle->refresh(); offset4Toggle->refresh(); + pauseLateralToggle->refresh(); + setSpeedOffsetToggle->refresh(); stoppingDistanceToggle->refresh(); previousIsMetric = isMetric; @@ -501,12 +531,13 @@ void FrogPilotControlsPanel::hideSubToggles() { for (auto &[key, toggle] : toggles) { bool subToggles = conditionalExperimentalKeys.find(key.c_str()) != conditionalExperimentalKeys.end() || - fireTheBabysitterKeys.find(key.c_str()) != fireTheBabysitterKeys.end() || - laneChangeKeys.find(key.c_str()) != laneChangeKeys.end() || - lateralTuneKeys.find(key.c_str()) != lateralTuneKeys.end() || - longitudinalTuneKeys.find(key.c_str()) != longitudinalTuneKeys.end() || - speedLimitControllerKeys.find(key.c_str()) != speedLimitControllerKeys.end() || - visionTurnControlKeys.find(key.c_str()) != visionTurnControlKeys.end(); + fireTheBabysitterKeys.find(key.c_str()) != fireTheBabysitterKeys.end() || + laneChangeKeys.find(key.c_str()) != laneChangeKeys.end() || + lateralTuneKeys.find(key.c_str()) != lateralTuneKeys.end() || + longitudinalTuneKeys.find(key.c_str()) != longitudinalTuneKeys.end() || + qolKeys.find(key.c_str()) != qolKeys.end() || + speedLimitControllerKeys.find(key.c_str()) != speedLimitControllerKeys.end() || + visionTurnControlKeys.find(key.c_str()) != visionTurnControlKeys.end(); toggle->setVisible(!subToggles); } diff --git a/selfdrive/frogpilot/ui/control_settings.h b/selfdrive/frogpilot/ui/control_settings.h index d49f3df..1520c11 100644 --- a/selfdrive/frogpilot/ui/control_settings.h +++ b/selfdrive/frogpilot/ui/control_settings.h @@ -38,6 +38,7 @@ private: std::set laneChangeKeys; std::set lateralTuneKeys; std::set longitudinalTuneKeys; + std::set qolKeys; std::set speedLimitControllerKeys; std::set visionTurnControlKeys; diff --git a/selfdrive/frogpilot/ui/frogpilot_functions.cc b/selfdrive/frogpilot/ui/frogpilot_functions.cc index 3585bd0..496989a 100644 --- a/selfdrive/frogpilot/ui/frogpilot_functions.cc +++ b/selfdrive/frogpilot/ui/frogpilot_functions.cc @@ -83,10 +83,12 @@ void setDefaultParams() { {"ExperimentalModeViaPress", "1"}, {"Fahrenheit", "0"}, {"FireTheBabysitter", FrogsGoMoo ? "1" : "0"}, + {"FullMap", "0"}, {"GasRegenCmd", "0"}, {"GoatScream", "1"}, {"GreenLightAlert", "0"}, {"HideSpeed", "0"}, + {"HigherBitrate", "0"}, {"LaneChangeTime", "0"}, {"LaneDetection", "1"}, {"LaneLinesWidth", "4"}, @@ -116,6 +118,8 @@ void setDefaultParams() { {"PathWidth", "61"}, {"PauseLateralOnSignal", "0"}, {"PreferredSchedule", "0"}, + {"QOLControls", "1"}, + {"QOLVisuals", "1"}, {"RandomEvents", FrogsGoMoo ? "1" : "0"}, {"RelaxedFollow", "30"}, {"RelaxedJerk", "50"}, diff --git a/selfdrive/frogpilot/ui/visual_settings.cc b/selfdrive/frogpilot/ui/visual_settings.cc index c3915e0..117ad8f 100644 --- a/selfdrive/frogpilot/ui/visual_settings.cc +++ b/selfdrive/frogpilot/ui/visual_settings.cc @@ -30,6 +30,11 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot {"RoadEdgesWidth", "Road Edges", "Adjust the visual thickness of road edges on your display.\n\nDefault is 1/2 of the MUTCD average lane line width of 4 inches.", ""}, {"UnlimitedLength", "'Unlimited' Road UI Length", "Extend the display of the path, lane lines, and road edges as far as the system can detect, providing a more expansive view of the road ahead.", ""}, + {"QOLVisuals", "Quality of Life", "Miscellaneous quality of life changes to improve your overall openpilot experience.", "../frogpilot/assets/toggle_icons/quality_of_life.png"}, + {"DriveStats", "Drive Stats In Home Screen", "Display your device's drive stats in the home screen.", ""}, + {"HideSpeed", "Hide Speed", "Hide the speed indicator in the onroad UI.", ""}, + {"ShowSLCOffset", "Show Speed Limit Offset", "Show the speed limit offset seperated from the speed limit in the onroad UI when using 'Speed Limit Controller'.", ""}, + {"ScreenBrightness", "Screen Brightness", "Customize your screen brightness.", "../frogpilot/assets/toggle_icons/icon_light.png"}, {"SilentMode", "Silent Mode", "Mute openpilot sounds for a quieter driving experience.", "../frogpilot/assets/toggle_icons/icon_mute.png"}, {"WheelIcon", "Steering Wheel Icon", "Replace the default steering wheel icon with a custom design, adding a unique touch to your interface.", "../assets/offroad/icon_openpilot.png"}, @@ -99,6 +104,16 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot } else if (param == "PathWidth") { toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map(), this, false, " feet", 10); + } else if (param == "QOLVisuals") { + FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); + QObject::connect(qolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() { + parentToggleClicked(); + for (auto &[key, toggle] : toggles) { + toggle->setVisible(qolKeys.find(key.c_str()) != qolKeys.end()); + } + }); + toggle = qolToggle; + } else if (param == "ScreenBrightness") { std::map brightnessLabels; for (int i = 0; i <= 101; ++i) { @@ -139,6 +154,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot customOnroadUIKeys = {"AdjacentPath", "BlindSpotPath", "ShowFPS", "LeadInfo", "RoadNameUI"}; customThemeKeys = {"CustomColors", "CustomIcons", "CustomSignals", "CustomSounds"}; modelUIKeys = {"AccelerationPath", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"}; + qolKeys = {"DriveStats", "HideSpeed", "ShowSLCOffset"}; QObject::connect(device(), &Device::interactiveTimeout, this, &FrogPilotVisualsPanel::hideSubToggles); QObject::connect(parent, &SettingsWindow::closeParentToggle, this, &FrogPilotVisualsPanel::hideSubToggles); @@ -201,8 +217,9 @@ void FrogPilotVisualsPanel::parentToggleClicked() { void FrogPilotVisualsPanel::hideSubToggles() { for (auto &[key, toggle] : toggles) { bool subToggles = modelUIKeys.find(key.c_str()) != modelUIKeys.end() || - customOnroadUIKeys.find(key.c_str()) != customOnroadUIKeys.end() || - customThemeKeys.find(key.c_str()) != customThemeKeys.end(); + customOnroadUIKeys.find(key.c_str()) != customOnroadUIKeys.end() || + customThemeKeys.find(key.c_str()) != customThemeKeys.end() || + qolKeys.find(key.c_str()) != qolKeys.end(); toggle->setVisible(!subToggles); } diff --git a/selfdrive/frogpilot/ui/visual_settings.h b/selfdrive/frogpilot/ui/visual_settings.h index 55602cb..f30cda7 100644 --- a/selfdrive/frogpilot/ui/visual_settings.h +++ b/selfdrive/frogpilot/ui/visual_settings.h @@ -25,6 +25,7 @@ private: std::set customOnroadUIKeys; std::set customThemeKeys; std::set modelUIKeys; + std::set qolKeys; std::map toggles; diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 94dd816..fea0732 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -138,14 +138,23 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) { if (isMaxSpeedClicked) { reverseCruise = !params.getBool("ReverseCruise"); params.putBoolNonBlocking("ReverseCruise", reverseCruise); + if (!params.getBool("QOLControls")) { + params.putBoolNonBlocking("QOLControls", true); + } paramsMemory.putBoolNonBlocking("FrogPilotTogglesUpdated", true); // Check if the click was within the speed text area } else if (isSpeedClicked) { - speedHidden = !params.getBool("HideSpeed"); - params.putBoolNonBlocking("HideSpeed", speedHidden); + hideSpeed = !params.getBool("HideSpeed"); + params.putBoolNonBlocking("HideSpeed", hideSpeed); + if (!params.getBool("QOLVisuals")) { + params.putBoolNonBlocking("QOLVisuals", true); + } } else { showSLCOffset = !params.getBool("ShowSLCOffset"); params.putBoolNonBlocking("ShowSLCOffset", showSLCOffset); + if (!params.getBool("QOLVisuals")) { + params.putBoolNonBlocking("QOLVisuals", true); + } } widgetClicked = true; // If the click wasn't for anything specific, change the value of "ExperimentalMode" @@ -193,7 +202,11 @@ void OnroadWindow::offroadTransition(bool offroad) { QObject::connect(nvg->map_settings_btn_bottom, &MapSettingsButton::clicked, m, &MapPanel::toggleMapSettings); nvg->map_settings_btn->setEnabled(true); - m->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE); + if (scene.full_map) { + m->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + } else { + m->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE); + } split->insertWidget(0, m); // hidden by default, made visible when navRoute is published @@ -643,7 +656,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) { } // current speed - if (!speedHidden) { + if (!hideSpeed) { p.setFont(InterFont(176, QFont::Bold)); drawText(p, rect().center().x(), 210, speedStr); p.setFont(InterFont(66)); @@ -1125,16 +1138,13 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() { main_layout->addLayout(bottom_layout); - if (params.getBool("HideSpeed")) { - speedHidden = true; + if (params.getBool("QOLControls")) { + reverseCruise = params.getBool("ReverseCruise"); } - if (params.getBool("ReverseCruise")) { - reverseCruise = true; - } - - if (params.getBool("ShowSLCOffset")) { - showSLCOffset = true; + if (params.getBool("QOLVisuals")) { + hideSpeed = params.getBool("HideSpeed"); + showSLCOffset = params.getBool("ShowSLCOffset"); } // Custom themes configuration diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index fd33a65..5265eaa 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -17,9 +17,9 @@ const int btn_size = 192; const int img_size = (btn_size / 4) * 3; // FrogPilot global variables +static bool hideSpeed; static bool reverseCruise; static bool showSLCOffset; -static bool speedHidden; static double fps; // ***** onroad widgets ***** diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 47a8467..48b8081 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -303,29 +303,33 @@ void ui_update_params(UIState *s) { scene.conditional_speed_lead = params.getInt("CESpeedLead"); scene.custom_onroad_ui = params.getBool("CustomUI"); - scene.adjacent_path = scene.custom_onroad_ui && params.getBool("AdjacentPath"); - scene.blind_spot_path = scene.custom_onroad_ui && params.getBool("BlindSpotPath"); - scene.lead_info = scene.custom_onroad_ui && params.getBool("LeadInfo"); - scene.road_name_ui = scene.custom_onroad_ui && params.getBool("RoadNameUI"); - scene.show_fps = scene.custom_onroad_ui && params.getBool("ShowFPS"); - scene.use_si = scene.custom_onroad_ui && params.getBool("UseSI"); + scene.adjacent_path = params.getBool("AdjacentPath") && scene.custom_onroad_ui; + scene.blind_spot_path = params.getBool("BlindSpotPath") && scene.custom_onroad_ui; + scene.lead_info = params.getBool("LeadInfo") && scene.custom_onroad_ui; + scene.road_name_ui = params.getBool("RoadNameUI") && scene.custom_onroad_ui; + scene.show_fps = params.getBool("ShowFPS") && scene.custom_onroad_ui; + scene.use_si = params.getBool("UseSI") && scene.custom_onroad_ui; scene.custom_theme = params.getBool("CustomTheme"); scene.custom_colors = scene.custom_theme ? params.getInt("CustomColors") : 0; scene.custom_signals = scene.custom_theme ? params.getInt("CustomSignals") : 0; scene.model_ui = params.getBool("ModelUI"); - scene.acceleration_path = scene.model_ui && params.getBool("AccelerationPath"); + scene.acceleration_path = params.getBool("AccelerationPath") && scene.model_ui; scene.lane_line_width = params.getInt("LaneLinesWidth") * (scene.is_metric ? 1 : INCH_TO_CM) / 200; scene.path_edge_width = params.getInt("PathEdgeWidth"); scene.path_width = params.getInt("PathWidth") / 10.0 * (scene.is_metric ? 1 : FOOT_TO_METER) / 2; scene.road_edge_width = params.getInt("RoadEdgesWidth") * (scene.is_metric ? 1 : INCH_TO_CM) / 200; - scene.unlimited_road_ui_length = scene.model_ui && params.getBool("UnlimitedLength"); + scene.unlimited_road_ui_length = params.getBool("UnlimitedLength") && scene.model_ui; scene.driver_camera = params.getBool("DriverCamera"); scene.experimental_mode_via_press = params.getBool("ExperimentalModeViaPress"); - scene.mute_dm = params.getBool("FireTheBabysitter") && params.getBool("MuteDM"); + scene.mute_dm = params.getBool("MuteDM") && params.getBool("FireTheBabysitter"); scene.personalities_via_screen = (params.getInt("AdjustablePersonalities") == 2 || params.getInt("AdjustablePersonalities") == 3); + + scene.quality_of_life_visuals = params.getBool("QOLVisuals"); + scene.full_map = params.getBool("QOLVisuals") && scene.quality_of_life_visuals; + scene.rotating_wheel = params.getBool("RotatingWheel"); scene.screen_brightness = params.getInt("ScreenBrightness"); scene.speed_limit_controller = params.getBool("SpeedLimitController"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index bd615a8..9ed1d3a 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -185,11 +185,13 @@ typedef struct UIScene { bool enabled; bool experimental_mode; bool experimental_mode_via_press; + bool full_map; bool lead_info; bool map_open; bool model_ui; bool mute_dm; bool personalities_via_screen; + bool quality_of_life_visuals; bool road_name_ui; bool rotating_wheel; bool show_driver_camera; diff --git a/system/loggerd/loggerd.h b/system/loggerd/loggerd.h index cfc06c2..236a88a 100644 --- a/system/loggerd/loggerd.h +++ b/system/loggerd/loggerd.h @@ -14,7 +14,7 @@ #include "system/loggerd/logger.h" constexpr int MAIN_FPS = 20; -const int MAIN_BITRATE = 1e7; +const int MAIN_BITRATE = Params().getBool("HigherBitrate") ? 20000000 : 1e7; const int LIVESTREAM_BITRATE = 1e6; const int QCAM_BITRATE = 256000;