From 042c372a736ace40a473e8c165fea750c0681b7e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 3 Oct 2024 21:45:11 -0700 Subject: [PATCH] telegps-v4.0-seeed: Use simpler failure indicators 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 --- src/telegps-v4.0-seeed/ao_telegps_seeed.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/telegps-v4.0-seeed/ao_telegps_seeed.c b/src/telegps-v4.0-seeed/ao_telegps_seeed.c index ae7c9b12..18dee5d6 100644 --- a/src/telegps-v4.0-seeed/ao_telegps_seeed.c +++ b/src/telegps-v4.0-seeed/ao_telegps_seeed.c @@ -21,6 +21,10 @@ #include #include +#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; -- 2.47.2