forked from gary/BCU
2
0
Fork 0

add mqtt json data -- currentPack and totalPack

This commit is contained in:
Carl 2025-04-23 16:14:13 +08:00
parent 05bd93a399
commit 11589be1dd
4 changed files with 158 additions and 6951 deletions

View File

@ -62,6 +62,7 @@ void task_100ms_handler(uint32_t base_time)
bms_poll_run_status(base_time);
bms_poll_sop(base_time);
bms_poll_soh(base_time);
task_mqtt_handler(base_time);
is_first_run = true;
}
@ -132,6 +133,8 @@ void poll_1ms_task_init(void)
// KIT_PRINTF("signal init ok \r\n");
KIT_SET_BIT_MASK_32(is_data_ok, SIGNAL_FINISH_BIT);
bsp_create_task(&ord_ctrl_task, (uint8_t *)"ctrl");
poll_mqtt_init();
}
void poll_10ms_task_init(void)

File diff suppressed because it is too large Load Diff

View File

@ -850,8 +850,6 @@ const devCellPointMap bms_temp_points[] =
const int bms_volt_count = sizeof(bms_volt_points) / sizeof(devCellPointMap);
const int bms_temp_count = sizeof(bms_temp_points) / sizeof(devCellPointMap);
void protocol_build_json(uint16_t groupId)
{
int val = 0;
@ -871,6 +869,8 @@ void protocol_build_json(uint16_t groupId)
cJSON_AddStringToObject(deviceObj, "devName", "BCU");
cJSON_AddStringToObject(deviceObj, "devId", "001");
cJSON_AddStringToObject(deviceObj, "sn", "SN123456");
cJSON_AddNumberToObject(deviceObj, "currentPack", groupId); // 当前包数
cJSON_AddNumberToObject(deviceObj, "totalPack", 16); //总包数
// 构建 data 对象
cJSON* dataObj = cJSON_CreateObject();
@ -926,6 +926,8 @@ void protocol_build_volt_json(uint8_t i)
cJSON_AddStringToObject(deviceObj, "devName", "BCU");
cJSON_AddStringToObject(deviceObj, "devId", "001");
cJSON_AddStringToObject(deviceObj, "sn", "SN123456");
cJSON_AddNumberToObject(deviceObj, "currentPack", i + 3); // 当前包数
cJSON_AddNumberToObject(deviceObj, "totalPack", 16); // 总包数
// 构建 data 对象
cJSON* dataObj = cJSON_CreateObject();
@ -978,6 +980,8 @@ void protocol_build_temp_json(uint8_t i)
cJSON_AddStringToObject(deviceObj, "devName", "BCU");
cJSON_AddStringToObject(deviceObj, "devId", "001");
cJSON_AddStringToObject(deviceObj, "sn", "SN123456");
cJSON_AddNumberToObject(deviceObj, "currentPack", i + 14); // 当前包数
cJSON_AddNumberToObject(deviceObj, "totalPack", 16); // 总包数
// 构建 data 对象
cJSON* dataObj = cJSON_CreateObject();

View File

@ -192,11 +192,11 @@ uint8_t drv_qfc41d_init(void)
//设置接收回调函数
drv_uart_set_interrupt(QFC41D_UART_PORT, kUartInterrupt_Rx, APP_CFG_INT_PRIO_UART2_RX, drv_qf41d_uart_rx_it_call);//#define SIM_UART_PORT kUartDev_2
//³õʼ»¯wifi
if(drv_wifi_init() != 0)
{
return 1;
}
//³õʼ»¯wifi
if(drv_wifi_init() != 0)
{
return 1;
}
/* 蓝牙预留
//初始化蓝牙BLE