Skip to content

Commit b266297

Browse files
committed
Be more agressive about clearing the boot lock
There was a check to see if the EVSE was not in the starting state, but it does not exit starting until the boot lock in cleared. Just removed that check as it is not needed as there is a flag to indicate if the boot lock is set. Fixes #798 “Waiting for initialization” after power loss
1 parent fe5be4d commit b266297

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/evse_monitor.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ unsigned long EvseMonitor::loop(MicroTasks::WakeReason reason)
319319
DBUG(", _count = ");
320320
DBUGLN(_count);
321321

322+
// unlock openevse fw compiled with BOOTLOCK
323+
if (isBootLocked()) {
324+
unlock();
325+
DBUGLN("Unlocked BOOTLOCK");
326+
}
327+
322328
if(_heartbeat)
323329
{
324330
_openevse.heartbeatPulse([] (int ret)
@@ -348,12 +354,6 @@ unsigned long EvseMonitor::loop(MicroTasks::WakeReason reason)
348354
verifyPilot();
349355
}
350356

351-
// unlock openevse fw compiled with BOOTLOCK
352-
if (isBootLocked() && OPENEVSE_STATE_STARTING != getEvseState()) {
353-
unlock();
354-
DBUGLN("Unlocked BOOTLOCK");
355-
}
356-
357357
_count ++;
358358

359359
return EVSE_MONITOR_POLL_TIME;
@@ -416,7 +416,8 @@ EvseMonitor::ServiceLevel EvseMonitor::getActualServiceLevel()
416416
ServiceLevel::L1;
417417
}
418418

419-
void EvseMonitor::unlock() {
419+
void EvseMonitor::unlock()
420+
{
420421
// Unlock OpenEVSE if compiled with BOOTLOCK
421422
_openevse.clearBootLock([this](int ret)
422423
{
@@ -427,9 +428,9 @@ void EvseMonitor::unlock() {
427428
else {
428429
DBUGF("Unlock OpenEVSE failed");
429430
}
430-
431431
});
432432
}
433+
433434
void EvseMonitor::enable()
434435
{
435436
OpenEVSE.enable([this](int ret)
@@ -732,7 +733,7 @@ void EvseMonitor::getChargeCurrentAndVoltageFromEvse()
732733
if(VOLTAGE_MINIMUM <= volts && volts <= VOLTAGE_MAXIMUM) {
733734
_voltage = volts;
734735
}
735-
_power = _amp * _voltage;
736+
_power = _amp * _voltage;
736737
if (config_threephase_enabled()) {
737738
_power = _power * 3;
738739
}
@@ -800,4 +801,4 @@ bool EvseMonitor::importTotalEnergy()
800801
}
801802
});
802803
return true;
803-
}
804+
}

0 commit comments

Comments
 (0)