diff options
| author | Selene ToyKeeper | 2024-03-27 07:13:26 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2024-03-27 07:13:26 -0600 |
| commit | 7b49797be1da97f54e9df3a1b0342ab20d7f02d5 (patch) | |
| tree | 1aab20b6979c781419fc61c8be73facf332ad8e2 /ui | |
| parent | fixed inaccurate comment (thanks to xikteny for spotting it) (diff) | |
| download | anduril-7b49797be1da97f54e9df3a1b0342ab20d7f02d5.tar.gz anduril-7b49797be1da97f54e9df3a1b0342ab20d7f02d5.tar.bz2 anduril-7b49797be1da97f54e9df3a1b0342ab20d7f02d5.zip | |
increased voltage precision from 0.025V to 0.02V
(so 0 to 255 now goes from 0.00V to 5.10V)
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/anduril/aux-leds.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/ui/anduril/aux-leds.c b/ui/anduril/aux-leds.c index fd184fc..7356666 100644 --- a/ui/anduril/aux-leds.c +++ b/ui/anduril/aux-leds.c @@ -58,27 +58,27 @@ void indicator_led_update(uint8_t mode, uint8_t tick) { uint8_t voltage_to_rgb() { static const uint8_t levels[] = { // voltage, color - 0, 0, // black + 0, 0, // black #ifdef DUAL_VOLTAGE_FLOOR // AA / NiMH voltages - 4* 9, 1, // R - 4*10, 2, // R+G - 4*11, 3, // G - 4*12, 4, // G+B - 4*13, 5, // B - 4*14, 6, // R + B - 4*16, 7, // R+G+B - 4*20, 0, // black + 9*dV, 1, // R + 10*dV, 2, // R+G + 11*dV, 3, // G + 12*dV, 4, // G+B + 13*dV, 5, // B + 14*dV, 6, // R + B + 16*dV, 7, // R+G+B + 20*dV, 0, // black #endif // li-ion voltages - 4*29, 1, // R - 4*33, 2, // R+G - 4*35, 3, // G - 4*37, 4, // G+B - 4*39, 5, // B - 4*41, 6, // R + B - 4*44, 7, // R+G+B // skip; looks too similar to G+B - 255, 7, // R+G+B + 29*dV, 1, // R + 33*dV, 2, // R+G + 35*dV, 3, // G + 37*dV, 4, // G+B + 39*dV, 5, // B + 41*dV, 6, // R + B + 44*dV, 7, // R+G+B // skip; looks too similar to G+B + 255, 7, // R+G+B }; uint8_t volts = voltage; //if (volts < VOLTAGE_LOW) return 0; @@ -151,11 +151,8 @@ void rgb_led_update(uint8_t mode, uint16_t arg) { else { // voltage // show actual voltage while asleep... if (go_to_standby) { - actual_color = voltage_to_rgb(); // choose a color based on battery voltage - //if (volts >= 38) actual_color = pgm_read_byte(colors + 4); - //else if (volts >= 33) actual_color = pgm_read_byte(colors + 2); - //else actual_color = pgm_read_byte(colors + 0); + actual_color = voltage_to_rgb(); } // ... but during preview, cycle colors quickly else { |
