mirror of
https://github.com/joeycastillo/second-movement.git
synced 2025-10-29 11:38:27 +00:00
migrate temperature log to Second Movement
This commit is contained in:
parent
d9b5e209c8
commit
d05fdf2845
@ -28,6 +28,7 @@
|
||||
#include "movement_faces.h"
|
||||
|
||||
const watch_face_t watch_faces[] = {
|
||||
temperature_logging_face,
|
||||
clock_face,
|
||||
world_clock_face,
|
||||
sunrise_sunset_face,
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include "all_segments_face.h"
|
||||
#include "float_demo_face.h"
|
||||
#include "temperature_display_face.h"
|
||||
#include "temperature_logging_face.h"
|
||||
#include "voltage_face.h"
|
||||
#include "set_time_face.h"
|
||||
#include "preferences_face.h"
|
||||
|
||||
@ -10,6 +10,7 @@ SRCS += \
|
||||
./watch-faces/demo/character_set_face.c \
|
||||
./watch-faces/demo/float_demo_face.c \
|
||||
./watch-faces/sensor/temperature_display_face.c \
|
||||
./watch-faces/sensor/temperature_logging_face.c \
|
||||
./watch-faces/sensor/voltage_face.c \
|
||||
./watch-faces/settings/set_time_face.c \
|
||||
./watch-faces/settings/preferences_face.c \
|
||||
|
||||
@ -42,15 +42,20 @@ static void _temperature_logging_face_log_data(thermistor_logger_state_t *logger
|
||||
|
||||
static void _temperature_logging_face_update_display(thermistor_logger_state_t *logger_state, bool in_fahrenheit, bool clock_mode_24h) {
|
||||
int8_t pos = (logger_state->data_points - 1 - logger_state->display_index) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
|
||||
char buf[14];
|
||||
char buf[7];
|
||||
|
||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
watch_clear_colon();
|
||||
|
||||
if (pos < 0) {
|
||||
sprintf(buf, "TL%2dno dat", logger_state->display_index);
|
||||
// no data at this index
|
||||
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "LOG", "TL");
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, "no dat");
|
||||
sprintf(buf, "%2d", logger_state->display_index);
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
|
||||
} else if (logger_state->ts_ticks) {
|
||||
// we are displaying the timestamp in response to a button press
|
||||
watch_date_time_t date_time = logger_state->data[pos].timestamp;
|
||||
watch_set_colon();
|
||||
if (clock_mode_24h) {
|
||||
@ -60,16 +65,22 @@ static void _temperature_logging_face_update_display(thermistor_logger_state_t *
|
||||
date_time.unit.hour %= 12;
|
||||
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
||||
}
|
||||
sprintf(buf, "AT%2d%2d%02d%02d", date_time.unit.day, date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
||||
watch_display_text(WATCH_POSITION_TOP_LEFT, "AT");
|
||||
sprintf(buf, "%2d", date_time.unit.day);
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
|
||||
sprintf(buf, "%2d%02d%02d", date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, buf);
|
||||
} else {
|
||||
// we are displaying the temperature
|
||||
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "LOG", "TL");
|
||||
sprintf(buf, "%2d", logger_state->display_index);
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
|
||||
if (in_fahrenheit) {
|
||||
sprintf(buf, "TL%2d%4.1f#F", logger_state->display_index, logger_state->data[pos].temperature_c * 1.8 + 32.0);
|
||||
watch_display_float_with_best_effort(logger_state->data[pos].temperature_c * 1.8 + 32.0, "#F");
|
||||
} else {
|
||||
sprintf(buf, "TL%2d%4.1f#C", logger_state->display_index, logger_state->data[pos].temperature_c);
|
||||
watch_display_float_with_best_effort(logger_state->data[pos].temperature_c, "#C");
|
||||
}
|
||||
}
|
||||
|
||||
watch_display_string(buf, 0);
|
||||
}
|
||||
|
||||
void temperature_logging_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
Loading…
x
Reference in New Issue
Block a user