From b4730da36b3f9b726f3c13f1f7feb0c8edc3ac86 Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Wed, 21 May 2025 01:12:20 -0400 Subject: [PATCH] temperature logger: rename stuff to remove thermistor references --- watch-faces/sensor/temperature_logging_face.c | 18 +++++++++--------- watch-faces/sensor/temperature_logging_face.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/watch-faces/sensor/temperature_logging_face.c b/watch-faces/sensor/temperature_logging_face.c index 68c7365b..2016d94a 100644 --- a/watch-faces/sensor/temperature_logging_face.c +++ b/watch-faces/sensor/temperature_logging_face.c @@ -27,17 +27,17 @@ #include "temperature_logging_face.h" #include "watch.h" -static void _temperature_logging_face_log_data(thermistor_logger_state_t *logger_state) { +static void _temperature_logging_face_log_data(temperature_logging_state_t *logger_state) { watch_date_time_t date_time = watch_rtc_get_date_time(); - size_t pos = logger_state->data_points % THERMISTOR_LOGGING_NUM_DATA_POINTS; + size_t pos = logger_state->data_points % TEMPERATURE_LOGGING_NUM_DATA_POINTS; logger_state->data[pos].timestamp.reg = date_time.reg; logger_state->data[pos].temperature_c = movement_get_temperature(); logger_state->data_points++; } -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; +static void _temperature_logging_face_update_display(temperature_logging_state_t *logger_state, bool in_fahrenheit, bool clock_mode_24h) { + int8_t pos = (logger_state->data_points - 1 - logger_state->display_index) % TEMPERATURE_LOGGING_NUM_DATA_POINTS; char buf[7]; watch_clear_indicator(WATCH_INDICATOR_24H); @@ -82,19 +82,19 @@ static void _temperature_logging_face_update_display(thermistor_logger_state_t * void temperature_logging_face_setup(uint8_t watch_face_index, void ** context_ptr) { (void) watch_face_index; if (*context_ptr == NULL) { - *context_ptr = malloc(sizeof(thermistor_logger_state_t)); - memset(*context_ptr, 0, sizeof(thermistor_logger_state_t)); + *context_ptr = malloc(sizeof(temperature_logging_state_t)); + memset(*context_ptr, 0, sizeof(temperature_logging_state_t)); } } void temperature_logging_face_activate(void *context) { - thermistor_logger_state_t *logger_state = (thermistor_logger_state_t *)context; + temperature_logging_state_t *logger_state = (temperature_logging_state_t *)context; logger_state->display_index = 0; logger_state->ts_ticks = 0; } bool temperature_logging_face_loop(movement_event_t event, void *context) { - thermistor_logger_state_t *logger_state = (thermistor_logger_state_t *)context; + temperature_logging_state_t *logger_state = (temperature_logging_state_t *)context; switch (event.event_type) { case EVENT_TIMEOUT: movement_move_to_face(0); @@ -108,7 +108,7 @@ bool temperature_logging_face_loop(movement_event_t event, void *context) { _temperature_logging_face_update_display(logger_state, movement_use_imperial_units(), movement_clock_mode_24h()); break; case EVENT_ALARM_BUTTON_DOWN: - logger_state->display_index = (logger_state->display_index + 1) % THERMISTOR_LOGGING_NUM_DATA_POINTS; + logger_state->display_index = (logger_state->display_index + 1) % TEMPERATURE_LOGGING_NUM_DATA_POINTS; logger_state->ts_ticks = 0; // fall through case EVENT_ACTIVATE: diff --git a/watch-faces/sensor/temperature_logging_face.h b/watch-faces/sensor/temperature_logging_face.h index 1c4f88f1..9fd3f032 100644 --- a/watch-faces/sensor/temperature_logging_face.h +++ b/watch-faces/sensor/temperature_logging_face.h @@ -57,7 +57,7 @@ #include "movement.h" #include "watch.h" -#define THERMISTOR_LOGGING_NUM_DATA_POINTS (36) +#define TEMPERATURE_LOGGING_NUM_DATA_POINTS (36) typedef struct { watch_date_time_t timestamp; @@ -68,8 +68,8 @@ typedef struct { uint8_t display_index; // the index we are displaying on screen uint8_t ts_ticks; // when the user taps the LIGHT button, we show the timestamp for a few ticks. int32_t data_points; // the absolute number of data points logged - thermistor_logger_data_point_t data[THERMISTOR_LOGGING_NUM_DATA_POINTS]; -} thermistor_logger_state_t; + thermistor_logger_data_point_t data[TEMPERATURE_LOGGING_NUM_DATA_POINTS]; +} temperature_logging_state_t; void temperature_logging_face_setup(uint8_t watch_face_index, void ** context_ptr); void temperature_logging_face_activate(void *context);