altos/micropeak-v2.0: Wait for the power supply to stabilize before measuring
authorKeith Packard <keithp@keithp.com>
Tue, 18 Jun 2019 07:11:49 +0000 (00:11 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 18 Jun 2019 07:11:49 +0000 (00:11 -0700)
If we don't wait before measuring the battery, it will often read
under 3.2V right at boot time, which puts MicroPeak in flight mode
instead of USB mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/micropeak-v2.0/ao_micropeak.c

index 6343be9..7ba5cb9 100644 (file)
@@ -243,6 +243,11 @@ ao_hsi_init(void)
 void
 main(void)
 {
+       int i;
+
+       for (i = 0; i < 100000; i++)
+               ao_arch_nop();
+
        if (ao_battery_voltage() < 320)
                ao_on_battery = 1;