Skip to content

Commit

Permalink
Add device_battery_num_cells
Browse files Browse the repository at this point in the history
Currently in firmware we hard-code NUM_CELLS (usually to 1), and our code for calculating battery charge uses this variable in ways like "voltage = v / NUM_CELLS;"

If the battery voltage is one cell around our 4V normal, that works fine. 

However, as reported in meshtastic/firmware#5360 it's not uncommon for solar installs that have multiple batteries set up in a way that looks like 1 cell at 12V to our current code. So, battery charge % is always 100%.

Allowing num_cells as a configuration option will allow those users to specify how many batteries they have and receive accurate readings.
  • Loading branch information
fifieldt authored Dec 24, 2024
1 parent c55f120 commit 7c92a78
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions meshtastic/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ message Config {
*/
uint32 device_battery_ina_address = 9;

/*
* Number of battery cells in use. Battery charge is calculated using (v / num_cells).
*/
uint32 device_battery_num_cells = 10;

/*
* If non-zero, we want powermon log outputs. With the particular (bitfield) sources enabled.
* Note: we picked an ID of 32 so that lower more efficient IDs can be used for more frequently used options.
Expand Down

0 comments on commit 7c92a78

Please sign in to comment.