Skip to content

hw: lumintop: fw3x-lume1: Fix voltage measurement - #181

Closed
stcarlso wants to merge 1 commit into
ToyKeeper:trunkfrom
stcarlso:fw3x-voltage
Closed

stcarlso wants to merge 1 commit into
ToyKeeper:trunkfrom
stcarlso:fw3x-voltage

Conversation

@stcarlso

Copy link
Copy Markdown

The 16-bit voltage measurement readout was truncated due to an incorrect cast to uint8_t. Avoid arithmetic overflow.

Tested on FW3X-lume1 hardware to correctly blink out the voltage; before, it would blink out nonsense numbers like 0.02 V.

The 16-bit voltage measurement readout was truncated due to an incorrect cast to uint8_t. Avoid arithmetic overflow.
@ToyKeeper

Copy link
Copy Markdown
Owner

Of course... the one I didn't test is broken. :D

Will have to see if I can find the adapter I used years ago to flash a fw3x. I didn't test because the flashing pins are swapped and I apparently misplaced the one adapter I had with remappable pins. But it's got to be around here somewhere...

@ToyKeeper

Copy link
Copy Markdown
Owner

Fixed in 026624c.

Thanks for finding this, testing it, and making a one-liner patch to fix it. I fixed it in a different way though, removing the broken code entirely so it can use the new voltage system.

I only have one FW3X to test it on, so I'm not sure how much hardware varies from one unit to another, but the calibration I used gives me results which are within 0.005V of the actual value. Hopefully others will be pretty close too.

@ToyKeeper ToyKeeper closed this Sep 20, 2026
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