Skip to content

Commit 3bbc287

Browse files
committed
Remove unused charger Mutex descriptions for pause and resume. Pause and resume charging is only accepted when a transaction is active
Signed-off-by: Piet Gömpel <pietgoempel@gmail.com>
1 parent b323219 commit 3bbc287

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

modules/EVSE/EvseManager/Charger.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ void Charger::run_state_machine() {
774774

775775
if (not shared_context.flag_transaction_active or not shared_context.flag_authorized or
776776
not shared_context.flag_ev_plugged_in) {
777-
EVLOG_warning << "going to stop from pause 1";
778777
set_state(EvseState::StoppingCharging);
779778
break;
780779
}
@@ -805,11 +804,11 @@ void Charger::run_state_machine() {
805804
// be shut down before SessionStop.req)
806805

807806
if (shared_context.hlc_charging_terminate_pause == HlcTerminatePause::Terminate) {
808-
// EV wants to terminate session. We still stay in PausedEV since it could restart a session as long as it is not unplugged.
807+
// EV wants to terminate session. We still stay in PausedEV since it could restart a session as long
808+
// as it is not unplugged.
809809
if (shared_context.pwm_running) {
810810
pwm_off();
811811
}
812-
813812
} else if (shared_context.hlc_charging_terminate_pause == HlcTerminatePause::Pause) {
814813
// EV wants an actual pause
815814
if (shared_context.pwm_running) {
@@ -966,8 +965,6 @@ void Charger::run_state_machine() {
966965
bsp->allow_power_on(false, types::evse_board_support::Reason::PowerOff);
967966
}
968967

969-
// FIXME: wait here for SLAC to become available again
970-
971968
// If unplugged, stop session and proceed to Idle, otherwise wait here and do nothing
972969
if (not shared_context.flag_ev_plugged_in) {
973970
stop_session();
@@ -1238,14 +1235,19 @@ bool Charger::set_max_current(float c, std::chrono::time_point<std::chrono::stea
12381235

12391236
// set pausing flag, it will be picked up by the state machine.
12401237
bool Charger::pause_charging() {
1241-
shared_context.flag_paused_by_evse = true;
1242-
// FIXME: this now always works. Does this cause problems?
1243-
return true;
1238+
if (shared_context.flag_transaction_active) {
1239+
shared_context.flag_paused_by_evse = true;
1240+
return true;
1241+
}
1242+
return false;
12441243
}
12451244

12461245
bool Charger::resume_charging() {
1247-
shared_context.flag_paused_by_evse = false;
1248-
// FIXME: this now always works. Does this cause problems?
1246+
if (shared_context.flag_transaction_active) {
1247+
shared_context.flag_paused_by_evse = false;
1248+
return true;
1249+
}
1250+
return false;
12491251
return true;
12501252
}
12511253

modules/EVSE/EvseManager/Charger.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ class Charger {
346346
int sleep_before_enabling_pwm_hlc_mode_ms{1000};
347347
// type used to generate session ids
348348
utils::SessionIdType session_id_type{utils::SessionIdType::UUID};
349-
// Timeout in seconds that defines for how long the EVSE allows the ISO charge loop (AC: ChargingStatus, DC: CurrentDemand)
349+
// Timeout in seconds that defines for how long the EVSE allows the ISO charge loop (AC: ChargingStatus, DC:
350+
// CurrentDemand)
350351
int hlc_charge_loop_without_energy_timeout_s{300};
351352
} config_context;
352353

modules/EVSE/EvseManager/scoped_lock_timeout.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ enum class MutexDescription {
2222
Charger_signal_error_cleared,
2323
Charger_mainloop,
2424
Charger_process_event,
25-
Charger_pause_charging,
26-
Charger_resume_charging,
2725
Charger_waiting_for_power,
2826
Charger_resume_power_available,
2927
Charger_cancel_transaction,
@@ -103,10 +101,6 @@ static std::string to_string(MutexDescription d) {
103101
return "Charger.cpp: mainloop";
104102
case MutexDescription::Charger_process_event:
105103
return "Charger.cpp: process_event";
106-
case MutexDescription::Charger_pause_charging:
107-
return "Charger.cpp: pause_charging";
108-
case MutexDescription::Charger_resume_charging:
109-
return "Charger.cpp: resume_charging";
110104
case MutexDescription::Charger_waiting_for_power:
111105
return "Charger.cpp: pause_charging_wait_for_power";
112106
case MutexDescription::Charger_cancel_transaction:

0 commit comments

Comments
 (0)