Update MightyHat example

This commit is contained in:
LowPowerLab 2015-12-17 23:49:57 -05:00
parent 926ddbfa53
commit b0d7ffa18c
1 changed files with 5 additions and 7 deletions

View File

@ -563,11 +563,9 @@ boolean readBattery() {
int currPeriod = millis()/BATTERYREADINTERVAL; int currPeriod = millis()/BATTERYREADINTERVAL;
if (currPeriod != lastPeriod) if (currPeriod != lastPeriod)
{ {
DEBUG('(');
lastPeriod=currPeriod; lastPeriod=currPeriod;
systemVoltage = BATTERY_VOLTS(analogRead(BATTERYSENSE)); systemVoltage = BATTERY_VOLTS(analogRead(BATTERYSENSE));
dtostrf(systemVoltage, 3,2, BATstr); dtostrf(systemVoltage, 3,2, BATstr);
DEBUG(')');
batteryLow = systemVoltage < LOWBATTERYTHRESHOLD; batteryLow = systemVoltage < LOWBATTERYTHRESHOLD;
return true; //signal that batt has been read return true; //signal that batt has been read
} }
@ -645,14 +643,14 @@ void loop() {
newPacketReceived = true; newPacketReceived = true;
} }
boolean newBatteryReading=false; //boolean newBatteryReading=false;
if (readBattery()) newBatteryReading = true; //if (readBattery()) newBatteryReading = true;
readBattery();
if (newPacketReceived || newBatteryReading)
if (newPacketReceived /*|| newBatteryReading*/)
{ {
newPacketReceived = false; newPacketReceived = false;
refreshLCD(); refreshLCD();
if (newBatteryReading) { newBatteryReading = false; delay(10); }
} }
LCD_BACKLIGHT(batteryLow); LCD_BACKLIGHT(batteryLow);
} }