Files
BR_YKC/Core/User/Global/g_dcpile.c

62 lines
2.1 KiB
C
Raw Normal View History

2026-05-21 12:19:01 +08:00
/**
******************************************************************************
* @file User\Global\g_dcpile.c
* @author
* @version v0.1
* @date 2026-05-21
* @brief
******************************************************************************
*/
2026-03-31 15:46:04 +08:00
#include "g_dcpile.h"
/*全局充电桩管理器*/
ChargerManager g_charger_manager = {0};
/*充电桩序列号*/
const uint8_t piles_serial[6][7] = {
2026-05-21 10:01:28 +08:00
{0x32, 0x01, 0x06, 0x01, 0x16, 0x92, 0x45},
{0x32, 0x01, 0x06, 0x01, 0x16, 0x92, 0x44},
{0x32, 0x01, 0x06, 0x01, 0x16, 0x92, 0x43},
{0x32, 0x01, 0x06, 0x01, 0x16, 0x92, 0x42},
2026-03-31 15:46:04 +08:00
{0x32, 0x01, 0x06, 0x01, 0x11, 0x15, 0x58},
2026-05-21 10:01:28 +08:00
{0x32, 0x01, 0x06, 0x01, 0x11, 0x15, 0x54},
2026-03-31 15:46:04 +08:00
};
/**
2026-05-21 12:19:01 +08:00
* @brief init_chargers
2026-03-31 15:46:04 +08:00
* @note
2026-05-21 12:19:01 +08:00
* @retval none
2026-03-31 15:46:04 +08:00
*/
2026-05-21 10:01:28 +08:00
void init_chargers(void)
{
g_charger_manager.charger_count = MAX_CHARGER_COUNT;
2026-03-31 15:46:04 +08:00
2026-05-21 10:01:28 +08:00
for (int i = 0; i < g_charger_manager.charger_count; i++)
{
2026-03-31 15:46:04 +08:00
ChargerPile *ctx = &g_charger_manager.charger_piles[i];
2026-05-21 10:01:28 +08:00
memcpy(ctx->charger_serial, piles_serial[i], CHARGER_SERIAL_LENGTH);
memcpy(ctx->login_info.charger_serial, piles_serial[i], CHARGER_SERIAL_LENGTH);
2026-03-31 15:46:04 +08:00
ctx->get_model = false;
ctx->is_udp_online = false;
2026-05-21 10:01:28 +08:00
ctx->step = 0;
ctx->step_tick = 0;
2026-03-31 15:46:04 +08:00
ctx->login_info.charger_type = CHARGER_TYPE_DC;
ctx->login_info.gun_num = MAX_GUN_PER_CHARGER;
2026-03-31 15:46:04 +08:00
ctx->login_info.protocol_ver = 0x10; // V1.6
2026-05-21 10:01:28 +08:00
strcpy((char *)ctx->login_info.software_ver, "V4.1.50");
2026-03-31 15:46:04 +08:00
ctx->login_info.net_conn_type = 0; // SIM
memset(ctx->login_info.sim, 0, 10);
ctx->login_info.tele_factory = 0x00; // 移动
// 初始化枪
2026-05-21 10:01:28 +08:00
for (int g = 0; g < ctx->login_info.gun_num; g++)
{
2026-03-31 15:46:04 +08:00
ctx->guns[g].gun_index = g + 1;
2026-05-21 10:01:28 +08:00
ctx->guns[g].gun_step = 0;
ctx->guns[g].gun_step_tick = 0;
ctx->guns[g].real_time_data.status = 0; // 离线
2026-03-31 15:46:04 +08:00
}
}
}