fix(mcu): MCU-A1 — replace 25 C cooling stub with 70/60 C hysteresis

Cooling-fan trip in main.cpp's periodic temperature block was a 25 C dev
stub that latched the fan ON at room temperature on every boot. Replaced
with production thermal control: ON at 70 C, OFF at 60 C. The 10 C
dead-band prevents relay/fan chatter near the threshold; the 70 C ON
point sits below the 75 C SAFE-mode gate in checkSystemHealth() so the
fan engages before the system shuts down.

Driven from the existing `temperature` global (max of 8 sensors,
populated just above by the GAP-3 fix) instead of re-OR'ing the eight
Temperature_N variables — single source of truth, and the diag now
prints the actual peak temperature on each transition.

Added test_mcu_a1_cooling_hysteresis (9 cases) covering cold-start,
upward crossing, dead-band hold, downward crossing, and a regression
guard at 30 C that would have engaged the fan under the old stub.
MCU regression now 77/77.
This commit is contained in:
Jason
2026-04-27 19:42:42 +05:45
parent 0b8b933e27
commit df0b2fd469
3 changed files with 116 additions and 8 deletions
@@ -66,6 +66,7 @@ TESTS_MOCK_ONLY := test_bug2_ad9523_double_setup \
TESTS_STANDALONE := test_bug12_pa_cal_loop_inverted \
test_bug13_dac2_adc_buffer_mismatch \
test_bug16_runradar_shadows_globals \
test_mcu_a1_cooling_hysteresis \
test_gap3_iwdg_config \
test_gap3_temperature_max \
test_gap3_idq_periodic_reread \
@@ -159,6 +160,9 @@ test_bug13_dac2_adc_buffer_mismatch: test_bug13_dac2_adc_buffer_mismatch.c
test_bug16_runradar_shadows_globals: test_bug16_runradar_shadows_globals.c
$(CC) $(CFLAGS) $< -o $@
test_mcu_a1_cooling_hysteresis: test_mcu_a1_cooling_hysteresis.c
$(CC) $(CFLAGS) $< -o $@
# Gap-3 safety tests -- mock-only (needs spy log for GPIO sequence)
test_gap3_emergency_stop_rails: test_gap3_emergency_stop_rails.c $(MOCK_OBJS)
$(CC) $(CFLAGS) $(INCLUDES) $< $(MOCK_OBJS) -o $@