latest version

This commit is contained in:
2026-01-19 15:11:05 +03:00
parent 5ea401f34d
commit 9830ece932
26 changed files with 21459 additions and 21183 deletions

View File

@@ -7,6 +7,7 @@
#ifndef INC_CHARGER_GBT_H_
#define INC_CHARGER_GBT_H_
#include "main.h"
#include "connector.h"
@@ -23,6 +24,13 @@
#define GBT_CST_CURRENT_MISMATCH 0x0000F0F1 // Неправильный ток
#define GBT_CST_ABNORMALVOLTAGEERROR 0x0000F0F4 // Ненормальное напряжение
typedef enum {
GBT_STOP_EVSE = 0,
GBT_STOP_EV = 1,
GBT_STOP_OCPP = 2,
}GBT_StopSource_t;
typedef enum{
GBT_CC_UNKNOWN,
@@ -33,6 +41,16 @@ typedef enum{
}gbtCcState_t;
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;
typedef enum{
GBT_DISABLED = 0x10,
// GBT_S0_UNCONNECTED = 0x10, //СС1 12V/6V СС2 12V
@@ -54,12 +72,6 @@ typedef enum{
}gbtState_t;
typedef enum __attribute__((packed)){
GBT_ERR_OKAY = 0,
GBT_ERR_INSULATION = 1,
}GBT_Error_t;
#pragma pack(push, 1)
typedef struct {
@@ -165,6 +177,7 @@ typedef struct {
uint8_t chargingElapsedTimeSec; //
CONN_State_t connectorState;
CONN_Error_t outputError; // 0 if okay
}GBT_EDCAN_Output_t;
@@ -175,7 +188,7 @@ typedef struct {
uint16_t measuredCurrent; // 0.1A/bit
CONN_Control_t chargeControl;
GBT_Error_t chargingError; // 0 if okay
CONN_Error_t chargingError; // 0 if okay
}GBT_EDCAN_Input_t;
@@ -223,10 +236,15 @@ extern uint8_t GBT_BRO;
extern uint8_t GBT_Charger_Enable;
extern GBT_StopSource_t GBT_StopSource;
void GBT_Init();
void GBT_Start();
void GBT_Reset();
void GBT_Stop(uint32_t causecode);
//void GBT_Stop(uint32_t causecode);
void GBT_StopEV(uint32_t causecode);
void GBT_StopEVSE(uint32_t causecode);
void GBT_StopOCPP(uint32_t causecode);
void GBT_ForceStop();
void GBT_ChargerTask();
void GBT_Error(uint32_t errorcode);

View File

@@ -5,24 +5,32 @@
* Author: colorbass
*/
#ifndef INC_LOCK_H_
#define INC_LOCK_H_
#include "main.h"
#include "stdbool.h"
void GBT_Lock(uint8_t state);
void GBT_ManageLock();
uint8_t GBT_LockGetState();
void GBT_ForceLock(uint8_t state);
typedef struct {
// uint8_t state;
uint8_t demand;
uint8_t error;
} GBT_LockState_t;
extern GBT_LockState_t GBT_LockState;
#endif /* INC_LOCK_H_ */
#ifndef INC_LOCK_H_
#define INC_LOCK_H_
#include "main.h"
#include "stdbool.h"
void GBT_Lock(uint8_t state);
void GBT_ManageLockSolenoid();
void GBT_ManageLockMotor();
uint8_t GBT_LockGetState();
void GBT_ForceLock(uint8_t state);
void GBT_ResetErrorTimeout();
typedef struct {
// uint8_t state;
uint8_t demand;
uint8_t error;
uint8_t action_requested; // 0 = unlock, 1 = lock, 255 = no action
uint8_t motor_state; // 0 = idle, 1 = motor_on, 2 = waiting_off
uint32_t last_action_time; // время последнего изменения состояния мотора
uint8_t retry_count; // счетчик попыток
uint32_t error_tick; // время установки ошибки (для таймаута сброса)
} GBT_LockState_t;
extern GBT_LockState_t GBT_LockState;
#endif /* INC_LOCK_H_ */