Controls - Quality of Life - Reverse Cruise Increase

Reverses the 'long press' functionality logic to increase the max set speed by 5 instead of 1. Useful to increase the max speed quickly.
This commit is contained in:
FrogAi 2024-05-12 02:28:18 -07:00
parent d5f73e5117
commit bee2a5524c
5 changed files with 21 additions and 1 deletions

View File

@ -43,7 +43,7 @@ def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead, acc_ty
"PERMIT_BRAKING": 1,
"RELEASE_STANDSTILL": not standstill_req,
"CANCEL_REQ": pcm_cancel,
"ALLOW_LONG_PRESS": 1,
"ALLOW_LONG_PRESS": 2 if frogpilot_variables.reverse_cruise_increase else 1,
"ACC_CUT_IN": fcw_alert, # only shown when ACC enabled
}
return packer.make_can_msg("ACC_CONTROL", 0, values)

View File

@ -101,6 +101,17 @@ void OnroadWindow::updateState(const UIState &s) {
void OnroadWindow::mousePressEvent(QMouseEvent* e) {
// FrogPilot clickable widgets
QRect maxSpeedRect(7, 25, 225, 225);
bool isMaxSpeedClicked = maxSpeedRect.contains(e->pos()) && scene.reverse_cruise_ui;
if (isMaxSpeedClicked) {
bool currentReverseCruise = scene.reverse_cruise;
uiState()->scene.reverse_cruise = !currentReverseCruise;
params.putBoolNonBlocking("ReverseCruise", !currentReverseCruise);
updateFrogPilotToggles();
return;
}
if (scene.experimental_mode_via_screen && e->pos() != timeoutPoint) {
if (clickTimer.isActive()) {
clickTimer.stop();
@ -414,6 +425,8 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
), 10));
} else if (trafficModeActive) {
p.setPen(QPen(redColor(), 10));
} else if (scene.reverse_cruise) {
p.setPen(QPen(blueColor(), 6));
} else {
p.setPen(QPen(whiteColor(75), 6));
}

View File

@ -166,6 +166,7 @@ private:
QString leadDistanceUnit;
QString leadSpeedUnit;
inline QColor blueColor(int alpha = 255) { return QColor(0, 150, 255, alpha); }
inline QColor greenColor(int alpha = 242) { return QColor(23, 134, 68, alpha); }
protected:

View File

@ -288,6 +288,10 @@ void ui_update_frogpilot_params(UIState *s) {
bool longitudinal_tune = scene.longitudinal_control && params.getBool("LongitudinalTune");
bool radarless_model = params.get("Model") == "radical-turtle";
scene.lead_detection_threshold = longitudinal_tune && !radarless_model ? params.getInt("LeadDetectionThreshold") / 100.0f : 0.5;
bool quality_of_life_controls = params.getBool("QOLControls");
scene.reverse_cruise = quality_of_life_controls && params.getBool("ReverseCruise");
scene.reverse_cruise_ui = params.getBool("ReverseCruiseUI");
}
void UIState::updateStatus() {

View File

@ -196,6 +196,8 @@ typedef struct UIScene {
bool online;
bool onroad_distance_button;
bool parked;
bool reverse_cruise;
bool reverse_cruise_ui;
bool right_hand_drive;
bool show_aol_status_bar;
bool show_cem_status_bar;