fprintf(stderr,"INFO: Battery voltage: %f V Battery Threshold %f V\n",batteryVoltage, batteryThreshold);
fprintf(stderr,"INFO: Battery voltage: %f V Threshold %f V Current: %f mA Threshold: %f mA\n",batteryVoltage,voltageThreshold,batteryCurrent,currentThreshold);
#endif
if((batteryVoltage>1.0)&&(batteryVoltage<batteryThreshold))// no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V
// if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V
if((batteryCurrent>currentThreshold)&&(batteryVoltage<voltageThreshold))// currentThreshold ensures that this won't happen when running on DC power.
{
fprintf(stderr,"Battery voltage too low: %f V - shutting down!\n",batteryVoltage);