From: dxy <1731678236qq.com> Date: Mon, 13 Oct 2025 06:55:33 +0000 (+0800) Subject: 优化变量名的问题 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=dbf29ac972475169adfa754dd3fa383d1abad446;p=mirrors%2F7PIN_V1_5_Jl_SDK.git 优化变量名的问题 --- diff --git a/2.code/1.sdk/apps/BK_app/BK_drive/bk_uart.c b/2.code/1.sdk/apps/BK_app/BK_drive/bk_uart.c index 21d70a3..fafa592 100644 --- a/2.code/1.sdk/apps/BK_app/BK_drive/bk_uart.c +++ b/2.code/1.sdk/apps/BK_app/BK_drive/bk_uart.c @@ -1395,17 +1395,17 @@ int parse_uart_data(char *json_string) cJSON *data = cJSON_GetObjectItemCaseSensitive(root, "data"); if (cJSON_IsObject(data)) { // 从data对象中获取"switch_bt_state"字段 - cJSON *switch_bt_state = cJSON_GetObjectItemCaseSensitive(data, "switch_ble_state"); - if (cJSON_IsString(switch_bt_state) && (switch_bt_state->valuestring != NULL)) { - printf("蓝牙广播状态: %s\n", switch_bt_state->valuestring); - if (strcmp(switch_bt_state->valuestring, "1") == 0) { + cJSON *switch_ble_js = cJSON_GetObjectItemCaseSensitive(data, "switch_ble_state"); + if (cJSON_IsString(switch_bt_state) && (switch_ble_js->valuestring != NULL)) { + printf("蓝牙广播状态: %s\n", switch_ble_js->valuestring); + if (strcmp(switch_ble_js->valuestring, "1") == 0) { get_ble_switch=1; ack_flag=1; switch_ble_state=1; bk_app_send_smg(SWITCH_BLE_STATE,(char *)&switch_ble_state,1); // set_adv_flag_fun(1) ;//开始蓝牙广播 - }else if (strcmp(switch_bt_state->valuestring, "0") == 0) + }else if (strcmp(switch_ble_js->valuestring, "0") == 0) { get_ble_switch = 1; ack_flag=1;