优化变量名的问题
authordxy <1731678236qq.com>
Mon, 13 Oct 2025 06:55:33 +0000 (14:55 +0800)
committerdxy <1731678236qq.com>
Mon, 13 Oct 2025 06:55:33 +0000 (14:55 +0800)
2.code/1.sdk/apps/BK_app/BK_drive/bk_uart.c

index 21d70a3..fafa592 100644 (file)
@@ -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;