fix: rebuild stale CAN map on firmware upgrade (-S6) #8

Closed
bastian wants to merge 1 commits from fix/canmap-rebuild-on-upgrade into main
2 changed files with 16 additions and 4 deletions
Showing only changes of commit 1803f9b41d - Show all commits
+1 -1
View File
@@ -129,7 +129,7 @@
// SKUDAK customization suffix: bump on every Skudak-side change so the OpenInverter
// web UI shows a distinct version (e.g. "4=1.20.R-S4") and we can visually confirm
// the right firmware is flashed. Match the stm32-sine -S<N> convention.
#define VERSTR STRINGIFY(4=VER-S5)
#define VERSTR STRINGIFY(4=VER-S6)
/***** enums ******/
+15 -3
View File
@@ -114,10 +114,22 @@ static void MapChargerMessages()
float dummyGain;
bool dummyrx;
//check sample value, if it is mapped assume valid CAN map
if (canMap->FindMap(Param::hwaclim, dummyId, dummyOfs, dummyLen, dummyGain, dummyAdd, dummyrx)) return;
// SKUDAK: tmpobcmax is the canary for the -S5+ CAN-map schema. If it's
// already mapped, the persistent flash map was built by a firmware that
// included the full current set of mappings (including the OBC temp
// aggregate and all c1*/c2*/c3* receives) — return early so user
// customizations are preserved.
//
// If tmpobcmax is NOT mapped, the saved map is from an older firmware
// that didn't know about it. We must wipe and rebuild from current
// chargercan.cpp — without this the OpenInverter single-shot MapMessages()
// pattern silently leaves newer params un-mapped on every subsequent
// boot, even after flashing fresh firmware (the original guard keyed off
// hwaclim, which has existed since the very first version — so it always
// short-circuited on upgrade and the new entries were dead code).
if (canMap->FindMap(Param::tmpobcmax, dummyId, dummyOfs, dummyLen, dummyGain, dummyAdd, dummyrx)) return;
//canMap->Clear();
canMap->Clear();
ChargerCAN::MapMessages(canMap);