diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-03-03 10:17:18 -0600 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-03-03 10:20:33 -0600 |
commit | f5b68005829a795d757e9fd8c0386fbef9ae65d6 (patch) | |
tree | 2a16efb812f2f88b8973f4468db81e8f3b3d1e4d /movement | |
parent | a01ae5a232eeb9ea81ccc18a78595cd2f4ebbc2f (diff) | |
download | Sensor-Watch-f5b68005829a795d757e9fd8c0386fbef9ae65d6.tar.gz Sensor-Watch-f5b68005829a795d757e9fd8c0386fbef9ae65d6.tar.bz2 Sensor-Watch-f5b68005829a795d757e9fd8c0386fbef9ae65d6.zip |
movement: fix hang when using voltage face with temperature log
Diffstat (limited to 'movement')
-rw-r--r-- | movement/watch_faces/demo/voltage_face.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/movement/watch_faces/demo/voltage_face.c b/movement/watch_faces/demo/voltage_face.c index 24346aa3..147ec017 100644 --- a/movement/watch_faces/demo/voltage_face.c +++ b/movement/watch_faces/demo/voltage_face.c @@ -29,7 +29,11 @@ static void _voltage_face_update_display(void) { char buf[14]; + + watch_enable_adc(); float voltage = (float)watch_get_vcc_voltage() / 1000.0; + watch_disable_adc(); + sprintf(buf, "BA %4.2f V", voltage); // printf("%s\n", buf); watch_display_string(buf, 0); @@ -44,9 +48,6 @@ void voltage_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void voltage_face_activate(movement_settings_t *settings, void *context) { (void) settings; (void) context; - watch_enable_adc(); - // if we set the reference voltage here, watch_get_vcc_voltage won't do it over and over - watch_set_analog_reference_voltage(ADC_REFERENCE_INTREF); } bool voltage_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { @@ -85,7 +86,4 @@ bool voltage_face_loop(movement_event_t event, movement_settings_t *settings, vo void voltage_face_resign(movement_settings_t *settings, void *context) { (void) settings; (void) context; - // make sure to restore the default in the end. - watch_set_analog_reference_voltage(ADC_REFERENCE_VCC); - watch_disable_adc(); } |