Add fire alarm support and update firmware version to 1.0.19

- Introduced CONN_ERR_FIRE_ALARM to handle fire alarm conditions in charger control.
- Added CMD_FIRE_ALARM command for external trigger handling in serial control.
- Updated firmware version from 1.0.17 to 1.0.19.
- Integrated fire alarm functionality into the charging loop and command handler.
This commit is contained in:
2026-06-11 15:33:22 +03:00
parent 3037ae2368
commit ac1ce30121
17 changed files with 31668 additions and 31388 deletions
+1
View File
@@ -47,6 +47,7 @@ typedef enum __attribute__((packed)){
CONN_ERR_HOTPLUG = 8, // Коннектор неожиданно отключился
CONN_ERR_EV_COMM = 9, // Ошибка протокола связи с электромобилем
CONN_ERR_PSU_FAULT = 10, // Ошибка PSU
CONN_ERR_FIRE_ALARM = 11, // Пожарная тревога (до перезагрузки)
}CONN_Error_t;
+9
View File
@@ -0,0 +1,9 @@
#ifndef INC_FIRE_ALARM_H_
#define INC_FIRE_ALARM_H_
#include <stdint.h>
uint8_t FireAlarm_IsLatched(void);
void FireAlarm_Activate(void);
#endif /* INC_FIRE_ALARM_H_ */
+1 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
/* USER CODE BEGIN EC */
#define FW_VERSION_MAJOR 1
#define FW_VERSION_MINOR 0
#define FW_VERSION_PATCH 17
#define FW_VERSION_PATCH 19
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
+2
View File
@@ -25,6 +25,8 @@
// Перезагрузка для входа в бутлоадер
#define CMD_DEVICE_RESET 0xB5
// Пожарная тревога (внешний триггер)
#define CMD_FIRE_ALARM 0xB7
// Коды ответов
#define RESP_SUCCESS 0x12
+4 -1
View File
@@ -2,6 +2,7 @@
#include "charger_config.h"
#include "debug.h"
#include "fire_alarm.h"
#include "psu_control.h"
ChargingConnector_t CONN;
@@ -22,7 +23,9 @@ void CONN_Loop(){
CONN.connControl = CMD_NONE;
}
if(PSU0.cont_fault){
if (FireAlarm_IsLatched()) {
CONN.chargingError = CONN_ERR_FIRE_ALARM;
} else if(PSU0.cont_fault){
CONN.chargingError = CONN_ERR_CONTACTOR;
} else if(PSU0.psu_fault){
CONN.chargingError = CONN_ERR_PSU_FAULT;
+20
View File
@@ -0,0 +1,20 @@
#include "fire_alarm.h"
#include "charger_control.h"
#include "debug.h"
#include "serial.h"
static uint8_t fire_alarm_latched = 0;
uint8_t FireAlarm_IsLatched(void) {
return fire_alarm_latched;
}
void FireAlarm_Activate(void) {
if (fire_alarm_latched) {
return;
}
fire_alarm_latched = 1;
log_printf(LOG_ERR, "FIRE ALARM activated\n");
}
+5
View File
@@ -3,6 +3,7 @@
#include "board.h"
#include "charger_control.h"
#include "debug.h"
#include "fire_alarm.h"
#include "psu_control.h"
#include "usart.h"
#include <string.h>
@@ -86,6 +87,10 @@ void SC_CommandHandler(ReceivedCommand_t* cmd) {
// }
response_code = RESP_FAILED;
break;
case CMD_FIRE_ALARM:
FireAlarm_Activate();
response_code = RESP_SUCCESS;
break;
case CMD_DEVICE_RESET:
// 2. Отправляем SUCCESS (хост может успеть получить его перед ребутом)
SC_SendPacket(NULL, 0, RESP_SUCCESS);