diff --git a/Makefile b/Makefile index e42cb28c..693341a1 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ INCLUDES += \ -I./shell \ -I./movement/lib/sunriset \ -I./watch-library/shared/watch \ + -I./watch-library/shared/driver \ -I./watch-faces/clock \ -I./watch-faces/complication \ -I./watch-faces/demo \ @@ -50,6 +51,7 @@ SRCS += \ ./shell/shell.c \ ./shell/shell_cmd_list.c \ ./movement/lib/sunriset/sunriset.c \ + ./watch-library/shared/driver/thermistor_driver.c \ ./watch-library/shared/watch/watch_common_buzzer.c \ ./watch-library/shared/watch/watch_common_display.c \ ./watch-library/shared/watch/watch_utility.c \ diff --git a/gossamer b/gossamer index 7146786f..8b401da8 160000 --- a/gossamer +++ b/gossamer @@ -1 +1 @@ -Subproject commit 7146786f84898dfc465b6d5e1479a9bc52ebe8fd +Subproject commit 8b401da83a76df49012f2f093b96f8ed66773d5e diff --git a/movement_faces.h b/movement_faces.h index 45fab9dc..a9226e97 100644 --- a/movement_faces.h +++ b/movement_faces.h @@ -34,6 +34,7 @@ #include "character_set_face.h" #include "all_segments_face.h" #include "float_demo_face.h" +#include "temperature_display_face.h" #include "voltage_face.h" #include "set_time_face.h" #include "preferences_face.h" diff --git a/watch-faces.mk b/watch-faces.mk index baaf6bc6..608e82ba 100644 --- a/watch-faces.mk +++ b/watch-faces.mk @@ -9,6 +9,7 @@ SRCS += \ ./watch-faces/demo/all_segments_face.c \ ./watch-faces/demo/character_set_face.c \ ./watch-faces/demo/float_demo_face.c \ + ./watch-faces/sensor/temperature_display_face.c \ ./watch-faces/sensor/voltage_face.c \ ./watch-faces/settings/set_time_face.c \ ./watch-faces/settings/preferences_face.c \ diff --git a/movement/watch_faces/sensor/temperature_display_face.c b/watch-faces/sensor/temperature_display_face.c similarity index 92% rename from movement/watch_faces/sensor/temperature_display_face.c rename to watch-faces/sensor/temperature_display_face.c index 3c81df9e..9ba21d14 100644 --- a/movement/watch_faces/sensor/temperature_display_face.c +++ b/watch-faces/sensor/temperature_display_face.c @@ -31,13 +31,11 @@ static void _temperature_display_face_update_display(bool in_fahrenheit) { thermistor_driver_enable(); float temperature_c = thermistor_driver_get_temperature(); - char buf[14]; if (in_fahrenheit) { - sprintf(buf, "%4.1f#F", temperature_c * 1.8 + 32.0); + watch_display_float_with_best_effort(temperature_c * 1.8 + 32.0, "#F"); } else { - sprintf(buf, "%4.1f#C", temperature_c); + watch_display_float_with_best_effort(temperature_c, "#C"); } - watch_display_string(buf, 4); thermistor_driver_disable(); } @@ -48,7 +46,7 @@ void temperature_display_face_setup(uint8_t watch_face_index, void ** context_pt void temperature_display_face_activate(void *context) { (void) context; - watch_display_string("TE", 0); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "TEMP", "TE"); } bool temperature_display_face_loop(movement_event_t event, void *context) { @@ -77,14 +75,12 @@ bool temperature_display_face_loop(movement_event_t event, void *context) { case EVENT_LOW_ENERGY_UPDATE: // clear seconds area and start tick animation if necessary if (!watch_sleep_animation_is_running()) { - watch_display_string(" ", 8); watch_start_sleep_animation(1000); } // update every 5 minutes if (date_time.unit.minute % 5 == 0) { watch_clear_indicator(WATCH_INDICATOR_SIGNAL); _temperature_display_face_update_display(movement_use_imperial_units()); - watch_display_string(" ", 8); } break; default: diff --git a/movement/watch_faces/sensor/temperature_display_face.h b/watch-faces/sensor/temperature_display_face.h similarity index 100% rename from movement/watch_faces/sensor/temperature_display_face.h rename to watch-faces/sensor/temperature_display_face.h diff --git a/watch-library/shared/driver/thermistor_driver.c b/watch-library/shared/driver/thermistor_driver.c index d9f1ae0f..661f6f14 100644 --- a/watch-library/shared/driver/thermistor_driver.c +++ b/watch-library/shared/driver/thermistor_driver.c @@ -23,6 +23,7 @@ */ #include "thermistor_driver.h" +#include "sam.h" #include "watch.h" #include "watch_utility.h"