only build sensor features if sensor is available

This commit is contained in:
joeycastillo
2024-10-12 10:55:10 -04:00
parent 378ba85b58
commit 4795818098
15 changed files with 65 additions and 33 deletions

View File

@@ -29,6 +29,8 @@
#include "tc.h"
#include "watch.h"
#ifdef HAS_ACCELEROMETER
static void _accel_interrupt_count_face_update_display(accel_interrupt_count_state_t *state) {
(void) state;
char buf[7];
@@ -119,3 +121,5 @@ movement_watch_face_advisory_t accel_interrupt_count_face_advise(void *context)
return retval;
}
#endif // HAS_ACCELEROMETER

View File

@@ -35,6 +35,8 @@
#include "movement.h"
#include "watch.h"
#ifdef HAS_ACCELEROMETER
typedef struct {
uint8_t new_threshold;
uint8_t threshold;
@@ -54,3 +56,5 @@ movement_watch_face_advisory_t accel_interrupt_count_face_advise(void *context);
accel_interrupt_count_face_resign, \
accel_interrupt_count_face_advise, \
})
#endif // HAS_ACCELEROMETER

View File

@@ -22,6 +22,8 @@
* SOFTWARE.
*/
#ifdef HAS_IR_SENSOR
#include <stdlib.h>
#include <string.h>
#include "light_sensor_face.h"
@@ -116,3 +118,5 @@ void light_sensor_face_resign(void *context) {
// handle any cleanup before your watch face goes off-screen.
}
#endif // HAS_IR_SENSOR

View File

@@ -24,6 +24,8 @@
#pragma once
#ifdef HAS_IR_SENSOR
#include "movement.h"
/*
@@ -50,3 +52,5 @@ void light_sensor_face_resign(void *context);
light_sensor_face_resign, \
NULL, \
})
#endif // HAS_IR_SENSOR

View File

@@ -28,6 +28,8 @@
#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();
@@ -94,3 +96,5 @@ bool temperature_display_face_loop(movement_event_t event, void *context) {
void temperature_display_face_resign(void *context) {
(void) context;
}
#endif

View File

@@ -22,8 +22,11 @@
* SOFTWARE.
*/
#ifndef TEMPERATURE_DISPLAY_FACE_H_
#define TEMPERATURE_DISPLAY_FACE_H_
#pragma once
#include "pins.h"
#ifdef HAS_TEMPERATURE_SENSOR
/*
* THERMISTOR READOUT (aka Temperature Display)
@@ -63,4 +66,4 @@ void temperature_display_face_resign(void *context);
NULL, \
})
#endif // TEMPERATURE_DISPLAY_FACE_H_
#endif // HAS_TEMPERATURE_SENSOR

View File

@@ -28,6 +28,8 @@
#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();
@@ -148,3 +150,5 @@ movement_watch_face_advisory_t temperature_logging_face_advise(void *context) {
return retval;
}
#endif

View File

@@ -22,8 +22,11 @@
* SOFTWARE.
*/
#ifndef TEMPERATURE_LOGGING_FACE_H_
#define TEMPERATURE_LOGGING_FACE_H_
#pragma once
#include "pins.h"
#ifdef HAS_TEMPERATURE_SENSOR
/*
* THERMISTOR LOGGING (aka Temperature Log)
@@ -84,4 +87,4 @@ movement_watch_face_advisory_t temperature_logging_face_advise(void *context);
temperature_logging_face_advise, \
})
#endif // TEMPERATURE_LOGGING_FACE_H_
#endif // HAS_TEMPERATURE_SENSOR