From 1ea32bbc49c1536810b7b22b35ba2101e45de1e6 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 27 Jul 2020 11:14:44 -0400 Subject: [PATCH] handle case where no battery is plugged into INA219 which reads < 1V --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 82835276..385bfcc7 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -550,7 +550,7 @@ while (loop-- != 0) #ifdef DEBUG_LOGGING fprintf(stderr,"INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold); #endif - if ((batteryVoltage > 0) && (batteryVoltage < batteryThreshold)) + if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V { fprintf(stderr,"Battery voltage too low: %f V - shutting down!\n", batteryVoltage); digitalWrite (txLed, txLedOff);