experimental esp_hosted implementation

This commit is contained in:
Manuel
2026-04-13 20:26:51 +02:00
parent ff8102e753
commit ad568021ba
12 changed files with 457 additions and 37 deletions
+12 -5
View File
@@ -6,6 +6,9 @@
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_BLUETOOTH
#include "nimble/NimbleBluetooth.h"
#if defined(CONFIG_IDF_TARGET_ESP32P4)
#include "bluetooth/HostedBluetooth.h"
#endif
#endif
#include <MeshtasticOTA.h>
@@ -40,16 +43,20 @@ void setBluetoothEnable(bool enable)
if (config.bluetooth.enabled == true)
#endif
{
if (!nimbleBluetooth) {
nimbleBluetooth = new NimbleBluetooth();
if (!bluetoothApi) {
#if defined(CONFIG_IDF_TARGET_ESP32P4)
bluetoothApi = new HostedBluetooth();
#else
bluetoothApi = new NimbleBluetooth();
#endif
}
if (enable && !nimbleBluetooth->isActive()) {
if (enable && !bluetoothApi->isActive()) {
powerMon->setState(meshtastic_PowerMon_State_BT_On);
nimbleBluetooth->setup();
bluetoothApi->setup();
}
// For ESP32, no way to recover from bluetooth shutdown without reboot
// BLE advertising automatically stops when MCU enters light-sleep(?)
// For deep-sleep, shutdown hardware with nimbleBluetooth->deinit(). Requires reboot to reverse
// For deep-sleep, shutdown hardware with bluetoothApi->deinit(). Requires reboot to reverse
}
}
#else