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

Unlock Evse module when Wifi module is ready #548

Merged
merged 4 commits into from
Feb 23, 2023
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
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lib_deps =
jeremypoulter/ArduinoMongoose@0.0.18
jeremypoulter/Micro Debug@0.0.5
jeremypoulter/ConfigJson@0.0.5
jeremypoulter/OpenEVSE@0.0.11
jeremypoulter/OpenEVSE@0.0.12
jeremypoulter/ESPAL@0.0.3
jeremypoulter/StreamSpy@0.0.1
jeremypoulter/MicroTasks@0.0.2
Expand Down
15 changes: 14 additions & 1 deletion src/evse_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,19 @@ void EvseMonitor::evseBoot(const char *firmware)
_openevse.heartbeatEnable(EVSE_HEATBEAT_INTERVAL, EVSE_HEARTBEAT_CURRENT, [this](int ret, int interval, int current, int triggered) {
_heartbeat = RAPI_RESPONSE_OK == ret;
});

// Unlock OpenEVSE if compiled with BOOTLOCK
_openevse.clearBootLock([this](int ret)
{
if(RAPI_RESPONSE_OK == ret)
{
DBUGF("Unlocked OpenEVSE");
}
else {
DBUGF("Unlock OpenEVSE failed")
}

});
}

void EvseMonitor::updateEvseState(uint8_t evse_state, uint8_t pilot_state, uint32_t vflags)
Expand Down Expand Up @@ -312,7 +325,7 @@ void EvseMonitor::updateEvseState(uint8_t evse_state, uint8_t pilot_state, uint3
}

void EvseMonitor::verifyPilot() {
// After some state changes the OpenEVSE module compiled with PP_AUTO_AMPACITY will reset to the maximum pilot level, so reset to what we expect
// OpenEVSE module compiled with PP_AUTO_AMPACITY will reset to the maximum pilot level, so reset to what we expect
_openevse.getCurrentCapacity([this](int ret, long min_current, long max_hardware_current, long pilot, long max_configured_current)
{
if(RAPI_RESPONSE_OK == ret && pilot > getPilot())
Expand Down