- int8_t r;
-
- launch_args();
- if (ao_cmd_status != ao_cmd_success)
- return;
- r = launch_query();
- switch (r) {
- case AO_RADIO_CMAC_OK:
- if (query.valid) {
- switch (query.arm_status) {
- case ao_igniter_ready:
- case ao_igniter_active:
- printf ("Armed: ");
- break;
- default:
- printf("Disarmed: ");
- }
- switch (query.igniter_status) {
- default:
- printf("unknown\n");
- break;
- case ao_igniter_ready:
- printf("igniter good\n");
- break;
- case ao_igniter_open:
- printf("igniter bad\n");
- break;
+ uint8_t tens, ones, tenths;
+
+ tenths = decivolts % 10;
+ ones = (decivolts / 10) % 10;
+ tens = (decivolts / 100) % 10;
+ ao_mutex_get(&ao_lco_display_mutex);
+ ao_seven_segment_set(AO_LCO_PAD_DIGIT, tenths);
+ ao_seven_segment_set(AO_LCO_BOX_DIGIT_1, ones | 0x10);
+ ao_seven_segment_set(AO_LCO_BOX_DIGIT_10, tens);
+ ao_mutex_put(&ao_lco_display_mutex);
+}
+
+void
+ao_lco_show(void)
+{
+ if (ao_lco_pad == AO_LCO_PAD_VOLTAGE && ao_lco_box != AO_LCO_BOX_DRAG) {
+ ao_lco_show_voltage(ao_pad_query.battery);
+ } else {
+ if (ao_lco_box == AO_LCO_BOX_DRAG)
+ ao_lco_show_pad(ao_lco_drag_race);
+ else
+ ao_lco_show_pad(ao_lco_pad);
+ ao_lco_show_box(ao_lco_box);
+ }
+}
+
+uint8_t
+ao_lco_box_present(uint16_t box)
+{
+ if (box == AO_LCO_BOX_DRAG)
+ return 1;
+
+ if (box >= AO_PAD_MAX_BOXES)
+ return 0;
+ return (ao_lco_box_mask[AO_LCO_MASK_ID(box)] >> AO_LCO_MASK_SHIFT(box)) & 1;
+}
+
+static struct ao_task ao_lco_drag_task;
+static uint8_t ao_lco_drag_active;
+
+static uint16_t
+ao_lco_drag_button_check(uint16_t now, uint16_t delay)
+{
+ uint16_t button_delay = ~0;
+
+ /*
+ * Check to see if the button has been held down long enough
+ * to switch in/out of drag race mode
+ */
+ if (ao_lco_fire_down) {
+ if (ao_lco_drag_race) {
+ if ((int16_t) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_STOP_TIME) {
+ ao_lco_drag_disable();
+ ao_lco_fire_down = 0;