Skip to content

skip battery percentage calculation to avoid integer overflow#29

Merged
lanrat merged 1 commit intolanrat:mainfrom
elratt0r:batt_percent_overflow_fix
May 22, 2023
Merged

skip battery percentage calculation to avoid integer overflow#29
lanrat merged 1 commit intolanrat:mainfrom
elratt0r:batt_percent_overflow_fix

Conversation

@elratt0r
Copy link
Copy Markdown
Contributor

When readout voltage is below BATTERY_VOLTAGE_LOW (for example 3.37V < 3.4V), then an integer overflow
occurs in the calculation of uint percentage, leading to return 100%.

@lanrat
Copy link
Copy Markdown
Owner

lanrat commented May 22, 2023

Good find!

Thanks for the fix.

@lanrat lanrat merged commit 02db17d into lanrat:main May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants