]> git.earman.xyz Git - sensor-watch.git/commitdiff
temperature logger: rename stuff to remove thermistor references
authorJoey Castillo <joeycastillo@utexas.edu>
Wed, 21 May 2025 05:12:20 +0000 (01:12 -0400)
committerJoey Castillo <joeycastillo@utexas.edu>
Wed, 21 May 2025 05:12:20 +0000 (01:12 -0400)
watch-faces/sensor/temperature_logging_face.c
watch-faces/sensor/temperature_logging_face.h

index 68c7365bfc35836fb90eff2c741b686858ed48ae..2016d94afb0c6bc792a5f996e26f23a0126011ba 100644 (file)
 #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:
index 1c4f88f14eaf325f4db8a0f5529feb98eb459292..9fd3f032fb91d1a3c68b04b3858aba8200d5b1af 100644 (file)
@@ -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);