smartEQ: Restructure BMS metrics and adjust polling#1440
Merged
Conversation
Rework BMS voltage metric layout and related logic, and tune OBD/CAN polling. Changes include: - Reorganized xsq.bms.voltages vector to include: [0]=cell_min, [1]=cell_max, [2]=cell_mean, [3]=cell_sum (HV), [4]=contactor, [5]=traction link 12V, [6]=12v_bms_clamp30, [7]=ocv_12V and pre-allocate the new size. - Updated all code sites that read/write mt_bms_voltages (poll replies, ED4scan output, CalculateRangeSpeed, ticker checks) to use the new indices, and added OCV 12V reporting. - Improved 12V undervoltage detection by considering module, BMS clamp and USM 12V values and enhanced logging/messages. - Adjusted metric staleness for several metrics (traceability, production/ID strings, contactor cycles, trickle count) to SM_STALE_NONE where appropriate. - Added/centralized constants (VERSION bump to 2.2.0, PRESET_VERSION bump, DEFAULT_BATTERY_CAPACITY, MAX_POLL_DATA_LEN, CELLCOUNT, SQ_CANDATA_TIMEOUT) in header and removed duplicate defines. - Tuned many poll timing values across obdii/OBDIIEXTENDED PID tables to different intervals and removed the previous per-cell-interval modification logic (removed UI/config for cell_interval_drv/chg and simplified PID insertion). - Minor web UI cleanup: removed cell-interval fields from battery config form. These changes align metric layout, improve 12V handling, and refine polling cadence for reliability and consistency.
Replace 'ocv_12V'/"OCV 12V Voltage" wording with 'Open Circuit 12V' across docs, header comment, and notification output for consistency. Also adjust rqChargerAC poll entry in eq_poller.h changing the state value from 4 to 10 to modify the polling behavior.
Replace the string-based 12V undervolt history with a numeric vector and deque<float>, removing the previous timestamped string handling and persistent string restore. Update metrics initialisation (use a single OvmsMetricVector<float> for xsq.12v.undervolt.history.vec), adapt smart12VHistory to push raw volt values, trim to 10 entries, write the vector metric, and send a data log (XSQ-12V-undervoltagelog) including module, USM and BMS 12V readings. Adjusted header and ticker code to match the new metric types and behaviour.
Update TPMS polling timings and strengthen TPMS data initialization. - eq_poller.h: change TPMS OBD-II poll intervals for PIDs 0x74 and 0x79 (previously 293 -> now 152/154) to correct polling timing.
Send a data log notification when a new ADC factor is stored (XSQ-ADC-FactorLog V1: <new>,<prev>, TTL 30d) so changes are recorded externally.
Change TPMS parsing to only update pressure and temperature when raw values are valid (0xffff treated as invalid) to avoid overwriting prior readings with 0.0. Reduce smartChargeStart cooldown polling from 20 to 15. In Ticker60, disable further 12V ADC checks and ADC factor recalculation (clear m_check12vadc and m_enable_calcADCfactor) when the ADC recalculation timer expires to prevent repeated recalculations until next reboot.
Member
|
Merging, but I think you need to keep the two cell voltage block polls at the same cycle, as they will diverge over time, so the blocks deliver voltages of different load situations (e.g. part 1 during acceleration, part 2 during braking). |
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.
Rework BMS voltage metric layout and related logic, and tune OBD/CAN polling. Changes include:
These changes align metric layout, improve 12V handling, and refine polling cadence for reliability and consistency.