Skip to content

Normalize BMS -40C cell probe handling (ignore any 2)#93

Merged
zjwhitehead merged 3 commits intobms-cell-low-tempsfrom
copilot/update-temporary-sensor-ignore-logic
Feb 26, 2026
Merged

Normalize BMS -40C cell probe handling (ignore any 2)#93
zjwhitehead merged 3 commits intobms-cell-low-tempsfrom
copilot/update-temporary-sensor-ignore-logic

Conversation

Copy link

Copilot AI commented Feb 25, 2026

Summary

  • Implements the -40°C cell-probe rule as: ignore up to any 2 probes as disconnected, and treat additional -40°C probes as real temperatures.
  • Keeps existing low-temp alert channels (BMS_T1..T4) and adds no new alert types.

What Changed

  • Removed probe-index-specific handling and removed the optional sanitizer override.
  • Added shared 4-probe sanitization (sanitizeCellProbeTemps) that evaluates all probes together.
  • Policy is deterministic and simple: first two -40°C readings in T1->T4 order are treated as disconnected (NaN); 3rd/4th remain valid -40°C.
  • Updated BMS ingestion and probe transition logging to use the same sanitized values.
  • Updated LVGL to trust sanitized telemetry values (no extra re-sanitization pass).

Resulting Behavior

  • 0-2 probes at -40°C: those probes are ignored as disconnected.
  • 3 probes at -40°C: one -40°C is kept as valid and can trigger low-temp alerts.
  • 4 probes at -40°C: two -40°C values are kept as valid and can trigger low-temp alerts.

Tests

  • platformio test -e native-test -f test_simplemonitor
  • Result: 19/19 passing.
  • Added coverage for:
    • 0/1/2/3/4 -40°C probe combinations
    • mixed -39°C + -40°C
    • < -40°C invalid handling
    • transition behavior (2 -> 3 -> 2 disconnected sentinels)

Co-authored-by: zjwhitehead <4623792+zjwhitehead@users.noreply.github.com>
Copilot AI changed the title [WIP] Update logic to retain last two temperature probes at -40c Retain two BMS cell probes at -40°C while still filtering disconnected readings Feb 25, 2026
Introduce BMS_CELL_PROBE_COUNT and BMS_MAX_IGNORED_DISCONNECTED_PROBES and replace the single-value sanitizer with sanitizeCellProbeTemps(), which converts disconnected sentinel (-40°C) probes to NaN while ignoring up to two such sentinels before treating further -40°C readings as real temperatures. Update bms.cpp to produce and log using sanitized probe arrays and adjust LVGL code to assume probe values are pre-sanitized. Remove the old sanitizeBmsCellTempC overload that accepted a keep-disconnected flag and expand tests to cover the new multi-probe sanitization and alert transition behavior.
@zjwhitehead zjwhitehead marked this pull request as ready for review February 26, 2026 04:27
@zjwhitehead zjwhitehead changed the title Retain two BMS cell probes at -40°C while still filtering disconnected readings Normalize BMS -40C cell probe handling (ignore any 2) Feb 26, 2026
@zjwhitehead zjwhitehead merged commit 4cd0ae3 into bms-cell-low-temps Feb 26, 2026
7 checks passed
@zjwhitehead zjwhitehead deleted the copilot/update-temporary-sensor-ignore-logic branch February 26, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants