ToyKeeper / anduril

Anduril 2 Flashlight Firmware and FSM UI Toolkit
GNU General Public License v3.0
246 stars 62 forks source link

Bug: Voltage readout sometimes mixes digits #91

Open jan-Sanku opened 3 months ago

jan-Sanku commented 3 months ago

when the voltage is on the very edge of a 0.1V step (say, 4.200V), the readout sometimes mixes 0.1 and 0.02 digits from separate sensor readings. (at least that's what i think is happening)

expected result at 4.200V: 4.20, 4.22 or 4.18 (may vary between separate readouts)

actual result is any of: 4.20, 4.22, 4.28, 4.10, 4.12, 4.18

so far, tested on versions 0273-2024-04-20, 0125-2024-04-20 and 0135-2024-04-20

SammysHP commented 3 months ago

Confirmed. And I thought it was just my imagination...

But it's a pretty easy fix. For the second decimal place blink_num() is called a second time in fsm/adc.c. Between the two calls voltage got updated by the ADC interrupt handler. The solution is to either cache voltage or pass all digits at once to blink_num().

I will fix it today evening (UTC+2).

jan-Sanku commented 3 months ago

cool, thanks!