latest version

This commit is contained in:
2026-03-11 16:49:23 +03:00
parent c2e1460237
commit 2272e6ab76
140 changed files with 125511 additions and 110312 deletions

View File

@@ -10,37 +10,73 @@
#include "main.h"
// Статус
// статус подключения к автомобилю
typedef enum __attribute__((packed)) {
CONN_Initializing = 1,
CONN_Faulted = 2,
CONN_Available = 3,
CONN_Preparing = 4,// to charge
CONN_Charging = 5,
CONN_Finishing = 6,//, waiting to disconnect
CONN_Suspended_EV = 7,
CONN_Suspended_EVSE = 8,
//Reserved
Unknown,
Unplugged,
Disabled,
Preparing,
AuthRequired,
WaitingForEnergy,
ChargingPausedEV,
ChargingPausedEVSE,
Charging,
AuthTimeout,
Finished,
FinishedEVSE,
FinishedEV,
Replugging
} CONN_State_t;
// Управление
// Разрешение на зарядку
typedef enum __attribute__((packed)) {
CHARGING_NOT_ALLOWED = 1,
CHARGING_ALLOWED = 2,
FORCE_UNLOCK = 3,
typedef enum __attribute__((packed)){
CMD_NONE = 0,
CMD_STOP = 1,
CMD_START = 2,
CMD_FORCE_UNLOCK = 3,
CMD_REPLUG = 4,
} CONN_Control_t;
#include "charger_gbt.h"
typedef enum __attribute__((packed)){
CONN_NO_ERROR = 0,
CONN_ERR_INSULATION = 1,
CONN_ERR_EMERGENCY = 2,
CONN_ERR_DOOR_OPEN = 3,
CONN_ERR_LOCK = 4,
CONN_ERR_CONN_TEMP = 5,
} CONN_Error_t;
extern CONN_State_t connectorState;
// Глобальная структура состояния коннектора и зарядки со стороны тачки (EV),
// по возможности совместимая по именам полей с ChargingConnector_t на стороне станции.
typedef struct {
CONN_Control_t connControl; // 0
CONN_State_t connState; // 1
uint8_t SOC; // State of charge [%] // 2
uint32_t Power; // Power [W] // 3..6
uint32_t Energy; // Energy [Wh] // 7..10
uint16_t RequestedVoltage; // 1V/bit
uint16_t RequestedCurrent; // 0.1A/bit
uint16_t MeasuredVoltage; // 1V/bit
uint16_t MeasuredCurrent; // 0.1A/bit
uint16_t MeasuredVoltageSE; // 1V/bit
uint16_t MeasuredCurrentSE; // 0.1A/bit
uint8_t ContactorEnabled; // 1 - enabled, 0 - disabled (команда на замыкание контактора)
CONN_Error_t chargingError; // 0 если ок
uint8_t EvseConnected;
uint32_t ChargingTime; // seconds
uint8_t enableLoad; // 1 - enabled, 0 - disabled (команда на включение контактора)
uint8_t connectorType; // 0 - NONE, 1 - GBT, 2 - CCS (для EV всегда GBT)
} CONN_t;
extern CONN_t CONN;
void CONN_Init();
void CONN_Task();
void CONN_SetState(CONN_State_t state);