feat: feat add battery registers and read - #1
Open
seixasxbr wants to merge 1 commit into
Open
Conversation
feat: initial driver implementation feat: add battery readings feat: add executables feat: add battery alarms and move register to a file feat: add alarm register for battery feat: improve namming doc: add units fix: use base types chore: format documentation chore: format documentation feat: add diagnostics feat: improve fields chore: add balance and mode' chore: improve ve bus naming and remove some fields feat: add energy counter fix: remove methods split pr fix: use registers fix: keep only battery registers move to batteryregisters feat: add battery test' remove unecessary static casts doc
Collaborator
Author
|
/gemini review |
jhonasiv
reviewed
Jul 8, 2026
| BatteryData data; | ||
| uint32_t alarms_val = 0; | ||
| for (const auto& ar : BatteryData::alarm_register) { | ||
| if (readSingleRegister(m_address, true, ar.register_id) == 2) { |
There was a problem hiding this comment.
Can you turn this "2" into an enum or a constant? Its very confusing what that should mean.
Comment on lines
+148
to
+152
| { | ||
| auto regs = | ||
| readRegisters(m_address, true, BatteryRegisters::CONSUMED_AMPHOURS_2, 2); | ||
| data.consumed_amphours_1 = (static_cast<uint32_t>(regs[0]) << 16) | regs[1]; | ||
| } |
There was a problem hiding this comment.
I dont see why you need the scope here
Collaborator
Author
There was a problem hiding this comment.
Just to keep regs variable local to this scope, since it is used multiple times in this higher level scope
Comment on lines
+184
to
+185
| // TODO: | ||
| // data.connection_information = ""; |
Comment on lines
+28
to
+31
| { | ||
| auto regs = readRegisters(m_address, true, BatteryRegisters::BATTERY_POWER, 2); | ||
| data.battery_power = (static_cast<uint32_t>(regs[0]) << 16) | regs[1]; | ||
| } |
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.
What is this PR for
feat: add battery registers and read
Checklist