diff --git a/project/ble_peripheral/ble_app_bladder_patch/main.c b/project/ble_peripheral/ble_app_bladder_patch/main.c index 9976f18..2beed84 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/main.c +++ b/project/ble_peripheral/ble_app_bladder_patch/main.c @@ -616,9 +616,6 @@ static void nus_data_handler(ble_nus_evt_t * p_evt) { if (p_evt->type == BLE_NUS_EVT_RX_DATA) { - cmd_type_t = CMD_BLE; - ble_got_new_data = true; - /* Central may have increased connection interval; re-request fast interval (once per 30s) */ { static uint32_t last_update_tick = 0; @@ -1070,6 +1067,7 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) disc_reason, unintended_disc ? " [UNINTENDED]" : ""); ble_connection_st = 0; + pending_cmd_len = 0; // Clear pending command buffer m_conn_handle = BLE_CONN_HANDLE_INVALID; m_tx_in_progress = false; @@ -1100,12 +1098,13 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) case BLE_GAP_EVT_CONNECTED: DBG_PRINTF("[BLE] Connected\r\n"); - -#if FEATURE_SECURE_CONNECTION - ble_connection_st = 1; + +#if BLE_DEV_MODE + /* Dev: no passkey/SEC — allow NUS TX/RX as soon as GAP is up (prod uses PM_EVT_CONN_SEC_SUCCEEDED). */ + ble_connection_st = BLE_CONNECTED_ST; battery_timer_start(); #endif - + m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle); APP_ERROR_CHECK(err_code);