]> git.gag.com Git - fw/altos/commitdiff
telegps-v4.0-seeed: Use simpler failure indicators
authorKeith Packard <keithp@keithp.com>
Fri, 4 Oct 2024 04:45:11 +0000 (21:45 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 28 Jan 2025 18:23:35 +0000 (10:23 -0800)
panic with one blink - flash check failed
panic with two blinks - battery voltage check failed
panic with three blinks - gps check failed
steady LED - success

Signed-off-by: Keith Packard <keithp@keithp.com>
src/telegps-v4.0-seeed/ao_telegps_seeed.c

index ae7c9b123ecd49becf905ac54e3d6240c4284cb1..18dee5d6d4513fd22f51cfc940fb5d29d460ed09 100644 (file)
 #include <ao_exti.h>
 #include <ao_tracker.h>
 
+#define AO_FAIL_FLASH  1
+#define AO_FAIL_ADC    2
+#define AO_FAIL_GPS    3
+
 static void
 ao_validate(void)
 {
@@ -34,7 +38,7 @@ ao_validate(void)
        /* Check the flash part */
        ao_storage_setup();
        if (ao_storage_total != 2 * 1024 * 1024)
-               ao_panic(AO_PANIC_FLASH);
+               ao_panic(AO_FAIL_FLASH);
 
        /* Check the battery voltage */
        data = ao_data_head;
@@ -43,7 +47,7 @@ ao_validate(void)
        } while (ao_data_head == data);
        decivolt = ao_battery_decivolt(ao_data_ring[data].adc.v_batt);
        if (decivolt < 35 && 55 < decivolt)
-               ao_panic(AO_PANIC_ADC);
+               ao_panic(AO_FAIL_ADC);
 
        /* Check to make sure GPS data is being received */
        gps_start = ao_time();
@@ -63,9 +67,10 @@ ao_validate(void)
                                break;
                }
                if ((AO_TICK_SIGNED) (ao_time() - gps_start) > (AO_TICK_SIGNED) AO_SEC_TO_TICKS(10))
-                       ao_panic(AO_PANIC_CRASH);
+                       ao_panic(AO_FAIL_GPS);
        }
        ao_led_on(LEDS_AVAILABLE);
+       ao_exit();
 }
 
 struct ao_task ao_validate_task;