Browse Source

Deduplicate NRF52 startOTAUpdate()

The startOTAUpdate() is the same for all NRF52 boards. Use a common
implementation for all boards that currently have a specific
implementation.

The following boards currently have an empty startOTAUpdate() for
whatever reasons and therefore are not inheriting NRF52BoardOTA to
keep the same state: Nano G2 Ultra, Seeed SenseCAP T1000-E,
Wio WM1110.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
Frieder Schrempf 8 months ago
parent
commit
b024b9e1a1
37 changed files with 132 additions and 1143 deletions
  1. 64 0
      src/helpers/NRF52Board.cpp
  2. 9 0
      src/helpers/NRF52Board.h
  3. 1 61
      variants/heltec_mesh_solar/MeshSolarBoard.cpp
  4. 2 4
      variants/heltec_mesh_solar/MeshSolarBoard.h
  5. 1 59
      variants/heltec_t114/T114Board.cpp
  6. 2 3
      variants/heltec_t114/T114Board.h
  7. 0 59
      variants/ikoka_handheld_nrf/IkokaNrf52Board.cpp
  8. 2 3
      variants/ikoka_handheld_nrf/IkokaNrf52Board.h
  9. 1 59
      variants/ikoka_nano_nrf/IkokaNanoNRFBoard.cpp
  10. 2 3
      variants/ikoka_nano_nrf/IkokaNanoNRFBoard.h
  11. 1 59
      variants/ikoka_stick_nrf/IkokaStickNRFBoard.cpp
  12. 2 3
      variants/ikoka_stick_nrf/IkokaStickNRFBoard.h
  13. 2 59
      variants/keepteen_lt1/KeepteenLT1Board.cpp
  14. 2 3
      variants/keepteen_lt1/KeepteenLT1Board.h
  15. 2 60
      variants/lilygo_techo/TechoBoard.cpp
  16. 2 2
      variants/lilygo_techo/TechoBoard.h
  17. 2 60
      variants/lilygo_techo_lite/TechoBoard.cpp
  18. 2 2
      variants/lilygo_techo_lite/TechoBoard.h
  19. 1 60
      variants/mesh_pocket/MeshPocket.cpp
  20. 2 3
      variants/mesh_pocket/MeshPocket.h
  21. 1 60
      variants/minewsemi_me25ls01/MinewsemiME25LS01Board.cpp
  22. 2 4
      variants/minewsemi_me25ls01/MinewsemiME25LS01Board.h
  23. 2 59
      variants/promicro/PromicroBoard.cpp
  24. 2 3
      variants/promicro/PromicroBoard.h
  25. 2 65
      variants/rak4631/RAK4631Board.cpp
  26. 2 3
      variants/rak4631/RAK4631Board.h
  27. 2 65
      variants/rak_wismesh_tag/RAKWismeshTagBoard.cpp
  28. 2 3
      variants/rak_wismesh_tag/RAKWismeshTagBoard.h
  29. 2 61
      variants/sensecap_solar/SenseCapSolarBoard.cpp
  30. 2 3
      variants/sensecap_solar/SenseCapSolarBoard.h
  31. 2 63
      variants/t1000-e/T1000eBoard.cpp
  32. 2 60
      variants/thinknode_m1/ThinkNodeM1Board.cpp
  33. 2 3
      variants/thinknode_m1/ThinkNodeM1Board.h
  34. 1 64
      variants/wio-tracker-l1/WioTrackerL1Board.cpp
  35. 2 3
      variants/wio-tracker-l1/WioTrackerL1Board.h
  36. 0 59
      variants/xiao_nrf52/XiaoNrf52Board.cpp
  37. 2 3
      variants/xiao_nrf52/XiaoNrf52Board.h

+ 64 - 0
src/helpers/NRF52Board.cpp

@@ -1,6 +1,22 @@
 #if defined(NRF52_PLATFORM)
 #include "NRF52Board.h"
 
+#include <bluefruit.h>
+
+static BLEDfu bledfu;
+
+static void connect_callback(uint16_t conn_handle) {
+  (void)conn_handle;
+  MESH_DEBUG_PRINTLN("BLE client connected");
+}
+
+static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
+  (void)conn_handle;
+  (void)reason;
+
+  MESH_DEBUG_PRINTLN("BLE client disconnected");
+}
+
 void NRF52Board::begin() {
   startup_reason = BD_STARTUP_NORMAL;
 }
@@ -37,4 +53,52 @@ float NRF52Board::getMCUTemperature() {
 
   return temp * 0.25f; // Convert to *C
 }
+
+bool NRF52BoardOTA::startOTAUpdate(const char *id, char reply[]) {
+  // Config the peripheral connection with maximum bandwidth
+  // more SRAM required by SoftDevice
+  // Note: All config***() function must be called before begin()
+  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
+  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
+
+  Bluefruit.begin(1, 0);
+  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
+  Bluefruit.setTxPower(4);
+  // Set the BLE device name
+  Bluefruit.setName(ota_name);
+
+  Bluefruit.Periph.setConnectCallback(connect_callback);
+  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
+
+  // To be consistent OTA DFU should be added first if it exists
+  bledfu.begin();
+
+  // Set up and start advertising
+  // Advertising packet
+  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
+  Bluefruit.Advertising.addTxPower();
+  Bluefruit.Advertising.addName();
+
+  /* Start Advertising
+    - Enable auto advertising if disconnected
+    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
+    - Timeout for fast mode is 30 seconds
+    - Start(timeout) with timeout = 0 will advertise forever (until connected)
+
+    For recommended advertising interval
+    https://developer.apple.com/library/content/qa/qa1931/_index.html
+  */
+  Bluefruit.Advertising.restartOnDisconnect(true);
+  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
+  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
+  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
+
+  uint8_t mac_addr[6];
+  memset(mac_addr, 0, sizeof(mac_addr));
+  Bluefruit.getAddr(mac_addr);
+  sprintf(reply, "OK - mac: %02X:%02X:%02X:%02X:%02X:%02X", mac_addr[5], mac_addr[4], mac_addr[3],
+          mac_addr[2], mac_addr[1], mac_addr[0]);
+
+  return true;
+}
 #endif

+ 9 - 0
src/helpers/NRF52Board.h

@@ -27,4 +27,13 @@ class NRF52BoardDCDC : virtual public NRF52Board {
 public:
   virtual void begin() override;
 };
+
+class NRF52BoardOTA : virtual public NRF52Board {
+private:
+  char *ota_name;
+
+public:
+  NRF52BoardOTA(char *name) : ota_name(name) {}
+  virtual bool startOTAUpdate(const char *id, char reply[]) override;
+};
 #endif

+ 1 - 61
variants/heltec_mesh_solar/MeshSolarBoard.cpp

@@ -1,24 +1,7 @@
 #include <Arduino.h>
-#include "MeshSolarBoard.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle)
-{
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason)
-{
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#include "MeshSolarBoard.h"
 
 void MeshSolarBoard::begin() {
   NRF52Board::begin();
@@ -31,46 +14,3 @@ void MeshSolarBoard::begin() {
 
   Wire.begin();
 }
-
-bool MeshSolarBoard::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("MESH_SOLAR_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}

+ 2 - 4
variants/heltec_mesh_solar/MeshSolarBoard.h

@@ -20,9 +20,9 @@
 #define SX126X_DIO2_AS_RF_SWITCH  true
 #define SX126X_DIO3_TCXO_VOLTAGE   1.8
 
-
-class MeshSolarBoard : public NRF52Board {
+class MeshSolarBoard : public NRF52BoardOTA {
 public:
+  MeshSolarBoard() : NRF52BoardOTA("MESH_SOLAR_OTA") {}
   void begin();
 
   uint16_t getBattMilliVolts() override {
@@ -32,6 +32,4 @@ public:
   const char* getManufacturerName() const override {
     return "Heltec Mesh Solar";
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 1 - 59
variants/heltec_t114/T114Board.cpp

@@ -2,21 +2,6 @@
 
 #include <Arduino.h>
 #include <Wire.h>
-#include <bluefruit.h>
-
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
 
 void T114Board::begin() {
   NRF52Board::begin();
@@ -38,47 +23,4 @@ void T114Board::begin() {
   pinMode(SX126X_POWER_EN, OUTPUT);
   digitalWrite(SX126X_POWER_EN, HIGH);
   delay(10); // give sx1262 some time to power up
-}
-
-bool T114Board::startOTAUpdate(const char *id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("T114_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
+}

+ 2 - 3
variants/heltec_t114/T114Board.h

@@ -9,8 +9,9 @@
 #define  PIN_BAT_CTL      6
 #define  MV_LSB   (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range
 
-class T114Board : public NRF52Board {
+class T114Board : public NRF52BoardOTA {
 public:
+    T114Board() : NRF52BoardOTA("T114_OTA") {}
   void begin();
 
 #if defined(P_LORA_TX_LED)
@@ -50,6 +51,4 @@ public:
     #endif
     sd_power_system_off();
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 0 - 59
variants/ikoka_handheld_nrf/IkokaNrf52Board.cpp

@@ -2,24 +2,9 @@
 
 #include <Arduino.h>
 #include <Wire.h>
-#include <bluefruit.h>
 
 #include "IkokaNrf52Board.h"
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
-
 void IkokaNrf52Board::begin() {
   NRF52Board::begin();
 
@@ -52,48 +37,4 @@ void IkokaNrf52Board::begin() {
   delay(10); // give sx1262 some time to power up
 }
 
-bool IkokaNrf52Board::startOTAUpdate(const char *id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("XIAO_NRF52_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-
-  return true;
-}
-
 #endif

+ 2 - 3
variants/ikoka_handheld_nrf/IkokaNrf52Board.h

@@ -6,8 +6,9 @@
 
 #ifdef IKOKA_NRF52
 
-class IkokaNrf52Board : public NRF52Board {
+class IkokaNrf52Board : public NRF52BoardOTA {
 public:
+  IkokaNrf52Board() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
   void begin();
 
 #if defined(P_LORA_TX_LED)
@@ -38,8 +39,6 @@ public:
   const char* getManufacturerName() const override {
     return "Ikoka Handheld E22 30dBm (Xiao_nrf52)";
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };
 
 #endif

+ 1 - 59
variants/ikoka_nano_nrf/IkokaNanoNRFBoard.cpp

@@ -1,24 +1,9 @@
 #ifdef XIAO_NRF52
 
 #include <Arduino.h>
-#include "IkokaNanoNRFBoard.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#include "IkokaNanoNRFBoard.h"
 
 void IkokaNanoNRFBoard::begin() {
   NRF52Board::begin();
@@ -47,47 +32,4 @@ void IkokaNanoNRFBoard::begin() {
   delay(10);   // give sx1262 some time to power up
 }
 
-bool IkokaNanoNRFBoard::startOTAUpdate(const char *id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("XIAO_NRF52_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
-
 #endif

+ 2 - 3
variants/ikoka_nano_nrf/IkokaNanoNRFBoard.h

@@ -6,8 +6,9 @@
 
 #ifdef XIAO_NRF52
 
-class IkokaNanoNRFBoard : public NRF52Board {
+class IkokaNanoNRFBoard : public NRF52BoardOTA {
 public:
+  IkokaNanoNRFBoard() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
   void begin();
 
 #if defined(P_LORA_TX_LED)
@@ -46,8 +47,6 @@ public:
   const char *getManufacturerName() const override {
     return MANUFACTURER_STRING;
   }
-
-  bool startOTAUpdate(const char *id, char reply[]) override;
 };
 
 #endif

+ 1 - 59
variants/ikoka_stick_nrf/IkokaStickNRFBoard.cpp

@@ -1,24 +1,9 @@
 #ifdef XIAO_NRF52
 
 #include <Arduino.h>
-#include "IkokaStickNRFBoard.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#include "IkokaStickNRFBoard.h"
 
 void IkokaStickNRFBoard::begin() {
   NRF52Board::begin();
@@ -47,47 +32,4 @@ void IkokaStickNRFBoard::begin() {
   delay(10);   // give sx1262 some time to power up
 }
 
-bool IkokaStickNRFBoard::startOTAUpdate(const char *id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("XIAO_NRF52_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
-
 #endif

+ 2 - 3
variants/ikoka_stick_nrf/IkokaStickNRFBoard.h

@@ -6,8 +6,9 @@
 
 #ifdef XIAO_NRF52
 
-class IkokaStickNRFBoard : public NRF52Board {
+class IkokaStickNRFBoard : public NRF52BoardOTA {
 public:
+  IkokaStickNRFBoard() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
   void begin();
 
 #if defined(P_LORA_TX_LED)
@@ -46,8 +47,6 @@ public:
   const char *getManufacturerName() const override {
     return MANUFACTURER_STRING;
   }
-
-  bool startOTAUpdate(const char *id, char reply[]) override;
 };
 
 #endif

+ 2 - 59
variants/keepteen_lt1/KeepteenLT1Board.cpp

@@ -1,10 +1,7 @@
 #include <Arduino.h>
-#include "KeepteenLT1Board.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
+#include "KeepteenLT1Board.h"
 
 void KeepteenLT1Board::begin() {    
     NRF52Board::begin();
@@ -17,58 +14,4 @@ void KeepteenLT1Board::begin() {
     #endif
     
     Wire.begin();
-}
-
-static void connect_callback(uint16_t conn_handle) {
-    (void)conn_handle;
-    MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-    (void)conn_handle;
-    (void)reason;
-    MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
-
-bool KeepteenLT1Board::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("KeepteenLT1_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
+}

+ 2 - 3
variants/keepteen_lt1/KeepteenLT1Board.h

@@ -4,11 +4,12 @@
 #include <Arduino.h>
 #include <helpers/NRF52Board.h>
 
-class KeepteenLT1Board : public NRF52Board {
+class KeepteenLT1Board : public NRF52BoardOTA {
 protected:
   uint8_t btn_prev_state;
 
 public:
+  KeepteenLT1Board() : NRF52BoardOTA("KeepteenLT1_OTA") {}
   void begin();
 
   #define BATTERY_SAMPLES 8
@@ -40,6 +41,4 @@ public:
   void powerOff() override {
     sd_power_system_off();
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 2 - 60
variants/lilygo_techo/TechoBoard.cpp

@@ -1,24 +1,9 @@
 #include <Arduino.h>
-#include "TechoBoard.h"
-
-#ifdef LILYGO_TECHO
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
+#include "TechoBoard.h"
 
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#ifdef LILYGO_TECHO
 
 void TechoBoard::begin() {
   NRF52Board::begin();
@@ -43,47 +28,4 @@ uint16_t TechoBoard::getBattMilliVolts() {
   // divider into account (providing the actual LIPO voltage)
   return (uint16_t)((float)adcvalue * REAL_VBAT_MV_PER_LSB);
 }
-
-bool TechoBoard::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("TECHO_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
 #endif

+ 2 - 2
variants/lilygo_techo/TechoBoard.h

@@ -13,11 +13,11 @@
 #define PIN_VBAT_READ     (4)
 #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
 
-class TechoBoard : public NRF52Board {
+class TechoBoard : public NRF52BoardOTA {
 public:
+  TechoBoard() : NRF52BoardOTA("TECHO_OTA") {}
   void begin();
   uint16_t getBattMilliVolts() override;
-  bool startOTAUpdate(const char* id, char reply[]) override;
 
   const char* getManufacturerName() const override {
     return "LilyGo T-Echo";

+ 2 - 60
variants/lilygo_techo_lite/TechoBoard.cpp

@@ -1,24 +1,9 @@
 #include <Arduino.h>
-#include "TechoBoard.h"
-
-#ifdef LILYGO_TECHO
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
+#include "TechoBoard.h"
 
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#ifdef LILYGO_TECHO
 
 void TechoBoard::begin() {
   NRF52Board::begin();
@@ -43,47 +28,4 @@ uint16_t TechoBoard::getBattMilliVolts() {
   // divider into account (providing the actual LIPO voltage)
   return (uint16_t)((float)adcvalue * REAL_VBAT_MV_PER_LSB);
 }
-
-bool TechoBoard::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("TECHO_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
 #endif

+ 2 - 2
variants/lilygo_techo_lite/TechoBoard.h

@@ -13,11 +13,11 @@
 #define PIN_VBAT_READ     (4)
 #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
 
-class TechoBoard : public NRF52Board {
+class TechoBoard : public NRF52BoardOTA {
 public:
+  TechoBoard() : NRF52BoardOTA("TECHO_OTA") {}
   void begin();
   uint16_t getBattMilliVolts() override;
-  bool startOTAUpdate(const char* id, char reply[]) override;
 
   const char* getManufacturerName() const override {
     return "LilyGo T-Echo";

+ 1 - 60
variants/mesh_pocket/MeshPocket.cpp

@@ -1,23 +1,7 @@
 #include <Arduino.h>
-#include "MeshPocket.h"
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle)
-{
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason)
-{
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#include "MeshPocket.h"
 
 void HeltecMeshPocket::begin() {
   NRF52Board::begin();
@@ -26,46 +10,3 @@ void HeltecMeshPocket::begin() {
 
   pinMode(PIN_USER_BTN, INPUT);
 }
-
-bool HeltecMeshPocket::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("MESH_POCKET_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}

+ 2 - 3
variants/mesh_pocket/MeshPocket.h

@@ -9,8 +9,9 @@
 #define  PIN_BAT_CTL      34
 #define  MV_LSB   (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range
 
-class HeltecMeshPocket : public NRF52Board {
+class HeltecMeshPocket : public NRF52BoardOTA {
 public:
+  HeltecMeshPocket() : NRF52BoardOTA("MESH_POCKET_OTA") {}
   void begin();
 
   uint16_t getBattMilliVolts() override {
@@ -35,6 +36,4 @@ public:
   void powerOff() override {
     sd_power_system_off();
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 1 - 60
variants/minewsemi_me25ls01/MinewsemiME25LS01Board.cpp

@@ -1,8 +1,7 @@
 #include <Arduino.h>
-#include "MinewsemiME25LS01Board.h"
 #include <Wire.h>
 
-#include <bluefruit.h>
+#include "MinewsemiME25LS01Board.h"
 
 void MinewsemiME25LS01Board::begin() {
   NRF52Board::begin();
@@ -27,62 +26,4 @@ void MinewsemiME25LS01Board::begin() {
 #endif
 
   delay(10);   // give sx1262 some time to power up
-}
-
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
-
-
-bool MinewsemiME25LS01Board::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("Minewsemi_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
 }

+ 2 - 4
variants/minewsemi_me25ls01/MinewsemiME25LS01Board.h

@@ -20,12 +20,12 @@
 #define  PIN_VBAT_READ BATTERY_PIN
 #define  ADC_MULTIPLIER   (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking
 
-
-class MinewsemiME25LS01Board : public NRF52Board {
+class MinewsemiME25LS01Board : public NRF52BoardOTA {
 protected:
   uint8_t btn_prev_state;
 
 public:
+  MinewsemiME25LS01Board() : NRF52BoardOTA("Minewsemi_OTA") {}
   void begin();
 
 #define BATTERY_SAMPLES 8
@@ -76,6 +76,4 @@ public:
     digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
   }
 #endif
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 2 - 59
variants/promicro/PromicroBoard.cpp

@@ -1,10 +1,7 @@
 #include <Arduino.h>
-#include "PromicroBoard.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
+#include "PromicroBoard.h"
 
 void PromicroBoard::begin() {    
     NRF52Board::begin();
@@ -25,58 +22,4 @@ void PromicroBoard::begin() {
     pinMode(SX126X_POWER_EN, OUTPUT);
     digitalWrite(SX126X_POWER_EN, HIGH);
     delay(10);   // give sx1262 some time to power up
-}
-
-static void connect_callback(uint16_t conn_handle) {
-    (void)conn_handle;
-    MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-    (void)conn_handle;
-    (void)reason;
-    MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
-
-bool PromicroBoard::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("ProMicro_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
+}

+ 2 - 3
variants/promicro/PromicroBoard.h

@@ -20,12 +20,13 @@
 #define  PIN_VBAT_READ 17
 #define  ADC_MULTIPLIER   (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking
 
-class PromicroBoard : public NRF52Board {
+class PromicroBoard : public NRF52BoardOTA {
 protected:
   uint8_t btn_prev_state;
   float adc_mult = ADC_MULTIPLIER;
 
 public:
+  PromicroBoard() : NRF52BoardOTA("ProMicro_OTA") {}
   void begin();
 
   #define BATTERY_SAMPLES 8
@@ -75,6 +76,4 @@ public:
   void powerOff() override {
     sd_power_system_off();
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 2 - 65
variants/rak4631/RAK4631Board.cpp

@@ -1,22 +1,7 @@
 #include <Arduino.h>
-#include "RAK4631Board.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#include "RAK4631Board.h"
 
 void RAK4631Board::begin() {
   NRF52Board::begin();
@@ -38,52 +23,4 @@ void RAK4631Board::begin() {
   pinMode(SX126X_POWER_EN, OUTPUT);
   digitalWrite(SX126X_POWER_EN, HIGH);
   delay(10);   // give sx1262 some time to power up
-}
-
-bool RAK4631Board::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("RAK4631_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  uint8_t mac_addr[6];
-  memset(mac_addr, 0, sizeof(mac_addr));
-  Bluefruit.getAddr(mac_addr);
-  sprintf(reply, "OK - mac: %02X:%02X:%02X:%02X:%02X:%02X", 
-      mac_addr[5], mac_addr[4], mac_addr[3], mac_addr[2], mac_addr[1], mac_addr[0]);
-
-  return true;
-}
+}

+ 2 - 3
variants/rak4631/RAK4631Board.h

@@ -29,8 +29,9 @@
 #define  PIN_VBAT_READ    5
 #define  ADC_MULTIPLIER   (3 * 1.73 * 1.187 * 1000)
 
-class RAK4631Board : public NRF52Board {
+class RAK4631Board : public NRF52BoardOTA {
 public:
+  RAK4631Board() : NRF52BoardOTA("RAK4631_OTA") {}
   void begin();
 
   #define BATTERY_SAMPLES 8
@@ -50,6 +51,4 @@ public:
   const char* getManufacturerName() const override {
     return "RAK 4631";
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 2 - 65
variants/rak_wismesh_tag/RAKWismeshTagBoard.cpp

@@ -1,22 +1,7 @@
 #include <Arduino.h>
-#include "RAKWismeshTagBoard.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#include "RAKWismeshTagBoard.h"
 
 void RAKWismeshTagBoard::begin() {
   NRF52BoardDCDC::begin();
@@ -30,52 +15,4 @@ void RAKWismeshTagBoard::begin() {
   pinMode(SX126X_POWER_EN, OUTPUT);
   digitalWrite(SX126X_POWER_EN, HIGH);
   delay(10);   // give sx1262 some time to power up
-}
-
-bool RAKWismeshTagBoard::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("WISMESHTAG_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  uint8_t mac_addr[6];
-  memset(mac_addr, 0, sizeof(mac_addr));
-  Bluefruit.getAddr(mac_addr);
-  sprintf(reply, "OK - mac: %02X:%02X:%02X:%02X:%02X:%02X",
-      mac_addr[5], mac_addr[4], mac_addr[3], mac_addr[2], mac_addr[1], mac_addr[0]);
-
-  return true;
-}
+}

+ 2 - 3
variants/rak_wismesh_tag/RAKWismeshTagBoard.h

@@ -8,8 +8,9 @@
 #define  PIN_VBAT_READ    5
 #define  ADC_MULTIPLIER   (3 * 1.73 * 1.187 * 1000)
 
-class RAKWismeshTagBoard : public NRF52BoardDCDC {
+class RAKWismeshTagBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
 public:
+  RAKWismeshTagBoard() : NRF52BoardOTA("WISMESHTAG_OTA") {}
   void begin();
 
 #if defined(P_LORA_TX_LED) && defined(LED_STATE_ON)
@@ -39,8 +40,6 @@ public:
     return "RAK WisMesh Tag";
   }
 
-  bool startOTAUpdate(const char* id, char reply[]) override;
-
   void powerOff() override {
     #ifdef BUZZER_EN
         digitalWrite(BUZZER_EN, LOW);

+ 2 - 61
variants/sensecap_solar/SenseCapSolarBoard.cpp

@@ -1,22 +1,7 @@
 #include <Arduino.h>
-#include "SenseCapSolarBoard.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#include "SenseCapSolarBoard.h"
 
 void SenseCapSolarBoard::begin() {
   NRF52Board::begin();
@@ -33,48 +18,4 @@ void SenseCapSolarBoard::begin() {
 #endif
 
   delay(10);   // give sx1262 some time to power up
-}
-
-bool SenseCapSolarBoard::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("SENSECAP_SOLAR_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-
-  return true;
-}
+}

+ 2 - 3
variants/sensecap_solar/SenseCapSolarBoard.h

@@ -4,8 +4,9 @@
 #include <Arduino.h>
 #include <helpers/NRF52Board.h>
 
-class SenseCapSolarBoard : public NRF52Board {
+class SenseCapSolarBoard : public NRF52BoardOTA {
 public:
+  SenseCapSolarBoard() : NRF52BoardOTA("SENSECAP_SOLAR_OTA") {}
   void begin();
 
 #if defined(P_LORA_TX_LED)
@@ -30,6 +31,4 @@ public:
   const char* getManufacturerName() const override {
     return "Seeed SenseCap Solar";
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 2 - 63
variants/t1000-e/T1000eBoard.cpp

@@ -1,8 +1,7 @@
 #include <Arduino.h>
-#include "T1000eBoard.h"
 #include <Wire.h>
 
-#include <bluefruit.h>
+#include "T1000eBoard.h"
 
 void T1000eBoard::begin() {
   NRF52BoardDCDC::begin();
@@ -21,64 +20,4 @@ void T1000eBoard::begin() {
   Wire.begin();
 
   delay(10);   // give sx1262 some time to power up
-}
-
-#if 0
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
-
-
-bool TrackerT1000eBoard::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("T1000E_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
-#endif
+}

+ 2 - 60
variants/thinknode_m1/ThinkNodeM1Board.cpp

@@ -1,24 +1,9 @@
-#include "ThinkNodeM1Board.h"
 #include <Arduino.h>
-
-#ifdef THINKNODE_M1
-
 #include <Wire.h>
-#include <bluefruit.h>
-
-static BLEDfu bledfu;
 
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
+#include "ThinkNodeM1Board.h"
 
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#ifdef THINKNODE_M1
 
 void ThinkNodeM1Board::begin() {
   NRF52Board::begin();
@@ -48,47 +33,4 @@ uint16_t ThinkNodeM1Board::getBattMilliVolts() {
   // divider into account (providing the actual LIPO voltage)
   return (uint16_t)((float)adcvalue * REAL_VBAT_MV_PER_LSB);
 }
-
-bool ThinkNodeM1Board::startOTAUpdate(const char *id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("THINKNODE_M1_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-  return true;
-}
 #endif

+ 2 - 3
variants/thinknode_m1/ThinkNodeM1Board.h

@@ -13,12 +13,11 @@
 #define PIN_VBAT_READ     (4)
 #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
 
-class ThinkNodeM1Board : public NRF52Board {
+class ThinkNodeM1Board : public NRF52BoardOTA {
 public:
-
+  ThinkNodeM1Board() : NRF52BoardOTA("THINKNODE_M1_OTA") {}
   void begin();
   uint16_t getBattMilliVolts() override;
-  bool startOTAUpdate(const char* id, char reply[]) override;
 
   #if defined(P_LORA_TX_LED)
   void onBeforeTransmit() override {

+ 1 - 64
variants/wio-tracker-l1/WioTrackerL1Board.cpp

@@ -1,22 +1,7 @@
 #include <Arduino.h>
-#include "WioTrackerL1Board.h"
-
-#include <bluefruit.h>
 #include <Wire.h>
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
+#include "WioTrackerL1Board.h"
 
 void WioTrackerL1Board::begin() {
   NRF52BoardDCDC::begin();
@@ -45,51 +30,3 @@ void WioTrackerL1Board::begin() {
 
   delay(10);   // give sx1262 some time to power up
 }
-
-bool WioTrackerL1Board::startOTAUpdate(const char* id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("WioTrackerL1 OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  uint8_t mac_addr[6];
-  memset(mac_addr, 0, sizeof(mac_addr));
-  Bluefruit.getAddr(mac_addr);
-  sprintf(reply, "OK - mac: %02X:%02X:%02X:%02X:%02X:%02X", 
-      mac_addr[5], mac_addr[4], mac_addr[3], mac_addr[2], mac_addr[1], mac_addr[0]);
-
-  return true;
-}

+ 2 - 3
variants/wio-tracker-l1/WioTrackerL1Board.h

@@ -4,11 +4,12 @@
 #include <Arduino.h>
 #include <helpers/NRF52Board.h>
 
-class WioTrackerL1Board : public NRF52BoardDCDC {
+class WioTrackerL1Board : public NRF52BoardDCDC, public NRF52BoardOTA {
 protected:
   uint8_t btn_prev_state;
 
 public:
+  WioTrackerL1Board() : NRF52BoardOTA("WioTrackerL1 OTA") {}
   void begin();
 
 #if defined(P_LORA_TX_LED)
@@ -36,6 +37,4 @@ public:
   void powerOff() override {
     sd_power_system_off();
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };

+ 0 - 59
variants/xiao_nrf52/XiaoNrf52Board.cpp

@@ -2,24 +2,9 @@
 
 #include <Arduino.h>
 #include <Wire.h>
-#include <bluefruit.h>
 
 #include "XiaoNrf52Board.h"
 
-static BLEDfu bledfu;
-
-static void connect_callback(uint16_t conn_handle) {
-  (void)conn_handle;
-  MESH_DEBUG_PRINTLN("BLE client connected");
-}
-
-static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
-  (void)conn_handle;
-  (void)reason;
-
-  MESH_DEBUG_PRINTLN("BLE client disconnected");
-}
-
 void XiaoNrf52Board::begin() {
   NRF52BoardDCDC::begin();
 
@@ -47,48 +32,4 @@ void XiaoNrf52Board::begin() {
   delay(10); // give sx1262 some time to power up
 }
 
-bool XiaoNrf52Board::startOTAUpdate(const char *id, char reply[]) {
-  // Config the peripheral connection with maximum bandwidth
-  // more SRAM required by SoftDevice
-  // Note: All config***() function must be called before begin()
-  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
-  Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
-
-  Bluefruit.begin(1, 0);
-  // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
-  Bluefruit.setTxPower(4);
-  // Set the BLE device name
-  Bluefruit.setName("XIAO_NRF52_OTA");
-
-  Bluefruit.Periph.setConnectCallback(connect_callback);
-  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
-
-  // To be consistent OTA DFU should be added first if it exists
-  bledfu.begin();
-
-  // Set up and start advertising
-  // Advertising packet
-  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-  Bluefruit.Advertising.addTxPower();
-  Bluefruit.Advertising.addName();
-
-  /* Start Advertising
-    - Enable auto advertising if disconnected
-    - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
-    - Timeout for fast mode is 30 seconds
-    - Start(timeout) with timeout = 0 will advertise forever (until connected)
-
-    For recommended advertising interval
-    https://developer.apple.com/library/content/qa/qa1931/_index.html
-  */
-  Bluefruit.Advertising.restartOnDisconnect(true);
-  Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
-  Bluefruit.Advertising.setFastTimeout(30);   // number of seconds in fast mode
-  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
-
-  strcpy(reply, "OK - started");
-
-  return true;
-}
-
 #endif

+ 2 - 3
variants/xiao_nrf52/XiaoNrf52Board.h

@@ -6,8 +6,9 @@
 
 #ifdef XIAO_NRF52
 
-class XiaoNrf52Board : public NRF52BoardDCDC {
+class XiaoNrf52Board : public NRF52BoardDCDC, public NRF52BoardOTA {
 public:
+  XiaoNrf52Board() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
   void begin();
 
 #if defined(P_LORA_TX_LED)
@@ -56,8 +57,6 @@ public:
 
     sd_power_system_off();
   }
-
-  bool startOTAUpdate(const char* id, char reply[]) override;
 };
 
 #endif