Skip to content

Commit e5426a2

Browse files
committed
When switching from State B to C, make sure pilot is at 6V for at least 500ms. Fixes dingo35#40
1 parent 5fbd969 commit e5426a2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

SmartEVSE-3/src/evse.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,7 @@ void EVSEStates(void * parameter) {
19671967
//uint8_t n;
19681968
uint8_t leftbutton = 5;
19691969
uint8_t DiodeCheck = 0;
1970-
1970+
uint16_t StateTimer = 0; // When switching from State B to C, make sure pilot is at 6v for 100ms
19711971

19721972
// infinite loop
19731973
while(1) {
@@ -2084,8 +2084,8 @@ void EVSEStates(void * parameter) {
20842084
if (pilot == PILOT_12V) { // Disconnected?
20852085
setState(STATE_A); // switch to STATE_A
20862086

2087-
} else if (pilot == PILOT_6V) {
2088-
2087+
} else if (pilot == PILOT_6V && ++StateTimer > 50) { // When switching from State B to C, make sure pilot is at 6V for at least 500ms
2088+
// Fixes https://github.com/dingo35/SmartEVSE-3.5/issues/40
20892089
if ((DiodeCheck == 1) && (ErrorFlags == NO_ERROR) && (ChargeDelay == 0)) {
20902090
if (EVMeter && ResetKwh) {
20912091
EnergyMeterStart = EnergyEV; // store kwh measurement at start of charging.
@@ -2117,8 +2117,9 @@ void EVSEStates(void * parameter) {
21172117
}
21182118

21192119
// PILOT_9V
2120-
} else {
2120+
} else if (pilot == PILOT_9V) {
21212121

2122+
StateTimer = 0; // Reset State B->C transition timer
21222123
if (ActivationMode == 0) {
21232124
setState(STATE_ACTSTART);
21242125
ActivationTimer = 3;

0 commit comments

Comments
 (0)