From 63e96050651e6834121c005ca7c5dcffc92c53f1 Mon Sep 17 00:00:00 2001 From: zwsd Date: Thu, 21 Jul 2022 17:18:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E9=94=99=E8=AF=AF=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=90=8D=EF=BC=8C=E5=87=BD=E6=95=B0=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/main.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/main/main.c b/main/main.c index 09b87fe..c46ae9f 100644 --- a/main/main.c +++ b/main/main.c @@ -13,13 +13,12 @@ #define MAIN_TAG "MAIN" static char bluetooth_tx_buffer[profile_b_buffer_size] = {0}; - -char bluetooth_rx_buffer[profile_b_buffer_size] = {0}; +static char bluetooth_rx_buffer[profile_b_buffer_size] = {0}; void receipt_json_set_position(); void receipt_json_get_status(); -void bluetooth_rx_buffer_format_receipt(); -void bluetooth_rx_buffer_send_indicate(); +void bluetooth_auto_report_format_receipt(); +void bluetooth_tx_buffer_send_indicate(); void string_copy_by_num(char *dest, const char *src, uint8_t count, uint8_t num); bluetooth_processer_t s_bluetooth_processer = { @@ -53,12 +52,12 @@ bluetooth_processer_t s_bluetooth_processer = { void app_main(void) { constructor_bluetooth_processer(&s_bluetooth_processer); - bluetooth_rx_buffer_format_receipt(); + bluetooth_auto_report_format_receipt(); ble_spp_server_demo_app_main(&s_bluetooth_processer); timer_group_init(TIMER_GROUP_0, TIMER_0, false, timer_group0_interval_num, timer_interval_ms); while (true) { if (s_bluetooth_processer.table_handle_m != 0) { - bluetooth_rx_buffer_send_indicate(); + bluetooth_tx_buffer_send_indicate(); } bluetooth_gatts_try_process_data(); if (s_bluetooth_processer.auto_report_flag) { @@ -126,12 +125,12 @@ void receipt_json_get_status() { cJSON_Delete(pRoot); } -void bluetooth_rx_buffer_format_receipt() { +void bluetooth_auto_report_format_receipt() { sprintf(bluetooth_tx_buffer, "{ \"order\": \"receipt\", \"index\": %d, \"speedLevel\": %d, \"position\": %.2lf, \"direction\": %d }", // s_bluetooth_processer.index, s_bluetooth_processer.speedLevel, s_bluetooth_processer.position, s_bluetooth_processer.direction); } -void bluetooth_rx_buffer_send_indicate() { +void bluetooth_tx_buffer_send_indicate() { char temp_buffer[20] = {0}; uint8_t temp_lenght = 0; uint8_t temp_count_total = 0;