Normalize BMS -40C cell probe handling (ignore any 2)#93
Merged
zjwhitehead merged 3 commits intobms-cell-low-tempsfrom Feb 26, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-40°Ccell-probe rule as: ignore up to any 2 probes as disconnected, and treat additional-40°Cprobes as real temperatures.BMS_T1..T4) and adds no new alert types.What Changed
sanitizeCellProbeTemps) that evaluates all probes together.-40°Creadings in T1->T4 order are treated as disconnected (NaN); 3rd/4th remain valid-40°C.Resulting Behavior
-40°C: those probes are ignored as disconnected.-40°C: one-40°Cis kept as valid and can trigger low-temp alerts.-40°C: two-40°Cvalues are kept as valid and can trigger low-temp alerts.Tests
platformio test -e native-test -f test_simplemonitor-40°Cprobe combinations-39°C+-40°C< -40°Cinvalid handling2 -> 3 -> 2disconnected sentinels)