From: Keith Packard Date: Thu, 11 Aug 2011 23:11:34 +0000 (-0700) Subject: altos: remove monitor disable stubs from altimeter code X-Git-Tag: 0.9.6.0~25 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=640422c028a2be898aa3a9048a0f6fad2e43dd8d altos: remove monitor disable stubs from altimeter code Monitor mode in the ground-station boards must be disabled when the radio is going to be used for another purpose, or the radio parameters changed. That places monitor-mode disable calls in other parts of the system which are shared with the altimeter code. Elide the ao_set_monitor calls for builds which do not include any monitoring code. Signed-off-by: Keith Packard --- diff --git a/src/ao_monitor.c b/src/ao_monitor.c index 8f1b9e12..69eb58e8 100644 --- a/src/ao_monitor.c +++ b/src/ao_monitor.c @@ -18,6 +18,10 @@ #include "ao.h" #include "ao_telem.h" +#if !HAS_MONITOR +#error Must define HAS_MONITOR to 1 +#endif + __xdata uint8_t ao_monitoring; __pdata uint8_t ao_monitor_led; diff --git a/src/ao_packet_master.c b/src/ao_packet_master.c index e721ffba..b0fdf5a8 100644 --- a/src/ao_packet_master.c +++ b/src/ao_packet_master.c @@ -109,7 +109,9 @@ ao_packet_forward(void) __reentrant ao_cmd_white(); flush(); +#if HAS_MONITOR ao_set_monitor(0); +#endif ao_add_task(&ao_packet_task, ao_packet_master, "master"); ao_add_task(&ao_packet_echo_task, ao_packet_echo, "echo"); while ((c = getchar()) != '~') { diff --git a/src/ao_pins.h b/src/ao_pins.h index bc07ad54..89907b9c 100644 --- a/src/ao_pins.h +++ b/src/ao_pins.h @@ -42,6 +42,7 @@ #define HAS_ACCEL_REF 0 #define HAS_ACCEL 1 #define HAS_IGNITE 1 + #define HAS_MONITOR 0 #endif #if defined(TELEMETRUM_V_1_1) @@ -72,6 +73,7 @@ #define M25_MAX_CHIPS 1 #define HAS_ACCEL 1 #define HAS_IGNITE 1 + #define HAS_MONITOR 0 #endif #if defined(TELEDONGLE_V_0_2) @@ -95,6 +97,7 @@ #define SPI_CS_ON_P1 1 #define SPI_CS_ON_P0 0 #define HAS_IGNITE 0 + #define HAS_MONITOR 1 #endif #if defined(TELEMINI_V_1_0) @@ -120,6 +123,7 @@ #define HAS_EXTERNAL_TEMP 0 #define HAS_ACCEL 0 #define HAS_IGNITE 1 + #define HAS_MONITOR 0 #endif #if defined(TELENANO_V_0_1) @@ -144,6 +148,7 @@ #define HAS_EXTERNAL_TEMP 0 #define HAS_ACCEL 0 #define HAS_IGNITE 0 + #define HAS_MONITOR 0 #endif #if defined(TELEMETRUM_V_0_1) @@ -172,6 +177,7 @@ #define SPI_CS_ON_P0 0 #define HAS_ACCEL 1 #define HAS_IGNITE 1 + #define HAS_MONITOR 0 #endif #if defined(TELEDONGLE_V_0_1) @@ -195,6 +201,7 @@ #define SPI_CS_ON_P1 0 #define SPI_CS_ON_P0 1 #define HAS_IGNITE 0 + #define HAS_MONITOR 1 #endif #if defined(TIDONGLE) @@ -217,6 +224,7 @@ #define SPI_CS_ON_P1 0 #define SPI_CS_ON_P0 1 #define HAS_IGNITE 0 + #define HAS_MONITOR 1 #endif #if defined(TELEBT_V_0_0) @@ -245,6 +253,7 @@ #define BT_LINK_ON_P1 0 #define BT_LINK_PIN_INDEX 7 #define BT_LINK_PIN P2_1 + #define HAS_MONITOR 1 #endif #if defined(TELEBT_V_0_1) @@ -280,6 +289,7 @@ #define BT_LINK_ON_P1 1 #define BT_LINK_PIN_INDEX 7 #define BT_LINK_PIN P1_7 + #define HAS_MONITOR 1 #endif #if DBG_ON_P1 @@ -376,4 +386,7 @@ #error Please define PACKET_HAS_SLAVE #endif +#ifndef HAS_MONITOR +#error Please define HAS_MONITOR +#endif #endif /* _AO_PINS_H_ */ diff --git a/src/ao_radio.c b/src/ao_radio.c index 1fb0eea6..00816b33 100644 --- a/src/ao_radio.c +++ b/src/ao_radio.c @@ -432,7 +432,9 @@ ao_radio_test(void) } mode++; if ((mode & 2) && !radio_on) { +#if HAS_MONITOR ao_set_monitor(0); +#endif #if PACKET_HAS_SLAVE ao_packet_slave_stop(); #endif diff --git a/src/ao_telemetrum.c b/src/ao_telemetrum.c index d9ea1fc8..6fa70b3a 100644 --- a/src/ao_telemetrum.c +++ b/src/ao_telemetrum.c @@ -18,13 +18,6 @@ #include "ao.h" #include "ao_pins.h" -/* stub so as telemetrum doesn't have monitor mode */ -void -ao_set_monitor(uint8_t monitoring) -{ - (void) monitoring; -} - void main(void) { diff --git a/src/ao_telemini.c b/src/ao_telemini.c index 6c612481..fa23de01 100644 --- a/src/ao_telemini.c +++ b/src/ao_telemini.c @@ -18,13 +18,6 @@ #include "ao.h" #include "ao_pins.h" -/* stub so as telemini doesn't have monitor mode */ -void -ao_set_monitor(uint8_t monitoring) -{ - (void) monitoring; -} - void main(void) { diff --git a/src/ao_telenano.c b/src/ao_telenano.c index 40822b6e..d91983d0 100644 --- a/src/ao_telenano.c +++ b/src/ao_telenano.c @@ -18,13 +18,6 @@ #include "ao.h" #include "ao_pins.h" -/* stub so as telemini doesn't have monitor mode */ -void -ao_set_monitor(uint8_t monitoring) -{ - (void) monitoring; -} - void main(void) {