intermediate version

This commit is contained in:
2024-11-15 19:31:10 +03:00
parent 5b424697c7
commit 5ea401f34d
176 changed files with 21963 additions and 20712 deletions

55
Core/Inc/charger_gbt.h Normal file → Executable file
View File

@@ -10,18 +10,18 @@
#include "main.h"
#include "connector.h"
#define GBT_CST_NO_REASON 0x0000F0F0
#define GBT_CST_CONDITION_REACHED 0x0100F0F0 // заряд завершен
#define GBT_CST_SUSPENDS_ARTIFICIALLY 0x0400F0F0
#define GBT_CST_FAULT_SUSPENSION 0x1000F0F0
#define GBT_CST_BMS_ACTIVELY_SUSPENDS 0x4000F0F0 //завершение по инициативе BMS
#define GBT_CST_CONNECTOR_OVER_TEMP 0x0001F0F0
#define GBT_CST_INT_PART_OVER_TEMP 0x0010F0F0
#define GBT_CST_CANNOT_SUPPLY_REQ_ELQ 0x0040F0F0
#define GBT_CST_SUDDENSTOP 0x0000F1F0
#define GBT_CST_OTHERFALUT 0x0000F4F0
#define GBT_CST_CURRENT_MISMATCH 0x0000F0F1
#define GBT_CST_ABNORMALVOLTAGEERROR 0x0000F0F4
#define GBT_CST_NO_REASON 0x0000F0F0 // Без причины
#define GBT_CST_CONDITION_REACHED 0x0100F0F0 // Заряд завершен
#define GBT_CST_SUSPENDS_ARTIFICIALLY 0x0400F0F0 // Искуственная остановка
#define GBT_CST_FAULT_SUSPENSION 0x1000F0F0 // Приостановка из за неисправности
#define GBT_CST_BMS_ACTIVELY_SUSPENDS 0x4000F0F0 // завершение по инициативе BMS
#define GBT_CST_CONNECTOR_OVER_TEMP 0x0001F0F0 // Перегрев коннектора
#define GBT_CST_INT_PART_OVER_TEMP 0x0010F0F0 // Перегрев внутренних частей
#define GBT_CST_CANNOT_SUPPLY_REQ_ELQ 0x0040F0F0 // Неполучится обеспечить столько энергии
#define GBT_CST_SUDDENSTOP 0x0000F1F0 // Внезапная остановка
#define GBT_CST_OTHERFALUT 0x0000F4F0 // Прочая ошибка
#define GBT_CST_CURRENT_MISMATCH 0x0000F0F1 // Неправильный ток
#define GBT_CST_ABNORMALVOLTAGEERROR 0x0000F0F4 // Ненормальное напряжение
typedef enum{
@@ -39,22 +39,28 @@ typedef enum{
// GBT_S1_CONNECTED = 0x11, //СС1 4V СС2 4V (6V)
// GBT_S2_LOCKED = 0x12, //
GBT_S3_STARTED = 0x13, // 12V AUX
GBT_S4_ISOTEST = 0x14, // testing isolation, send CHM receive BHM
GBT_S5_BAT_INFO = 0x15, // identifying BMS, send CRM receive BRM (long)
GBT_S6_BAT_STAT = 0x16, // send CRM(AA), receive BCP (long)
GBT_S7_BMS_WAIT = 0x17, // wait for BMS, send CTS+CML receive BRO(00), next BRO(AA)
GBT_S8_INIT_CHARGER = 0x18,// starting power modules, send CRO(00)
GBT_S9_WAIT_BCL = 0x19, // waiting for BCL (requested voltage), send CRO(00)
GBT_S10_CHARGING = 0x20, // charging, contactor ON, send CCS, receiving BCL+BCS+BSM
GBT_STOP = 0x21, // normal stop
GBT_STOP_CSD = 0x22, // normal stop
GBT_ERROR = 0x23, // Error
GBT_COMPLETE = 0x24,
GBT_S31_WAIT_BHM = 0x14, // testing isolation, send CHM receive BHM
GBT_S4_ISOTEST = 0x15, // testing isolation, send CHM receive BHM
GBT_S5_BAT_INFO = 0x16, // identifying BMS, send CRM receive BRM (long)
GBT_S6_BAT_STAT = 0x17, // send CRM(AA), receive BCP (long)
GBT_S7_BMS_WAIT = 0x18, // wait for BMS, send CTS+CML receive BRO(00), next BRO(AA)
GBT_S8_INIT_CHARGER = 0x19,// starting power modules, send CRO(00)
GBT_S9_WAIT_BCL = 0x20, // waiting for BCL (requested voltage), send CRO(00)
GBT_S10_CHARGING = 0x21, // charging, contactor ON, send CCS, receiving BCL+BCS+BSM
GBT_STOP = 0x22, // normal stop
GBT_STOP_CSD = 0x23, // normal stop
GBT_ERROR = 0x24, // Error
GBT_COMPLETE = 0x25,
}gbtState_t;
#pragma pack(push, 1)
typedef enum __attribute__((packed)){
GBT_ERR_OKAY = 0,
GBT_ERR_INSULATION = 1,
}GBT_Error_t;
#pragma pack(push, 1)
typedef struct {
uint16_t maxOutputVoltage;
@@ -169,6 +175,7 @@ typedef struct {
uint16_t measuredCurrent; // 0.1A/bit
CONN_Control_t chargeControl;
GBT_Error_t chargingError; // 0 if okay
}GBT_EDCAN_Input_t;