Update MightyHat example
This commit is contained in:
parent
926ddbfa53
commit
b0d7ffa18c
|
|
@ -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);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue