handle case where no battery is plugged into INA219 which reads < 1V

pull/49/head
alanbjohnston 5 years ago committed by GitHub
parent a2015ca412
commit 1ea32bbc49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);

Loading…
Cancel
Save

Powered by TurnKey Linux.