add movement_get_temperature, works across different sensor boards

This commit is contained in:
Joey Castillo
2025-05-17 11:03:51 -04:00
parent 80cbb0fe30
commit 47fbaccc77
7 changed files with 26 additions and 28 deletions

View File

@@ -28,17 +28,13 @@
#include "thermistor_driver.h"
#include "watch.h"
#ifdef HAS_TEMPERATURE_SENSOR
static void _temperature_display_face_update_display(bool in_fahrenheit) {
thermistor_driver_enable();
float temperature_c = thermistor_driver_get_temperature();
float temperature_c = movement_get_temperature();
if (in_fahrenheit) {
watch_display_float_with_best_effort(temperature_c * 1.8 + 32.0, "#F");
} else {
watch_display_float_with_best_effort(temperature_c, "#C");
}
thermistor_driver_disable();
}
void temperature_display_face_setup(uint8_t watch_face_index, void ** context_ptr) {
@@ -96,5 +92,3 @@ bool temperature_display_face_loop(movement_event_t event, void *context) {
void temperature_display_face_resign(void *context) {
(void) context;
}
#endif

View File

@@ -26,8 +26,6 @@
#include "pins.h"
#ifdef HAS_TEMPERATURE_SENSOR
/*
* THERMISTOR READOUT (aka Temperature Display)
*
@@ -65,5 +63,3 @@ void temperature_display_face_resign(void *context);
temperature_display_face_resign, \
NULL, \
})
#endif // HAS_TEMPERATURE_SENSOR

View File

@@ -28,18 +28,13 @@
#include "thermistor_driver.h"
#include "watch.h"
#ifdef HAS_TEMPERATURE_SENSOR
static void _temperature_logging_face_log_data(thermistor_logger_state_t *logger_state) {
thermistor_driver_enable();
watch_date_time_t date_time = watch_rtc_get_date_time();
size_t pos = logger_state->data_points % THERMISTOR_LOGGING_NUM_DATA_POINTS;
logger_state->data[pos].timestamp.reg = date_time.reg;
logger_state->data[pos].temperature_c = thermistor_driver_get_temperature();
logger_state->data[pos].temperature_c = movement_get_temperature();
logger_state->data_points++;
thermistor_driver_disable();
}
static void _temperature_logging_face_update_display(thermistor_logger_state_t *logger_state, bool in_fahrenheit, bool clock_mode_24h) {
@@ -150,5 +145,3 @@ movement_watch_face_advisory_t temperature_logging_face_advise(void *context) {
return retval;
}
#endif

View File

@@ -26,8 +26,6 @@
#include "pins.h"
#ifdef HAS_TEMPERATURE_SENSOR
/*
* THERMISTOR LOGGING (aka Temperature Log)
*
@@ -86,5 +84,3 @@ movement_watch_face_advisory_t temperature_logging_face_advise(void *context);
temperature_logging_face_resign, \
temperature_logging_face_advise, \
})
#endif // HAS_TEMPERATURE_SENSOR