Reset timestamps when leaving their state
This commit is contained in:
parent
838c6195bb
commit
9355595b73
|
@ -79,6 +79,7 @@ TSState ts_sm_update_precharge() {
|
||||||
if (precharge_95_reached_timestamp == 0) {
|
if (precharge_95_reached_timestamp == 0) {
|
||||||
precharge_95_reached_timestamp = now;
|
precharge_95_reached_timestamp = now;
|
||||||
} else if (now - precharge_95_reached_timestamp >= PRECHARGE_95_DURATION) {
|
} else if (now - precharge_95_reached_timestamp >= PRECHARGE_95_DURATION) {
|
||||||
|
precharge_95_reached_timestamp = 0;
|
||||||
return TS_ACTIVE;
|
return TS_ACTIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +99,7 @@ TSState ts_sm_update_error() {
|
||||||
if (no_error_since == 0) {
|
if (no_error_since == 0) {
|
||||||
no_error_since = now;
|
no_error_since = now;
|
||||||
} else if (now - no_error_since > NO_ERROR_TIME) {
|
} else if (now - no_error_since > NO_ERROR_TIME) {
|
||||||
|
no_error_since = 0;
|
||||||
return TS_INACTIVE;
|
return TS_INACTIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue