watch_adc: enable ADC when checking battery; let's get rid of this footgun once and for all

This commit is contained in:
Joey Castillo
2025-05-21 08:51:39 -04:00
parent 07a085e90b
commit 310ad3d095
10 changed files with 10 additions and 17 deletions

View File

@@ -98,9 +98,7 @@ static void clock_check_battery_periodically(clock_state_t *state, watch_date_ti
state->last_battery_check = date_time.unit.day;
watch_enable_adc();
uint16_t voltage = watch_get_vcc_voltage();
watch_disable_adc();
state->battery_low = voltage < CLOCK_FACE_LOW_BATTERY_VOLTAGE_THRESHOLD;

View File

@@ -28,9 +28,7 @@
#include "watch.h"
static void _voltage_face_update_display(void) {
watch_enable_adc();
float voltage = (float)watch_get_vcc_voltage() / 1000.0;
watch_disable_adc();
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "BAT", "BA");
watch_display_float_with_best_effort(voltage, " V");