idf 4.3.1蓝牙驱动函数代码报错, 写的极不合理
Posted: Fri Dec 03, 2021 7:26 am
编译出错:
D:/ESP32/esp-idf-4.3.1/components/bt/host/bluedroid/stack/smp/smp_act.c: In function 'smp_fast_conn_param':
D:/ESP32/esp-idf-4.3.1/components/bt/host/bluedroid/stack/smp/smp_act.c:1548:5: error: 'else' without a previous 'if'
else {
^~~~
检查源代码是下面这样的,看来这个程序员水平不咋的。
D:/ESP32/esp-idf-4.3.1/components/bt/host/bluedroid/stack/smp/smp_act.c: In function 'smp_fast_conn_param':
D:/ESP32/esp-idf-4.3.1/components/bt/host/bluedroid/stack/smp/smp_act.c:1548:5: error: 'else' without a previous 'if'
else {
^~~~
检查源代码是下面这样的,看来这个程序员水平不咋的。
- /*******************************************************************************
- ** Function smp_fast_conn_param
- ** Description apply default connection parameter for pairing process
- *******************************************************************************/
- void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
- {
- #if (BT_MULTI_CONNECTION_ENBALE == FALSE)
- if(p_cb->role == BTM_ROLE_MASTER) {
- L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
- }
- #endif
- #if (SMP_SLAVE_CON_PARAMS_UPD_ENABLE == TRUE)
- else {
- tBTM_SEC_DEV_REC *p_rec = btm_find_dev (p_cb->pairing_bda);
- if(p_rec && p_rec->ble.skip_update_conn_param) {
- //do nothing
- return;
- }
- /* Disable L2CAP connection parameter updates while bonding since
- some peripherals are not able to revert to fast connection parameters
- during the start of service discovery. Connection paramter updates
- get enabled again once service discovery completes. */
- #if (BT_MULTI_CONNECTION_ENBALE == FALSE)
- L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
- #endif
- }
- #endif
- }