-static AO_LED_TYPE continuity_led[AO_LED_CONTINUITY_NUM] = {
-#ifdef AO_LED_CONTINUITY_0
- AO_LED_CONTINUITY_0,
-#endif
-#ifdef AO_LED_CONTINUITY_1
- AO_LED_CONTINUITY_1,
-#endif
-#ifdef AO_LED_CONTINUITY_2
- AO_LED_CONTINUITY_2,
-#endif
-#ifdef AO_LED_CONTINUITY_3
- AO_LED_CONTINUITY_3,
-#endif
-#ifdef AO_LED_CONTINUITY_4
- AO_LED_CONTINUITY_4,
-#endif
-#ifdef AO_LED_CONTINUITY_5
- AO_LED_CONTINUITY_5,
-#endif
-#ifdef AO_LED_CONTINUITY_6
- AO_LED_CONTINUITY_6,
-#endif
-#ifdef AO_LED_CONTINUITY_7
- AO_LED_CONTINUITY_7,
-#endif
-};
-
-static uint8_t
-ao_lco_get_channels(void)
-{
- int8_t r;
-
- r = ao_lco_query(ao_lco_box, &ao_pad_query, &ao_lco_tick_offset);
- if (r == AO_RADIO_CMAC_OK) {
- ao_lco_channels = ao_pad_query.channels;
- ao_lco_valid = AO_LCO_VALID_LAST | AO_LCO_VALID_EVER;
- } else
- ao_lco_valid &= ~AO_LCO_VALID_LAST;
- PRINTD(DEBUG_STATUS, "ao_lco_get_channels() rssi %d valid %d ret %d offset %d\n", ao_radio_cmac_rssi, ao_lco_valid, r, ao_lco_tick_offset);
- ao_wakeup(&ao_pad_query);
- return ao_lco_valid;
-}
-
-static void
-ao_lco_igniter_status(void)
-{
- uint8_t c;
- uint8_t t = 0;
-
- for (;;) {
- ao_sleep(&ao_pad_query);
- PRINTD(DEBUG_STATUS, "RSSI %d VALID %d\n", ao_radio_cmac_rssi, ao_lco_valid);
- if (!(ao_lco_valid & AO_LCO_VALID_LAST)) {
- ao_led_on(AO_LED_RED);
- ao_led_off(AO_LED_GREEN|AO_LED_AMBER);
- continue;
- }
- if (ao_radio_cmac_rssi < -90) {
- ao_led_on(AO_LED_AMBER);
- ao_led_off(AO_LED_RED|AO_LED_GREEN);
- } else {
- ao_led_on(AO_LED_GREEN);
- ao_led_off(AO_LED_RED|AO_LED_AMBER);
- }
- if (ao_pad_query.arm_status)
- ao_led_on(AO_LED_REMOTE_ARM);
- else
- ao_led_off(AO_LED_REMOTE_ARM);
-
- for (c = 0; c < AO_LED_CONTINUITY_NUM; c++) {
- uint8_t status;
-
- if (ao_pad_query.channels & (1 << c))
- status = ao_pad_query.igniter_status[c];
- else
- status = AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_OPEN;
- PRINTD(DEBUG_STATUS, "\tchannel %d status %d\n", c, status);
- if (status == AO_PAD_IGNITER_STATUS_GOOD_IGNITER_RELAY_OPEN)
- ao_led_on(continuity_led[c]);
- else
- ao_led_off(continuity_led[c]);
- }
- t = 1-t;
- }
-}
-
-static void
-ao_lco_arm_warn(void)
-{
- int i;
- for (;;) {
- while (!ao_lco_armed)
- ao_sleep(&ao_lco_armed);
- for (i = 0; i < ao_lco_armed; i++) {
- ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(100));
- ao_delay(AO_MS_TO_TICKS(100));
- }
- ao_delay(AO_MS_TO_TICKS(300));
- }
-}
-