subaru: fix subaru_avh_count MISRA width and Legacy 2025 startup dash test assertions

This commit is contained in:
Frogger900
2026-11-21 17:11:53 -05:00
parent cb3ebdd09e
commit d91e913953
3 changed files with 15 additions and 3 deletions
@@ -7,7 +7,7 @@ static bool subaru_avh_seen[7];
static bool subaru_avh_seq[7];
static bool subaru_avh_enabled;
static bool subaru_avh_done;
static unsigned int subaru_avh_count;
static uint8_t subaru_avh_count;
static uint32_t subaru_avh_start;
static uint32_t subaru_avh_sent;
static uint32_t subaru_avh_template_ts;
@@ -192,7 +192,13 @@ def test_actual_startup_factory_card_controls_native(enabled, combined, aol, sub
expected = ci.CC.angle_was_active if steering_name == 'ES_LKAS_ANGLE' else card.sm['carControl'].latActive
if candidate == 'SUBARU_LEGACY_2025':
assert bool(dash['LKAS_ACTIVE']), (candidate, tick, expected, dash)
assert dash['LKAS_Dash_State'] == (2 if expected else (1 if cs.cruiseState.available else 0)), (candidate, tick, expected, dash)
if not cs.cruiseState.available or cs.steerFaultTemporary or cs.steerFaultPermanent:
assert not ci.CC.aol_dash_green_last, (candidate, tick, dash)
if expected:
assert ci.CC.aol_dash_green_last, (candidate, tick, dash)
ready_wheel = cs.cruiseState.available and bool(getattr(ci.CS, 'aol_enabled', True))
expected_dash = 2 if ci.CC.aol_dash_green_last else (1 if ready_wheel else 0)
assert dash['LKAS_Dash_State'] == expected_dash, (candidate, tick, expected, expected_dash, dash)
else:
assert bool(dash['LKAS_ACTIVE']) == expected, (candidate, tick, expected, dash)
assert dash['LKAS_Dash_State'] == (2 if expected else 0), (candidate, tick, expected, dash)
@@ -177,7 +177,13 @@ def test_actual_startup_factory_card_controls_native(enabled, manual, aol, subar
expected = ci.CC.angle_was_active if steering_name == 'ES_LKAS_ANGLE' else card.sm['carControl'].latActive
if candidate == 'SUBARU_LEGACY_2025':
assert bool(dash['LKAS_ACTIVE']), (candidate, tick, expected, dash)
assert dash['LKAS_Dash_State'] == (2 if expected else (1 if cs.cruiseState.available else 0)), (candidate, tick, expected, dash)
if not cs.cruiseState.available or cs.steerFaultTemporary or cs.steerFaultPermanent:
assert not ci.CC.aol_dash_green_last, (candidate, tick, dash)
if expected:
assert ci.CC.aol_dash_green_last, (candidate, tick, dash)
ready_wheel = cs.cruiseState.available and bool(getattr(ci.CS, 'aol_enabled', True))
expected_dash = 2 if ci.CC.aol_dash_green_last else (1 if ready_wheel else 0)
assert dash['LKAS_Dash_State'] == expected_dash, (candidate, tick, expected, expected_dash, dash)
else:
assert bool(dash['LKAS_ACTIVE']) == expected, (candidate, tick, expected, dash)
assert dash['LKAS_Dash_State'] == (2 if expected else 0), (candidate, tick, expected, dash)