diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-09-18 17:34:30 -0500 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-09-18 17:34:30 -0500 |
commit | a92238b159be62f9ef9f58f617e6f91189efc121 (patch) | |
tree | 8d875729dc2394f043a43c1f5088cea3a577a791 | |
parent | e6784339e01ef38b0bc0c612670083b4f34a0218 (diff) | |
download | Sensor-Watch-a92238b159be62f9ef9f58f617e6f91189efc121.tar.gz Sensor-Watch-a92238b159be62f9ef9f58f617e6f91189efc121.tar.bz2 Sensor-Watch-a92238b159be62f9ef9f58f617e6f91189efc121.zip |
display temperature / battery voltage in sleep mode
-rw-r--r-- | movement/watch_faces/demo/voltage_face.c | 17 | ||||
-rw-r--r-- | movement/watch_faces/sensor/thermistor_readout_face.c | 10 |
2 files changed, 20 insertions, 7 deletions
diff --git a/movement/watch_faces/demo/voltage_face.c b/movement/watch_faces/demo/voltage_face.c index 2a568d2c..e5d7817e 100644 --- a/movement/watch_faces/demo/voltage_face.c +++ b/movement/watch_faces/demo/voltage_face.c @@ -27,15 +27,14 @@ #include "voltage_face.h" #include "watch.h" -static void _voltage_face_update_display(void) { +static void _voltage_face_update_display(bool show_units) { 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); + sprintf(buf, "BA %4.2f %c", voltage, show_units ? 'V' : ' '); watch_display_string(buf, 0); } @@ -48,6 +47,7 @@ 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; + if (watch_tick_animation_is_running()) watch_stop_tick_animation(); } bool voltage_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { @@ -62,20 +62,25 @@ bool voltage_face_loop(movement_event_t event, movement_settings_t *settings, vo movement_illuminate_led(); break; case EVENT_ACTIVATE: - _voltage_face_update_display(); + _voltage_face_update_display(true); break; case EVENT_TICK: date_time = watch_rtc_get_date_time(); if (date_time.unit.second % 5 == 4) { watch_set_indicator(WATCH_INDICATOR_SIGNAL); } else if (date_time.unit.second % 5 == 0) { - _voltage_face_update_display(); + _voltage_face_update_display(true); watch_clear_indicator(WATCH_INDICATOR_SIGNAL); } break; case EVENT_LOW_ENERGY_UPDATE: watch_clear_indicator(WATCH_INDICATOR_SIGNAL); - watch_display_string("BA SLEEP ", 0); + date_time = watch_rtc_get_date_time(); + // update the battery voltage once an hour + if (date_time.unit.minute == 0) { + _voltage_face_update_display(false); + } + if (!watch_tick_animation_is_running()) watch_start_tick_animation(1000); break; default: break; diff --git a/movement/watch_faces/sensor/thermistor_readout_face.c b/movement/watch_faces/sensor/thermistor_readout_face.c index 28106022..673f4948 100644 --- a/movement/watch_faces/sensor/thermistor_readout_face.c +++ b/movement/watch_faces/sensor/thermistor_readout_face.c @@ -50,6 +50,7 @@ void thermistor_readout_face_setup(movement_settings_t *settings, uint8_t watch_ void thermistor_readout_face_activate(movement_settings_t *settings, void *context) { (void) settings; (void) context; + if (watch_tick_animation_is_running()) watch_stop_tick_animation(); watch_display_string("TE", 0); } @@ -83,7 +84,14 @@ bool thermistor_readout_face_loop(movement_event_t event, movement_settings_t *s } break; case EVENT_LOW_ENERGY_UPDATE: - watch_display_string("TE SLEEP ", 0); + watch_clear_indicator(WATCH_INDICATOR_SIGNAL); + date_time = watch_rtc_get_date_time(); + // update the temperature every 15 minutes + if ((date_time.unit.minute % 15) == 0) { + _thermistor_readout_face_update_display(settings->bit.use_imperial_units); + watch_display_string(" ", 8); + } + if (!watch_tick_animation_is_running()) watch_start_tick_animation(1000); break; default: break; |