From 194fd3678fa84a4ab43af57de21f71ff3afa3533 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Mon, 22 May 2017 17:45:10 -0500 Subject: [PATCH] Avoid linking to jostle detection code for boards that do not support it --- bsp/lesson_tracker.h | 1 + src/sensor.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/bsp/lesson_tracker.h b/bsp/lesson_tracker.h index a5444d3..e5f7a26 100644 --- a/bsp/lesson_tracker.h +++ b/bsp/lesson_tracker.h @@ -8,6 +8,7 @@ extern "C" { #define SIMBLEE #define MMA8541 +#define JOSTLE_DETECT #define LEDS_NUMBER 0 #define BUTTONS_NUMBER 0 diff --git a/src/sensor.c b/src/sensor.c index 5cf2811..2c6d6b0 100644 --- a/src/sensor.c +++ b/src/sensor.c @@ -17,7 +17,10 @@ void sensor_init() { #ifdef ACCEL_ADXL337 shoe_accel_init(); #endif + +#ifdef JOSTLE_DETECT jostle_detect_init(); +#endif uint32_t error_code; error_code = rbc_mesh_value_enable(SENSOR_HANDLE); @@ -34,10 +37,13 @@ void gather_sensor_data() { memset(&m_value, 0, sizeof(sensor_value_t)); m_value.valid_time = get_clock_time(); m_value.battery = get_battery_adc(); + +#ifdef JOSTLE_DETECT if (jostle_detect_get_flag()) { m_value.status |= STATUS_FLAG_JOSTLE_DETECTED; jostle_detect_clear_flag(); } +#endif #ifdef ACCEL_ADXL337 read_shoe_accel(&m_value.accel_x, &m_value.accel_y, &m_value.accel_z);