cell balancing fix for always on after unpowered#310
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request introduces a periodic refresh mechanism for the BMS discharge timeout during cell balancing. It defines update periods and refresh cycles, adds helper functions to set and refresh a short discharge timeout, and integrates this logic into the main BMS update loop. Additionally, it cleans up hardcoded timing values and adds a missing GPIO header include. The reviewer suggested optimizing the discharge timeout refresh function to write only Configuration Register Group B instead of both groups, which avoids redundant SPI bus traffic and transaction overhead.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| static void bms_refresh_discharge_timeout(void) | ||
| { | ||
| bms_set_short_discharge_timeout(); | ||
| bms_write_config(); | ||
| } |
There was a problem hiding this comment.
Writing both Configuration Register Group A and B is redundant here since only Config B (tx_cfgb) is modified by bms_set_short_discharge_timeout(). Writing Config A unnecessarily increases SPI bus traffic and transaction overhead. Consider writing only Config B directly using adBmsWriteData.
| static void bms_refresh_discharge_timeout(void) | |
| { | |
| bms_set_short_discharge_timeout(); | |
| bms_write_config(); | |
| } | |
| static void bms_refresh_discharge_timeout(void) | |
| { | |
| bms_set_short_discharge_timeout(); | |
| adBmsWakeupIc(TOTAL_IC); | |
| adBmsWriteData(TOTAL_IC, IC, WRCFGB, Config, B); | |
| } |
No description provided.