Skip to content

Commit

Permalink
Merge pull request #371 from OpenEVSE/jeremypoulter/issue333
Browse files Browse the repository at this point in the history
Adding back the ability to use disabled instead of sleep to stop charging
  • Loading branch information
glynhudson authored Jun 22, 2022
2 parents 4aa9d89 + 2f79e06 commit ce496a1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ void config_changed(String name)
emoncms_updated = true;
}
ArduinoOcppTask::notifyConfigChanged();
evse.setSleepForDisable(!config_pause_uses_disabled());
} else if(name.startsWith("mqtt_")) {
mqtt_restart();
} else if(name.startsWith("ocpp_") || name.startsWith("tx_start_point")) {
Expand Down
18 changes: 18 additions & 0 deletions src/evse_man.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,24 @@ bool EvseManager::setTargetState(EvseProperties &target)
return changeMade;
}

void EvseManager::setSleepForDisable(bool sleepForDisable)
{
if(_sleepForDisable != sleepForDisable)
{
_sleepForDisable = sleepForDisable;
if(EvseState::Disabled == getActiveState())
{
if(_sleepForDisable) {
DBUGLN("EVSE: sleep");
_monitor.sleep();
} else {
DBUGLN("EVSE: disable");
_monitor.disable();
}
}
}
}

unsigned long EvseManager::loop(MicroTasks::WakeReason reason)
{
DBUG("EVSE manager woke: ");
Expand Down
6 changes: 6 additions & 0 deletions src/evse_man.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,12 @@ class EvseManager : public MicroTasks::Task
void setVehicleRange(int vehicleRange);
void setVehicleEta(int vehicleEta);

// Get/set the 'disabled' mode
bool isSleepForDisable() {
return _sleepForDisable;
}
void setSleepForDisable(bool sleepForDisable);

// Temp until everything uses EvseManager
RapiSender &getSender() {
return _sender;
Expand Down

0 comments on commit ce496a1

Please sign in to comment.