aol: keep lateral active when braking disengages longitudinal on full OP

On rising edge of SET engagement, auto-enable AOL so lateral persists
after braking disengages longitudinal. Simplify safety.h aol_allowed
to not require acc_main_on or lkas_on.
This commit is contained in:
whoisdomi
2026-04-14 10:59:51 -05:00
parent 5122444610
commit b51df99f27
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -374,7 +374,7 @@ static void generic_rx_checks(void) {
}
steering_disengage_prev = steering_disengage;
aol_allowed = (acc_main_on || lkas_on) && (alternative_experience & ALT_EXP_ALWAYS_ON_LATERAL);
aol_allowed = (alternative_experience & ALT_EXP_ALWAYS_ON_LATERAL) != 0U;
}
static void stock_ecu_check(bool stock_ecu_detected) {
+8
View File
@@ -17,6 +17,7 @@ class StarPilotCard:
self.accel_pressed = False
self.always_on_lateral_allowed = False
self.prev_active = False
self.decel_pressed = False
self.distancePressed_previously = False
self.force_coast = False
@@ -78,6 +79,13 @@ class StarPilotCard:
elif starpilot_toggles.always_on_lateral_main:
self.always_on_lateral_allowed = carState.cruiseState.available
# On rising edge of engagement (SET press enabling lat+long), auto-enable AOL
# so that lateral persists when braking disengages longitudinal
if sm["selfdriveState"].active and not self.prev_active and self.always_on_lateral_set and starpilot_toggles.always_on_lateral_lkas:
self.always_on_lateral_allowed = True
self.prev_active = sm["selfdriveState"].active
self.always_on_lateral_enabled = self.always_on_lateral_allowed and self.always_on_lateral_set
self.always_on_lateral_enabled &= carState.gearShifter not in NON_DRIVING_GEARS
self.always_on_lateral_enabled &= sm["starpilotPlan"].lateralCheck