Update version to 1.0.4. Everest timeout flood fixed

This commit is contained in:
raduet
2026-03-25 17:19:50 +03:00
parent fad2a8ba18
commit 878d425417
6 changed files with 17222 additions and 17127 deletions

View File

@@ -43,7 +43,7 @@ extern "C" {
/* USER CODE BEGIN EC */
#define FW_VERSION_MAJOR 0x01
#define FW_VERSION_MINOR 0x00
#define FW_VERSION_PATCH 0x03
#define FW_VERSION_PATCH 0x04
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/

View File

@@ -40,6 +40,8 @@ static uint8_t enabled = 0;
static uint8_t pwm_duty_percent = 100;
uint8_t isolation_enable = 0;
static uint32_t last_host_seen = 0;
static uint8_t everest_timed_out = 0;
static uint32_t last_everest_timeout_log_tick = 0;
static CP_State_t cp_state_buffer = EV_STATE_ACQUIRING;
CCS_State_t CCS_State;
@@ -179,8 +181,23 @@ void CCS_SerialLoop(void) {
break;
}
if (last_host_seen > 0 && (HAL_GetTick() - last_host_seen) > EVEREST_TIMEOUT_MS) {
// If Everest timeout happened, keep safe-state and limit log frequency.
// The safe-state must remain until we receive a valid packet from the host.
if (everest_timed_out) {
if (last_everest_timeout_log_tick == 0 ||
(HAL_GetTick() - last_everest_timeout_log_tick) >= EVEREST_TIMEOUT_MS) {
log_printf(LOG_ERR, "Everest timeout\n");
last_everest_timeout_log_tick = HAL_GetTick();
}
CONN.EnableOutput = 0;
CCS_EvseState = Unknown;
CP_SetDuty(100);
} else if (last_host_seen > 0 && (HAL_GetTick() - last_host_seen) > EVEREST_TIMEOUT_MS) {
log_printf(LOG_ERR, "Everest timeout\n");
everest_timed_out = 1;
last_host_seen = HAL_GetTick(); // reset after the first timeout
last_everest_timeout_log_tick = HAL_GetTick();
CONN.EnableOutput = 0;
CCS_EvseState = Unknown;
CP_SetDuty(100);
@@ -328,6 +345,8 @@ static uint16_t expected_payload_len(uint8_t cmd) {
static void apply_command(uint8_t cmd, const uint8_t* payload, uint16_t payload_len) {
(void)payload_len;
last_host_seen = HAL_GetTick();
everest_timed_out = 0;
last_everest_timeout_log_tick = 0;
switch (cmd) {
case CMD_E2M_PWM_DUTY: {
const e2m_pwm_duty_t* p = (const e2m_pwm_duty_t*)payload;