forked from achamaikin/CCSModuleSW30Web
Update version to 1.0.4. Everest timeout flood fixed
This commit is contained in:
@@ -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 ------------------------------------------------------------*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,15 @@
|
||||
../Drivers/CMSIS/Include/core_cm3.h:1762:34:__NVIC_SystemReset 1
|
||||
../Core/Src/serial.c:52:6:CCS_RxEventCallback 4
|
||||
../Core/Src/serial.c:62:6:CCS_SerialLoop 41
|
||||
../Core/Src/serial.c:207:6:CCS_Init 1
|
||||
../Core/Src/serial.c:219:17:crc16_ibm 4
|
||||
../Core/Src/serial.c:234:17:CCS_BuildPacket 4
|
||||
../Core/Src/serial.c:250:13:CCS_SendPacket 2
|
||||
../Core/Src/serial.c:258:13:CCS_SendResetReason 1
|
||||
../Core/Src/serial.c:262:6:CCS_SendEmergencyStop 1
|
||||
../Core/Src/serial.c:266:6:CCS_SendStart 1
|
||||
../Core/Src/serial.c:270:13:CCS_CalculateEnergy 2
|
||||
../Core/Src/serial.c:285:13:send_state 2
|
||||
../Core/Src/serial.c:312:17:expected_payload_len 11
|
||||
../Core/Src/serial.c:328:13:apply_command 13
|
||||
../Core/Src/serial.c:395:16:process_received_packet 6
|
||||
../Core/Src/serial.c:54:6:CCS_RxEventCallback 4
|
||||
../Core/Src/serial.c:64:6:CCS_SerialLoop 44
|
||||
../Core/Src/serial.c:224:6:CCS_Init 1
|
||||
../Core/Src/serial.c:236:17:crc16_ibm 4
|
||||
../Core/Src/serial.c:251:17:CCS_BuildPacket 4
|
||||
../Core/Src/serial.c:267:13:CCS_SendPacket 2
|
||||
../Core/Src/serial.c:275:13:CCS_SendResetReason 1
|
||||
../Core/Src/serial.c:279:6:CCS_SendEmergencyStop 1
|
||||
../Core/Src/serial.c:283:6:CCS_SendStart 1
|
||||
../Core/Src/serial.c:287:13:CCS_CalculateEnergy 2
|
||||
../Core/Src/serial.c:302:13:send_state 2
|
||||
../Core/Src/serial.c:329:17:expected_payload_len 11
|
||||
../Core/Src/serial.c:345:13:apply_command 13
|
||||
../Core/Src/serial.c:414:16:process_received_packet 6
|
||||
|
||||
Reference in New Issue
Block a user