feat: receive ChargeLimit_pct from VCU on CAN 0x212 (SKUDAK-516) #4
Reference in New Issue
Block a user
Delete Branch "feat/skudak-516-receive-vcu-chargelimit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Pairs with stm32-hal-vcu PR #42. Adds a runtime
Param::vcuchglimthat the VCU broadcasts every 200 ms on CAN ID 0x212; on receipt, the param'sChange()callback translates 20-100% to the charger'sudcspnt(DC voltage setpoint).Without this, the teslacharger had no path for the user's app-set charge limit to actually cap charging —
udcspntwas effectively a compile-time setpoint that lived only in the OI web UI.What's added
include/param_prj.hPARAM_ENTRY(CAT_CHARGER, vcuchglim, "%", 20, 100, 80, 23)1.19.R → 1.20.R. Combined with the existing-S1suffix, the OI web UI shows4=1.20.R-S1. Verified in the built binary.src/chargercan.cppcan->AddRecv(Param::vcuchglim, 0x212, 0, 8, 1)inChargerCAN::MapMessages(). libopeninv's CanMap auto-dispatches toParam::Change()on each frame; no custom RX dispatcher needed.src/main.cppParam::Change()New
case Param::vcuchglimblock. Linear cell-voltage ramp:cell_target = 3.30 + (4.15 - 3.30) * (pct - 20) / 80udcspnt = cell_target * 96Endpoints (Tesla LDU / VW MEB / Volt2 compatible):
udclimdefault)Tuneable via the
CELL_LOW_V/CELL_HIGH_V/CELL_COUNTconstants if a specific pack chemistry needs a tighter range.Build
Links clean. Pre-existing pedantic warning on
extern "C" int mainis unchanged. Version string in the binary verified as4=1.20.R-S1.Test plan
After both PRs flashed (this + VCU PR #42):
4=1.20.R-S1andvcuchglimparameter presentvcuchglimupdating in OI web UI within 200 msudcspntupdating in lockstep withvcuchglim(verifies the Change() handler fires and the math is right)vcuchglimre-set by VCU's next periodic frame (steady-broadcast verification)🤖 Generated with Claude Code
307853bea8to7acbd66907