Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be more agressive about clearing the boot lock #888

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extra_scripts =
scripts/extra_script.py
debug_flags =
-ggdb
-D ENABLE_FULL_RAPI
-D ENABLE_DEBUG
#-D ENABLE_DEBUG_WEB
#-D ENABLE_DEBUG_WEB_REQUEST
Expand Down
21 changes: 11 additions & 10 deletions src/evse_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ unsigned long EvseMonitor::loop(MicroTasks::WakeReason reason)
DBUG(", _count = ");
DBUGLN(_count);

// unlock openevse fw compiled with BOOTLOCK
if (isBootLocked()) {
unlock();
DBUGLN("Unlocked BOOTLOCK");
}

if(_heartbeat)
{
_openevse.heartbeatPulse([] (int ret)
Expand Down Expand Up @@ -348,12 +354,6 @@ unsigned long EvseMonitor::loop(MicroTasks::WakeReason reason)
verifyPilot();
}

// unlock openevse fw compiled with BOOTLOCK
if (isBootLocked() && OPENEVSE_STATE_STARTING != getEvseState()) {
unlock();
DBUGLN("Unlocked BOOTLOCK");
}

_count ++;

return EVSE_MONITOR_POLL_TIME;
Expand Down Expand Up @@ -416,7 +416,8 @@ EvseMonitor::ServiceLevel EvseMonitor::getActualServiceLevel()
ServiceLevel::L1;
}

void EvseMonitor::unlock() {
void EvseMonitor::unlock()
{
// Unlock OpenEVSE if compiled with BOOTLOCK
_openevse.clearBootLock([this](int ret)
{
Expand All @@ -427,9 +428,9 @@ void EvseMonitor::unlock() {
else {
DBUGF("Unlock OpenEVSE failed");
}

});
}

void EvseMonitor::enable()
{
OpenEVSE.enable([this](int ret)
Expand Down Expand Up @@ -732,7 +733,7 @@ void EvseMonitor::getChargeCurrentAndVoltageFromEvse()
if(VOLTAGE_MINIMUM <= volts && volts <= VOLTAGE_MAXIMUM) {
_voltage = volts;
}
_power = _amp * _voltage;
_power = _amp * _voltage;
if (config_threephase_enabled()) {
_power = _power * 3;
}
Expand Down Expand Up @@ -800,4 +801,4 @@ bool EvseMonitor::importTotalEnergy()
}
});
return true;
}
}
Loading