felicity: derive real cell_count and filter 0x7FFF temp sentinel - #484
Merged
mr-manuel merged 1 commit intoJul 29, 2026
Merged
Conversation
- read_gen_data: count populated cell voltage slots instead of hardcoding cell_count to 16, so packs wired with fewer than 16 cells don't get bogus ~32.767V ghost cells. - read_temperature_data: map the 0x7FFF sentinel to None for temperature_1/2/3 so unpopulated sensor slots are excluded from get_temperature() averaging instead of blowing up the reported pack temperature. - fix stale register comment on command_bms_temperature_1_3 (4929-4931 -> 4921-4925, matches the actual command bytes).
Owner
|
Thanks for contributing |
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.
Found these running a Felicity FLA-series pack over RS485 on a Venus OS
Cerbo GX. Three issues in bms/felicity.py:
cell_count is hardcoded to 16 (read_gen_data). My pack is wired as an
8S battery; register 4906 still returns 16 cell voltage slots, but the
8 unused ones read back 0x7FFF. With cell_count fixed at 16, the driver
builds 16 Cell objects and cells 8-15 carry a bogus ~32.767V reading
forever, which breaks pack voltage/balancing display on this hardware.
Fixed by reading the cell voltage block once at startup and counting
only slots that aren't 0x7FFF.
Temperature sentinel not filtered. read_temperature_data() assigns
self.temperature_1/2/3 straight from the raw register read. My unit
only populates 2 of the 3 slots; the third reads 0x7FFF (32767 as a
signed int16). battery.py's get_filtered_temperature_map() only drops
None values, so this sentinel isn't excluded and gets averaged into
get_temperature() along with the real sensors, pushing the reported
pack temperature into the thousands of degrees. Fixed by mapping the
sentinel to None before assignment, matching how the base class
already expects "no sensor" to be represented.
Minor: the comment on command_bms_temperature_1_3 says register
4929-4931. The command bytes (\x13\x39\x00\x05) decode to register
4921, not 4929 - confirmed against the live unit. Fixed the comment to
avoid sending anyone chasing the wrong register number if they ever
need to touch this.
All three confirmed against a live Felicity pack, not just from reading
the code. Patch is against current master.