nrf52 debugging is supported as long as BLE is not advertising

This commit is contained in:
geeksville 2020-05-25 17:16:09 -07:00
parent da3ed9926b
commit a96c8fd4db
3 changed files with 12 additions and 9 deletions

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[platformio] [platformio]
default_envs = tbeam ; Note: the github actions CI test build can't yet build NRF52 targets default_envs = nrf52dk ; Note: the github actions CI test build can't yet build NRF52 targets
[common] [common]
; common is not currently used ; common is not currently used

View File

@ -148,6 +148,9 @@ void setupHRM(void)
bslc.write8(2); // Set the characteristic to 'Wrist' (2) bslc.write8(2); // Set the characteristic to 'Wrist' (2)
} }
// FIXME, turn off soft device access for debugging
static bool isSoftDeviceAllowed = false;
void NRF52Bluetooth::setup() void NRF52Bluetooth::setup()
{ {
// Initialise the Bluefruit module // Initialise the Bluefruit module
@ -179,11 +182,14 @@ void NRF52Bluetooth::setup()
DEBUG_MSG("Configuring the Heart Rate Monitor Service\n"); DEBUG_MSG("Configuring the Heart Rate Monitor Service\n");
setupHRM(); setupHRM();
// Setup the advertising packet(s) // Supposedly debugging works with soft device if you disable advertising
DEBUG_MSG("Setting up the advertising payload(s)\n"); if (isSoftDeviceAllowed) {
startAdv(); // Setup the advertising packet(s)
DEBUG_MSG("Setting up the advertising payload(s)\n");
startAdv();
DEBUG_MSG("Advertising\n"); DEBUG_MSG("Advertising\n");
}
} }
/* /*

View File

@ -43,15 +43,12 @@ void getMacAddr(uint8_t *dmac)
NRF52Bluetooth *nrf52Bluetooth; NRF52Bluetooth *nrf52Bluetooth;
// FIXME, turn off soft device access for debugging
static bool isSoftDeviceAllowed = false;
static bool bleOn = false; static bool bleOn = false;
void setBluetoothEnable(bool on) void setBluetoothEnable(bool on)
{ {
if (on != bleOn) { if (on != bleOn) {
if (on) { if (on) {
if (!nrf52Bluetooth && isSoftDeviceAllowed) { if (!nrf52Bluetooth) {
nrf52Bluetooth = new NRF52Bluetooth(); nrf52Bluetooth = new NRF52Bluetooth();
nrf52Bluetooth->setup(); nrf52Bluetooth->setup();
} }