altos: Include sensor logging task only on flight boards
authorKeith Packard <keithp@keithp.com>
Fri, 6 Jun 2014 00:14:28 +0000 (17:14 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 6 Jun 2014 00:14:28 +0000 (17:14 -0700)
This lets TeleGPS use the logging infrastructure without wasting a
task to log sensor data

Signed-off-by: Keith Packard <keithp@keithp.com>
src/kernel/ao_log.c
src/kernel/ao_log_mega.c

index 20febefe27f2df4693ad4cd02b6f31b96aaa20ea..d60485e0d7f2fb962cda1f8c08ead66325b351e8 100644 (file)
@@ -196,7 +196,11 @@ ao_log_full(void)
        return ao_log_current_pos == ao_log_end_pos;
 }
 
-#if HAS_ADC
+#ifndef LOG_ADC
+#define LOG_ADC        HAS_ADC
+#endif
+
+#if LOG_ADC
 static __xdata struct ao_task ao_log_task;
 #endif
 
@@ -284,7 +288,7 @@ ao_log_init(void)
 #ifndef HAS_ADC
 #error Define HAS_ADC for ao_log.c
 #endif
-#if HAS_ADC
+#if LOG_ADC
        /* Create a task to log events to eeprom */
        ao_add_task(&ao_log_task, ao_log, "log");
 #endif
index 768947d541728159f7e86d16c30d2122ad4a4914..8997fd0596f19f63b7a3cab772ceefaa12f03941 100644 (file)
@@ -65,7 +65,7 @@ ao_log_dump_check_data(void)
        return 1;
 }
 
-#if HAS_ADC
+#if HAS_FLIGHT
 static __data uint8_t  ao_log_data_pos;
 
 /* a hack to make sure that ao_log_megas fill the eeprom block in even units */
@@ -100,9 +100,9 @@ ao_log(void)
        log.u.flight.ground_accel_along = ao_ground_accel_along;
        log.u.flight.ground_accel_across = ao_ground_accel_across;
        log.u.flight.ground_accel_through = ao_ground_accel_through;
+       log.u.flight.ground_roll = ao_ground_roll;
        log.u.flight.ground_pitch = ao_ground_pitch;
        log.u.flight.ground_yaw = ao_ground_yaw;
-       log.u.flight.ground_roll = ao_ground_roll;
 #endif
        log.u.flight.ground_pres = ao_ground_pres;
        log.u.flight.flight = ao_flight_number;
@@ -183,7 +183,7 @@ ao_log(void)
                        ao_sleep(&ao_log_running);
        }
 }
-#endif
+#endif /* HAS_FLIGHT */
 
 uint16_t
 ao_log_flight(uint8_t slot)