Remove NRF52BoardOTA class and integrate it into NRF52Board

As all NRF52 boards now have OTA support, let's remove the subclass
and integrate it into the base class.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
This commit is contained in:
Frieder Schrempf
2025-12-20 10:44:13 +01:00
parent 686d887f72
commit 4f46ec75dd
22 changed files with 45 additions and 50 deletions

View File

@@ -54,7 +54,7 @@ float NRF52Board::getMCUTemperature() {
return temp * 0.25f; // Convert to *C return temp * 0.25f; // Convert to *C
} }
bool NRF52BoardOTA::startOTAUpdate(const char *id, char reply[]) { bool NRF52Board::startOTAUpdate(const char *id, char reply[]) {
// Config the peripheral connection with maximum bandwidth // Config the peripheral connection with maximum bandwidth
// more SRAM required by SoftDevice // more SRAM required by SoftDevice
// Note: All config***() function must be called before begin() // Note: All config***() function must be called before begin()

View File

@@ -8,12 +8,15 @@
class NRF52Board : public mesh::MainBoard { class NRF52Board : public mesh::MainBoard {
protected: protected:
uint8_t startup_reason; uint8_t startup_reason;
char *ota_name;
public: public:
NRF52Board(char *otaname) : ota_name(otaname) {}
virtual void begin(); virtual void begin();
virtual uint8_t getStartupReason() const override { return startup_reason; } virtual uint8_t getStartupReason() const override { return startup_reason; }
virtual float getMCUTemperature() override; virtual float getMCUTemperature() override;
virtual void reboot() override { NVIC_SystemReset(); } virtual void reboot() override { NVIC_SystemReset(); }
virtual bool startOTAUpdate(const char *id, char reply[]) override;
}; };
/* /*
@@ -25,15 +28,7 @@ public:
*/ */
class NRF52BoardDCDC : virtual public NRF52Board { class NRF52BoardDCDC : virtual public NRF52Board {
public: public:
NRF52BoardDCDC() {}
virtual void begin() override; 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 #endif

View File

@@ -20,9 +20,9 @@
#define SX126X_DIO2_AS_RF_SWITCH true #define SX126X_DIO2_AS_RF_SWITCH true
#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #define SX126X_DIO3_TCXO_VOLTAGE 1.8
class MeshSolarBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class MeshSolarBoard : public NRF52BoardDCDC {
public: public:
MeshSolarBoard() : NRF52BoardOTA("MESH_SOLAR_OTA") {} MeshSolarBoard() : NRF52Board("MESH_SOLAR_OTA") {}
void begin(); void begin();
uint16_t getBattMilliVolts() override { uint16_t getBattMilliVolts() override {

View File

@@ -9,9 +9,9 @@
#define PIN_BAT_CTL 6 #define PIN_BAT_CTL 6
#define MV_LSB (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range #define MV_LSB (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range
class T114Board : public NRF52BoardDCDC, public NRF52BoardOTA { class T114Board : public NRF52BoardDCDC {
public: public:
T114Board() : NRF52BoardOTA("T114_OTA") {} T114Board() : NRF52Board("T114_OTA") {}
void begin(); void begin();
#if defined(P_LORA_TX_LED) #if defined(P_LORA_TX_LED)

View File

@@ -6,9 +6,9 @@
#ifdef IKOKA_NRF52 #ifdef IKOKA_NRF52
class IkokaNrf52Board : public NRF52BoardDCDC, public NRF52BoardOTA { class IkokaNrf52Board : public NRF52BoardDCDC {
public: public:
IkokaNrf52Board() : NRF52BoardOTA("XIAO_NRF52_OTA") {} IkokaNrf52Board() : NRF52Board("XIAO_NRF52_OTA") {}
void begin(); void begin();
#if defined(P_LORA_TX_LED) #if defined(P_LORA_TX_LED)

View File

@@ -6,9 +6,9 @@
#ifdef XIAO_NRF52 #ifdef XIAO_NRF52
class IkokaNanoNRFBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class IkokaNanoNRFBoard : public NRF52BoardDCDC {
public: public:
IkokaNanoNRFBoard() : NRF52BoardOTA("XIAO_NRF52_OTA") {} IkokaNanoNRFBoard() : NRF52Board("XIAO_NRF52_OTA") {}
void begin(); void begin();
#if defined(P_LORA_TX_LED) #if defined(P_LORA_TX_LED)

View File

@@ -6,9 +6,9 @@
#ifdef XIAO_NRF52 #ifdef XIAO_NRF52
class IkokaStickNRFBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class IkokaStickNRFBoard : public NRF52BoardDCDC {
public: public:
IkokaStickNRFBoard() : NRF52BoardOTA("XIAO_NRF52_OTA") {} IkokaStickNRFBoard() : NRF52Board("XIAO_NRF52_OTA") {}
void begin(); void begin();
#if defined(P_LORA_TX_LED) #if defined(P_LORA_TX_LED)

View File

@@ -4,12 +4,12 @@
#include <Arduino.h> #include <Arduino.h>
#include <helpers/NRF52Board.h> #include <helpers/NRF52Board.h>
class KeepteenLT1Board : public NRF52BoardOTA { class KeepteenLT1Board : public NRF52Board {
protected: protected:
uint8_t btn_prev_state; uint8_t btn_prev_state;
public: public:
KeepteenLT1Board() : NRF52BoardOTA("KeepteenLT1_OTA") {} KeepteenLT1Board() : NRF52Board("KeepteenLT1_OTA") {}
void begin(); void begin();
#define BATTERY_SAMPLES 8 #define BATTERY_SAMPLES 8

View File

@@ -13,9 +13,9 @@
#define PIN_VBAT_READ (4) #define PIN_VBAT_READ (4)
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
class TechoBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class TechoBoard : public NRF52BoardDCDC {
public: public:
TechoBoard() : NRF52BoardOTA("TECHO_OTA") {} TechoBoard() : NRF52Board("TECHO_OTA") {}
void begin(); void begin();
uint16_t getBattMilliVolts() override; uint16_t getBattMilliVolts() override;

View File

@@ -13,9 +13,9 @@
#define PIN_VBAT_READ (4) #define PIN_VBAT_READ (4)
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
class TechoBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class TechoBoard : public NRF52BoardDCDC {
public: public:
TechoBoard() : NRF52BoardOTA("TECHO_OTA") {} TechoBoard() : NRF52Board("TECHO_OTA") {}
void begin(); void begin();
uint16_t getBattMilliVolts() override; uint16_t getBattMilliVolts() override;

View File

@@ -9,9 +9,9 @@
#define PIN_BAT_CTL 34 #define PIN_BAT_CTL 34
#define MV_LSB (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range #define MV_LSB (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range
class HeltecMeshPocket : public NRF52BoardDCDC, public NRF52BoardOTA { class HeltecMeshPocket : public NRF52BoardDCDC {
public: public:
HeltecMeshPocket() : NRF52BoardOTA("MESH_POCKET_OTA") {} HeltecMeshPocket() : NRF52Board("MESH_POCKET_OTA") {}
void begin(); void begin();
uint16_t getBattMilliVolts() override { uint16_t getBattMilliVolts() override {

View File

@@ -20,12 +20,12 @@
#define PIN_VBAT_READ BATTERY_PIN #define PIN_VBAT_READ BATTERY_PIN
#define ADC_MULTIPLIER (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking #define ADC_MULTIPLIER (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking
class MinewsemiME25LS01Board : public NRF52BoardDCDC, public NRF52BoardOTA { class MinewsemiME25LS01Board : public NRF52BoardDCDC {
protected: protected:
uint8_t btn_prev_state; uint8_t btn_prev_state;
public: public:
MinewsemiME25LS01Board() : NRF52BoardOTA("Minewsemi_OTA") {} MinewsemiME25LS01Board() : NRF52Board("Minewsemi_OTA") {}
void begin(); void begin();
#define BATTERY_SAMPLES 8 #define BATTERY_SAMPLES 8

View File

@@ -35,9 +35,9 @@
#define PIN_VBAT_READ (0 + 2) #define PIN_VBAT_READ (0 + 2)
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
class NanoG2Ultra : public NRF52BoardOTA { class NanoG2Ultra : public NRF52Board {
public: public:
NanoG2Ultra() : NRF52BoardOTA("NANO_G2_OTA") {} NanoG2Ultra() : NRF52Board("NANO_G2_OTA") {}
void begin(); void begin();
uint16_t getBattMilliVolts() override; uint16_t getBattMilliVolts() override;

View File

@@ -20,13 +20,13 @@
#define PIN_VBAT_READ 17 #define PIN_VBAT_READ 17
#define ADC_MULTIPLIER (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking #define ADC_MULTIPLIER (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking
class PromicroBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class PromicroBoard : public NRF52BoardDCDC {
protected: protected:
uint8_t btn_prev_state; uint8_t btn_prev_state;
float adc_mult = ADC_MULTIPLIER; float adc_mult = ADC_MULTIPLIER;
public: public:
PromicroBoard() : NRF52BoardOTA("ProMicro_OTA") {} PromicroBoard() : NRF52Board("ProMicro_OTA") {}
void begin(); void begin();
#define BATTERY_SAMPLES 8 #define BATTERY_SAMPLES 8

View File

@@ -29,9 +29,9 @@
#define PIN_VBAT_READ 5 #define PIN_VBAT_READ 5
#define ADC_MULTIPLIER (3 * 1.73 * 1.187 * 1000) #define ADC_MULTIPLIER (3 * 1.73 * 1.187 * 1000)
class RAK4631Board : public NRF52BoardDCDC, public NRF52BoardOTA { class RAK4631Board : public NRF52BoardDCDC {
public: public:
RAK4631Board() : NRF52BoardOTA("RAK4631_OTA") {} RAK4631Board() : NRF52Board("RAK4631_OTA") {}
void begin(); void begin();
#define BATTERY_SAMPLES 8 #define BATTERY_SAMPLES 8

View File

@@ -8,9 +8,9 @@
#define PIN_VBAT_READ 5 #define PIN_VBAT_READ 5
#define ADC_MULTIPLIER (3 * 1.73 * 1.187 * 1000) #define ADC_MULTIPLIER (3 * 1.73 * 1.187 * 1000)
class RAKWismeshTagBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class RAKWismeshTagBoard : public NRF52BoardDCDC {
public: public:
RAKWismeshTagBoard() : NRF52BoardOTA("WISMESHTAG_OTA") {} RAKWismeshTagBoard() : NRF52Board("WISMESHTAG_OTA") {}
void begin(); void begin();
#if defined(P_LORA_TX_LED) && defined(LED_STATE_ON) #if defined(P_LORA_TX_LED) && defined(LED_STATE_ON)

View File

@@ -4,9 +4,9 @@
#include <Arduino.h> #include <Arduino.h>
#include <helpers/NRF52Board.h> #include <helpers/NRF52Board.h>
class SenseCapSolarBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class SenseCapSolarBoard : public NRF52BoardDCDC {
public: public:
SenseCapSolarBoard() : NRF52BoardOTA("SENSECAP_SOLAR_OTA") {} SenseCapSolarBoard() : NRF52Board("SENSECAP_SOLAR_OTA") {}
void begin(); void begin();
#if defined(P_LORA_TX_LED) #if defined(P_LORA_TX_LED)

View File

@@ -4,12 +4,12 @@
#include <Arduino.h> #include <Arduino.h>
#include <helpers/NRF52Board.h> #include <helpers/NRF52Board.h>
class T1000eBoard : public NRF52BoardDCDC, public NRF52BoardOTA { class T1000eBoard : public NRF52BoardDCDC {
protected: protected:
uint8_t btn_prev_state; uint8_t btn_prev_state;
public: public:
T1000eBoard() : NRF52BoardOTA("T1000E_OTA") {} T1000eBoard() : NRF52Board("T1000E_OTA") {}
void begin(); void begin();
uint16_t getBattMilliVolts() override { uint16_t getBattMilliVolts() override {

View File

@@ -13,9 +13,9 @@
#define PIN_VBAT_READ (4) #define PIN_VBAT_READ (4)
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
class ThinkNodeM1Board : public NRF52BoardOTA { class ThinkNodeM1Board : public NRF52Board {
public: public:
ThinkNodeM1Board() : NRF52BoardOTA("THINKNODE_M1_OTA") {} ThinkNodeM1Board() : NRF52Board("THINKNODE_M1_OTA") {}
void begin(); void begin();
uint16_t getBattMilliVolts() override; uint16_t getBattMilliVolts() override;

View File

@@ -4,12 +4,12 @@
#include <Arduino.h> #include <Arduino.h>
#include <helpers/NRF52Board.h> #include <helpers/NRF52Board.h>
class WioTrackerL1Board : public NRF52BoardDCDC, public NRF52BoardOTA { class WioTrackerL1Board : public NRF52BoardDCDC {
protected: protected:
uint8_t btn_prev_state; uint8_t btn_prev_state;
public: public:
WioTrackerL1Board() : NRF52BoardOTA("WioTrackerL1 OTA") {} WioTrackerL1Board() : NRF52Board("WioTrackerL1 OTA") {}
void begin(); void begin();
#if defined(P_LORA_TX_LED) #if defined(P_LORA_TX_LED)

View File

@@ -11,9 +11,9 @@
#endif #endif
#define Serial Serial1 #define Serial Serial1
class WioWM1110Board : public NRF52BoardDCDC, public NRF52BoardOTA { class WioWM1110Board : public NRF52BoardDCDC {
public: public:
WioWM1110Board() : NRF52BoardOTA("WM1110_OTA") {} WioWM1110Board() : NRF52Board("WM1110_OTA") {}
void begin(); void begin();
#if defined(LED_GREEN) #if defined(LED_GREEN)

View File

@@ -6,9 +6,9 @@
#ifdef XIAO_NRF52 #ifdef XIAO_NRF52
class XiaoNrf52Board : public NRF52BoardDCDC, public NRF52BoardOTA { class XiaoNrf52Board : public NRF52BoardDCDC {
public: public:
XiaoNrf52Board() : NRF52BoardOTA("XIAO_NRF52_OTA") {} XiaoNrf52Board() : NRF52Board("XIAO_NRF52_OTA") {}
void begin(); void begin();
#if defined(P_LORA_TX_LED) #if defined(P_LORA_TX_LED)