first cut at turnon scripts for EasyTimer v2
[fw/altos] / src / drivers / ao_lco_bits.c
index 06fc929fd6c50cc151e3c38c111acc8db5d165ac..ebe3d0cb2989b12ca59ca15fefd4ab2081a9dea7 100644 (file)
@@ -381,6 +381,26 @@ ao_lco_set_firing(uint8_t firing)
        ao_wakeup(&ao_lco_armed);
 }
 
+#if 0
+static int16_t fake_boxes[] = {
+       1, 2, 3, 5, 8, 11, 13, 17, 19, 23, 29, 31, 37, 62, 97
+};
+#define ARRAYSIZE(a)   (sizeof(a) / sizeof((a)[0]))
+#define NFAKE ARRAYSIZE(fake_boxes)
+
+static bool
+is_fake(int16_t box)
+{
+       unsigned i;
+       for (i = 0; i < NFAKE; i++)
+               if (fake_boxes[i] == box)
+                       return true;
+       return false;
+}
+#else
+#define is_fake(b)     false
+#endif
+
 void
 ao_lco_search(void)
 {
@@ -407,13 +427,13 @@ ao_lco_search(void)
                        ao_lco_tick_offset[box] = 0;
                        r = ao_lco_query((uint16_t) box, &ao_pad_query, &ao_lco_tick_offset[box]);
                        PRINTD("box %d result %d offset %d\n", box, r, ao_lco_tick_offset[box]);
-                       if (r == AO_RADIO_CMAC_OK) {
+                       if (r == AO_RADIO_CMAC_OK || is_fake(box)) {
                                ++boxes;
                                ao_lco_box_set_present(box);
 #ifdef AO_LCO_SEARCH_API
                                ao_lco_search_box_present(box);
 #else
-                               ao_lco_show_pad((uint8_t) (boxes % 10));
+                               ao_lco_show_pad((int8_t) (boxes % 10));
 #endif
                                ao_delay(AO_MS_TO_TICKS(30));
                                break;