updated to gameclass merged with v1.1 power
This commit is contained in:
@@ -17,8 +17,9 @@ void initBattery(void)
|
||||
{
|
||||
#ifdef VBATTPIN
|
||||
#ifdef MEAS_EN
|
||||
battery.onDemand(MEAS_EN, LOW);
|
||||
battery.begin(VBATTREF, (R12 + R13) / R13); //R1 = 220K, R2 = 100K, factor = (R1+R2)/R2
|
||||
battery.onDemand(MEAS_EN, HIGH);
|
||||
|
||||
#else
|
||||
battery.begin(VBATTREF, (R12 + R13) / R13); //R1 = 220K, R2 = 100K, factor = (R1+R2)/R2
|
||||
#endif
|
||||
@@ -62,9 +63,11 @@ bool handleBattery(void)
|
||||
uint64_t currentmillis = millis();
|
||||
if (currentmillis - delay_timer > BATTERYMEASUREDELAY)
|
||||
{
|
||||
// uint16_t vbatt = battery.voltage();
|
||||
// if (vbatt < VBATTMIN)
|
||||
// {
|
||||
uint16_t vbatt = battery.voltage();
|
||||
if (vbatt < VBATTMIN)
|
||||
{
|
||||
//turnOnAllLed();
|
||||
}
|
||||
|
||||
delay_timer = currentmillis;
|
||||
// delay(5000);
|
||||
@@ -125,11 +128,11 @@ void handlePowerState(void)
|
||||
turnOnLed(1);
|
||||
powerstate = poweringOn2;
|
||||
}
|
||||
else if (buttonPower.pressedFor(1000))
|
||||
else if (buttonPower.pressedFor(800))
|
||||
{
|
||||
turnOnLed(2);
|
||||
}
|
||||
else if (buttonPower.pressedFor(500))
|
||||
else if (buttonPower.pressedFor(100))
|
||||
{
|
||||
turnOnLed(3);
|
||||
}
|
||||
@@ -152,7 +155,7 @@ void handlePowerState(void)
|
||||
break;
|
||||
case on:
|
||||
{
|
||||
if (buttonPower.pressedFor(500))
|
||||
if (buttonPower.pressedFor(100))
|
||||
{
|
||||
powerstate = poweringOff;
|
||||
turnOnAllLed();
|
||||
@@ -169,16 +172,16 @@ void handlePowerState(void)
|
||||
break;
|
||||
case poweringOff:
|
||||
{
|
||||
if (buttonPower.pressedFor(3000))
|
||||
if (buttonPower.pressedFor(POWERBUTTONDELAY))
|
||||
{
|
||||
turnOffLed(1);
|
||||
powerstate = poweringOff2;
|
||||
}
|
||||
else if (buttonPower.pressedFor(2000))
|
||||
else if (buttonPower.pressedFor(950))
|
||||
{
|
||||
turnOffLed(2);
|
||||
}
|
||||
else if (buttonPower.pressedFor(1000))
|
||||
else if (buttonPower.pressedFor(450))
|
||||
{
|
||||
turnOffLed(3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user