Disable BLE Client role to save space

This commit is contained in:
Links2004 2025-09-20 12:02:15 +02:00
parent 40f897fa4a
commit bc9a3d5093
No known key found for this signature in database
GPG Key ID: 68FB9F01C0C482FC
2 changed files with 15 additions and 0 deletions

View File

@ -33,6 +33,7 @@ build_flags =
-DCONFIG_BT_NIMBLE_ENABLED -DCONFIG_BT_NIMBLE_ENABLED
-DNIMBLE_TWO -DNIMBLE_TWO
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2 -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
-DCONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20 -DCONFIG_BT_NIMBLE_MAX_CCCDS=20
-DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=8192 -DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=8192
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING

View File

@ -310,10 +310,24 @@ int NimbleBluetooth::getRssi()
if (bleServer && isConnected()) { if (bleServer && isConnected()) {
auto service = bleServer->getServiceByUUID(MESH_SERVICE_UUID); auto service = bleServer->getServiceByUUID(MESH_SERVICE_UUID);
uint16_t handle = service->getHandle(); uint16_t handle = service->getHandle();
#ifdef CONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED
if (handle == BLE_HS_CONN_HANDLE_NONE) {
return 0;
}
int8_t rssi = 0;
int rc = ble_gap_conn_rssi(handle, &rssi);
if (rc != 0) {
return 0;
}
return rssi;
#else
#ifdef NIMBLE_TWO #ifdef NIMBLE_TWO
return NimBLEDevice::getClientByHandle(handle)->getRssi(); return NimBLEDevice::getClientByHandle(handle)->getRssi();
#else #else
return NimBLEDevice::getClientByID(handle)->getRssi(); return NimBLEDevice::getClientByID(handle)->getRssi();
#endif
#endif #endif
} }
return 0; // FIXME figure out where to source this return 0; // FIXME figure out where to source this