Skip to content

Commit

Permalink
added isBootLocked() using ECVF_BOOT_LOCK vflag
Browse files Browse the repository at this point in the history
  • Loading branch information
KipK committed May 11, 2023
1 parent 4aed330 commit 1c400ae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/evse_man.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ class EvseManager : public MicroTasks::Task
bool isVehicleConnected() {
return _monitor.isVehicleConnected();
}
bool isBootLocked() {
return _monitor.isBootLocked();
}
bool isError() {
return _monitor.isError();
}
Expand Down
6 changes: 6 additions & 0 deletions src/evse_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class EvseMonitor : public MicroTasks::Task
bool isVehicleConnected() {
return OPENEVSE_VFLAG_EV_CONNECTED == (getFlags() & OPENEVSE_VFLAG_EV_CONNECTED);
}
bool isBootLocked() {
return OPENEVSE_VFLAG_BOOT_LOCK == (getFlags() & OPENEVSE_VFLAG_BOOT_LOCK);
}
};

class DataReady : public MicroTasks::Event
Expand Down Expand Up @@ -232,6 +235,9 @@ class EvseMonitor : public MicroTasks::Task
bool isVehicleConnected() {
return _state.isVehicleConnected();
}
bool isBootLocked() {
return _state.isBootLocked();
}
double getAmps() {
return _amp;
}
Expand Down
12 changes: 3 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,9 @@ loop() {
import_timers(&scheduler);

// unlock openevse fw compiled with BOOTLOCK
static bool bootlocked = true;
if (bootlocked) {
DBUGLN("BOOTLOCK: get evse state:");
DBUGVAR(evse.getState());
if (evse.getState() != EvseState::None) {
evse.unlock();
DBUGLN("Unlock BOOTLOCK");
bootlocked = false;
}
if (evse.isBootLocked()) {
evse.unlock();
DBUGLN("Unlocked BOOTLOCK");
}
}

Expand Down

0 comments on commit 1c400ae

Please sign in to comment.