add:增加上位机交互框架、Flash R/W 框架
This commit is contained in:
@@ -5,7 +5,10 @@ ChargerManager g_charger_manager = {0};
|
||||
|
||||
/*充电桩序列号*/
|
||||
const uint8_t piles_serial[6][7] = {
|
||||
// {0x88, 0x26, 0x01, 0x13, 0x12, 0x00, 0x01},
|
||||
|
||||
{0x32, 0x01, 0x06, 0x01, 0x11, 0x15, 0x58},
|
||||
|
||||
{0x32, 0x01, 0x06, 0x01, 0x11, 0x16, 0x54},
|
||||
{0x88, 0x26, 0x01, 0x13, 0x12, 0x00, 0x01},
|
||||
{0x88, 0x26, 0x01, 0x13, 0x12, 0x00, 0x02},
|
||||
@@ -19,7 +22,7 @@ const uint8_t piles_serial[6][7] = {
|
||||
* @note 初始化充电桩管理器,设置充电桩数量和每个充电桩的初始状态
|
||||
*/
|
||||
void init_chargers(void) {
|
||||
g_charger_manager.charger_count = 6;
|
||||
g_charger_manager.charger_count = MAX_CHARGER_COUNT;
|
||||
|
||||
for (int i = 0; i < g_charger_manager.charger_count; i++) {
|
||||
ChargerPile *ctx = &g_charger_manager.charger_piles[i];
|
||||
@@ -28,7 +31,7 @@ void init_chargers(void) {
|
||||
ctx->get_model = false;
|
||||
ctx->is_udp_online = false;
|
||||
ctx->login_info.charger_type = CHARGER_TYPE_DC;
|
||||
ctx->login_info.gun_num = 2;
|
||||
ctx->login_info.gun_num = MAX_GUN_PER_CHARGER;
|
||||
ctx->login_info.protocol_ver = 0x10; // V1.6
|
||||
strcpy((char*)ctx->login_info.software_ver, "V4.1.50");
|
||||
ctx->login_info.net_conn_type = 0; // SIM
|
||||
@@ -36,10 +39,9 @@ void init_chargers(void) {
|
||||
ctx->login_info.tele_factory = 0x00; // 移动
|
||||
|
||||
// 初始化枪
|
||||
for (int g = 0; g < ctx->login_info.gun_num && g < MAX_GUN_PER_CHARGER; g++) {
|
||||
for (int g = 0; g < ctx->login_info.gun_num; g++) {
|
||||
ctx->guns[g].gun_index = g + 1;
|
||||
ctx->guns[g].status = 0; // 正常
|
||||
ctx->guns[g].real_time_data.status = 0; // 离线
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,7 @@
|
||||
typedef struct
|
||||
{
|
||||
uint8_t gun_index; // 枪索引
|
||||
bool is_changing; // 是否正在充电
|
||||
bool is_plugged; // 是否已插入枪
|
||||
bool is_gun_returned; // 是否已返回枪
|
||||
uint8_t status; // 状态
|
||||
|
||||
PACK_DATA_0X13 real_time_data; // 实时数据
|
||||
} ChargerGun;
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
|
||||
|
||||
|
||||
#define PI 3.1415926f
|
||||
|
||||
#define SOFTWARE_VERSION "JSBRv1.2" // 软件版本
|
||||
@@ -115,6 +118,7 @@
|
||||
|
||||
#define get_sys_time_msec() HAL_GetTick()
|
||||
|
||||
|
||||
#define CONSTRAIN(x, max, min) (x > max ? max : (x < min ? min : x))
|
||||
|
||||
#endif /* __GLOBAL_H */
|
||||
|
||||
Reference in New Issue
Block a user