This commit is contained in:
Ben Meadors 2022-08-17 12:00:53 -05:00
parent 0c08d7c3dc
commit 01a1f40ad2
3 changed files with 10 additions and 20 deletions

View File

@ -21,20 +21,9 @@ void getMacAddr(uint8_t *dmac)
assert(esp_efuse_mac_get_default(dmac) == ESP_OK);
}
/*
static void printBLEinfo() {
int dev_num = esp_ble_get_bond_device_num();
esp_ble_bond_dev_t *dev_list = (esp_ble_bond_dev_t *)malloc(sizeof(esp_ble_bond_dev_t) * dev_num);
esp_ble_get_bond_device_list(&dev_num, dev_list);
for (int i = 0; i < dev_num; i++) {
// esp_ble_remove_bond_device(dev_list[i].bd_addr);
}
} */
void setBluetoothEnable(bool on) {
if (!isWifiAvailable()) {
if (!isWifiAvailable() && config.bluetooth.enabled == true) {
if (!nimbleBluetooth) {
nimbleBluetooth = new NimbleBluetooth();
}
@ -114,7 +103,6 @@ Periodic axpDebugOutput(axpDebugRead);
void esp32Loop()
{
esp_task_wdt_reset(); // service our app level watchdog
//loopBLE();
// for debug printing
// radio.radioIf.canSleep();

View File

@ -168,9 +168,6 @@ void setupMeshService(void)
// any characteristic(s) within that service definition.. Calling .begin() on
// a BLECharacteristic will cause it to be added to the last BLEService that
// was 'begin()'ed!
fromNum.setProperties(CHR_PROPS_NOTIFY | CHR_PROPS_READ);
fromNum.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS); // FIXME, secure this!!!
fromNum.setFixedLen(0); // Variable len (either 0 or 4) FIXME consider changing protocol so it is fixed 4 byte len, where 0 means empty
fromNum.setMaxLen(4);
fromNum.setCccdWriteCallback(cccd_callback); // Optionally capture CCCD updates
@ -199,6 +196,11 @@ void setupMeshService(void)
toRadio.begin();
}
void setPairingMode() {
}
// FIXME, turn off soft device access for debugging
static bool isSoftDeviceAllowed = true;

View File

@ -7,6 +7,7 @@
#include <stdio.h>
#include <Adafruit_nRFCrypto.h>
// #include <Adafruit_USBD_Device.h>
#include "NodeDB.h"
#include "NRF52Bluetooth.h"
#include "error.h"
@ -68,7 +69,7 @@ static const bool useSoftDevice = true; // Set to false for easier debugging
void setBluetoothEnable(bool on)
{
if (on != bleOn) {
if (on != bleOn && config.bluetooth.enabled == true) {
if (on) {
if (!nrf52Bluetooth) {
if (!useSoftDevice)
@ -81,9 +82,8 @@ void setBluetoothEnable(bool on)
initBrownout();
}
}
} else {
if (nrf52Bluetooth)
nrf52Bluetooth->shutdown();
} else if (nrf52Bluetooth) {
nrf52Bluetooth->shutdown();
}
bleOn = on;
}