From f78a1f3a1a1b1be2c48a94b5de2484cdb8adabac Mon Sep 17 00:00:00 2001 From: anschrammh Date: Mon, 18 Dec 2023 21:20:57 +0100 Subject: [PATCH] Updated the notification callback logic --- src/W800_SDK_v1.00.10/app/gfx/gfx_task.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/W800_SDK_v1.00.10/app/gfx/gfx_task.c b/src/W800_SDK_v1.00.10/app/gfx/gfx_task.c index 970b1df..25a7bca 100644 --- a/src/W800_SDK_v1.00.10/app/gfx/gfx_task.c +++ b/src/W800_SDK_v1.00.10/app/gfx/gfx_task.c @@ -524,7 +524,7 @@ static void ble_service_nus_data_rx_cb(const uint8_t *data, uint16_t length) gadget_bridge_parser_feed((const char *)data, length); while(gadget_bridge_parser_run() == GADGET_BRIDGE_PARSER_CODE_PARSING); } -static uint32_t bt_ctrl_sleep_ms = 0; + static void ble_service_state_change_cb(ble_service_state_e ble_service_state) { switch(ble_service_state) @@ -537,7 +537,7 @@ static void ble_service_state_change_cb(ble_service_state_e ble_service_state) ble_service_update_connection_parameters( 84, // itvl_min 105 ms 120, // itvl_max 150 ms - 5, // latency 5 + 2, // latency 2 1000, // supervision timeout 10 s 0x0010, // min connection event length 10 ms 0x0300 // max connection event length 480 ms @@ -656,7 +656,7 @@ static void sendMusicPlaybackBLECommandCb(MusicPlaybackCtrlAction_e musicPlaybac gadget_bridge_send_music_control(musicPlaybackCtrlAction); } -static void notification_on_state_change_cb(NotificationState_e notificationState) +static void notification_on_state_change_cb(NotificationState_e notificationState, uint32_t notification_handle) { switch (notificationState) { @@ -669,6 +669,9 @@ static void notification_on_state_change_cb(NotificationState_e notificationStat case NOTIFICATION_STATE_CLEARED: // Let's restore MCU clocks to it's default watch_power_management_restore_default_cpu_clocks(true, true); + + // Don't forget to tell GadgetBridge that the notification was dismissed + gadget_bridge_send_notification_action(GADGET_BRIDGE_NOTIFICATION_ACTION_DISMISS, notification_handle, NULL, NULL); default: break; }