migrate temperature display to Second Movement
This commit is contained in:
parent
1e633f87b0
commit
d9b5e209c8
2
Makefile
2
Makefile
@ -34,6 +34,7 @@ INCLUDES += \
|
|||||||
-I./shell \
|
-I./shell \
|
||||||
-I./movement/lib/sunriset \
|
-I./movement/lib/sunriset \
|
||||||
-I./watch-library/shared/watch \
|
-I./watch-library/shared/watch \
|
||||||
|
-I./watch-library/shared/driver \
|
||||||
-I./watch-faces/clock \
|
-I./watch-faces/clock \
|
||||||
-I./watch-faces/complication \
|
-I./watch-faces/complication \
|
||||||
-I./watch-faces/demo \
|
-I./watch-faces/demo \
|
||||||
@ -50,6 +51,7 @@ SRCS += \
|
|||||||
./shell/shell.c \
|
./shell/shell.c \
|
||||||
./shell/shell_cmd_list.c \
|
./shell/shell_cmd_list.c \
|
||||||
./movement/lib/sunriset/sunriset.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_buzzer.c \
|
||||||
./watch-library/shared/watch/watch_common_display.c \
|
./watch-library/shared/watch/watch_common_display.c \
|
||||||
./watch-library/shared/watch/watch_utility.c \
|
./watch-library/shared/watch/watch_utility.c \
|
||||||
|
|||||||
2
gossamer
2
gossamer
@ -1 +1 @@
|
|||||||
Subproject commit 7146786f84898dfc465b6d5e1479a9bc52ebe8fd
|
Subproject commit 8b401da83a76df49012f2f093b96f8ed66773d5e
|
||||||
@ -34,6 +34,7 @@
|
|||||||
#include "character_set_face.h"
|
#include "character_set_face.h"
|
||||||
#include "all_segments_face.h"
|
#include "all_segments_face.h"
|
||||||
#include "float_demo_face.h"
|
#include "float_demo_face.h"
|
||||||
|
#include "temperature_display_face.h"
|
||||||
#include "voltage_face.h"
|
#include "voltage_face.h"
|
||||||
#include "set_time_face.h"
|
#include "set_time_face.h"
|
||||||
#include "preferences_face.h"
|
#include "preferences_face.h"
|
||||||
|
|||||||
@ -9,6 +9,7 @@ SRCS += \
|
|||||||
./watch-faces/demo/all_segments_face.c \
|
./watch-faces/demo/all_segments_face.c \
|
||||||
./watch-faces/demo/character_set_face.c \
|
./watch-faces/demo/character_set_face.c \
|
||||||
./watch-faces/demo/float_demo_face.c \
|
./watch-faces/demo/float_demo_face.c \
|
||||||
|
./watch-faces/sensor/temperature_display_face.c \
|
||||||
./watch-faces/sensor/voltage_face.c \
|
./watch-faces/sensor/voltage_face.c \
|
||||||
./watch-faces/settings/set_time_face.c \
|
./watch-faces/settings/set_time_face.c \
|
||||||
./watch-faces/settings/preferences_face.c \
|
./watch-faces/settings/preferences_face.c \
|
||||||
|
|||||||
@ -31,13 +31,11 @@
|
|||||||
static void _temperature_display_face_update_display(bool in_fahrenheit) {
|
static void _temperature_display_face_update_display(bool in_fahrenheit) {
|
||||||
thermistor_driver_enable();
|
thermistor_driver_enable();
|
||||||
float temperature_c = thermistor_driver_get_temperature();
|
float temperature_c = thermistor_driver_get_temperature();
|
||||||
char buf[14];
|
|
||||||
if (in_fahrenheit) {
|
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 {
|
} 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();
|
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 temperature_display_face_activate(void *context) {
|
||||||
(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) {
|
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:
|
case EVENT_LOW_ENERGY_UPDATE:
|
||||||
// clear seconds area and start tick animation if necessary
|
// clear seconds area and start tick animation if necessary
|
||||||
if (!watch_sleep_animation_is_running()) {
|
if (!watch_sleep_animation_is_running()) {
|
||||||
watch_display_string(" ", 8);
|
|
||||||
watch_start_sleep_animation(1000);
|
watch_start_sleep_animation(1000);
|
||||||
}
|
}
|
||||||
// update every 5 minutes
|
// update every 5 minutes
|
||||||
if (date_time.unit.minute % 5 == 0) {
|
if (date_time.unit.minute % 5 == 0) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
||||||
_temperature_display_face_update_display(movement_use_imperial_units());
|
_temperature_display_face_update_display(movement_use_imperial_units());
|
||||||
watch_display_string(" ", 8);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "thermistor_driver.h"
|
#include "thermistor_driver.h"
|
||||||
|
#include "sam.h"
|
||||||
#include "watch.h"
|
#include "watch.h"
|
||||||
#include "watch_utility.h"
|
#include "watch_utility.h"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user