mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-30 12:45:45 +00:00
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:
@@ -54,7 +54,7 @@ float NRF52Board::getMCUTemperature() {
|
||||
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
|
||||
// more SRAM required by SoftDevice
|
||||
// Note: All config***() function must be called before begin()
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
class NRF52Board : public mesh::MainBoard {
|
||||
protected:
|
||||
uint8_t startup_reason;
|
||||
char *ota_name;
|
||||
|
||||
public:
|
||||
NRF52Board(char *otaname) : ota_name(otaname) {}
|
||||
virtual void begin();
|
||||
virtual uint8_t getStartupReason() const override { return startup_reason; }
|
||||
virtual float getMCUTemperature() override;
|
||||
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 {
|
||||
public:
|
||||
NRF52BoardDCDC() {}
|
||||
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
|
||||
@@ -20,9 +20,9 @@
|
||||
#define SX126X_DIO2_AS_RF_SWITCH true
|
||||
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||
|
||||
class MeshSolarBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class MeshSolarBoard : public NRF52BoardDCDC {
|
||||
public:
|
||||
MeshSolarBoard() : NRF52BoardOTA("MESH_SOLAR_OTA") {}
|
||||
MeshSolarBoard() : NRF52Board("MESH_SOLAR_OTA") {}
|
||||
void begin();
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
|
||||
@@ -9,9 +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 NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class T114Board : public NRF52BoardDCDC {
|
||||
public:
|
||||
T114Board() : NRF52BoardOTA("T114_OTA") {}
|
||||
T114Board() : NRF52Board("T114_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(P_LORA_TX_LED)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#ifdef IKOKA_NRF52
|
||||
|
||||
class IkokaNrf52Board : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class IkokaNrf52Board : public NRF52BoardDCDC {
|
||||
public:
|
||||
IkokaNrf52Board() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
|
||||
IkokaNrf52Board() : NRF52Board("XIAO_NRF52_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(P_LORA_TX_LED)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#ifdef XIAO_NRF52
|
||||
|
||||
class IkokaNanoNRFBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class IkokaNanoNRFBoard : public NRF52BoardDCDC {
|
||||
public:
|
||||
IkokaNanoNRFBoard() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
|
||||
IkokaNanoNRFBoard() : NRF52Board("XIAO_NRF52_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(P_LORA_TX_LED)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#ifdef XIAO_NRF52
|
||||
|
||||
class IkokaStickNRFBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class IkokaStickNRFBoard : public NRF52BoardDCDC {
|
||||
public:
|
||||
IkokaStickNRFBoard() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
|
||||
IkokaStickNRFBoard() : NRF52Board("XIAO_NRF52_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(P_LORA_TX_LED)
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include <Arduino.h>
|
||||
#include <helpers/NRF52Board.h>
|
||||
|
||||
class KeepteenLT1Board : public NRF52BoardOTA {
|
||||
class KeepteenLT1Board : public NRF52Board {
|
||||
protected:
|
||||
uint8_t btn_prev_state;
|
||||
|
||||
public:
|
||||
KeepteenLT1Board() : NRF52BoardOTA("KeepteenLT1_OTA") {}
|
||||
KeepteenLT1Board() : NRF52Board("KeepteenLT1_OTA") {}
|
||||
void begin();
|
||||
|
||||
#define BATTERY_SAMPLES 8
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#define PIN_VBAT_READ (4)
|
||||
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
||||
|
||||
class TechoBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class TechoBoard : public NRF52BoardDCDC {
|
||||
public:
|
||||
TechoBoard() : NRF52BoardOTA("TECHO_OTA") {}
|
||||
TechoBoard() : NRF52Board("TECHO_OTA") {}
|
||||
void begin();
|
||||
uint16_t getBattMilliVolts() override;
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#define PIN_VBAT_READ (4)
|
||||
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
||||
|
||||
class TechoBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class TechoBoard : public NRF52BoardDCDC {
|
||||
public:
|
||||
TechoBoard() : NRF52BoardOTA("TECHO_OTA") {}
|
||||
TechoBoard() : NRF52Board("TECHO_OTA") {}
|
||||
void begin();
|
||||
uint16_t getBattMilliVolts() override;
|
||||
|
||||
|
||||
@@ -9,9 +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 NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class HeltecMeshPocket : public NRF52BoardDCDC {
|
||||
public:
|
||||
HeltecMeshPocket() : NRF52BoardOTA("MESH_POCKET_OTA") {}
|
||||
HeltecMeshPocket() : NRF52Board("MESH_POCKET_OTA") {}
|
||||
void begin();
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
|
||||
@@ -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 NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class MinewsemiME25LS01Board : public NRF52BoardDCDC {
|
||||
protected:
|
||||
uint8_t btn_prev_state;
|
||||
|
||||
public:
|
||||
MinewsemiME25LS01Board() : NRF52BoardOTA("Minewsemi_OTA") {}
|
||||
MinewsemiME25LS01Board() : NRF52Board("Minewsemi_OTA") {}
|
||||
void begin();
|
||||
|
||||
#define BATTERY_SAMPLES 8
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
#define PIN_VBAT_READ (0 + 2)
|
||||
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
||||
|
||||
class NanoG2Ultra : public NRF52BoardOTA {
|
||||
class NanoG2Ultra : public NRF52Board {
|
||||
public:
|
||||
NanoG2Ultra() : NRF52BoardOTA("NANO_G2_OTA") {}
|
||||
NanoG2Ultra() : NRF52Board("NANO_G2_OTA") {}
|
||||
void begin();
|
||||
uint16_t getBattMilliVolts() override;
|
||||
|
||||
|
||||
@@ -20,13 +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 NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class PromicroBoard : public NRF52BoardDCDC {
|
||||
protected:
|
||||
uint8_t btn_prev_state;
|
||||
float adc_mult = ADC_MULTIPLIER;
|
||||
|
||||
public:
|
||||
PromicroBoard() : NRF52BoardOTA("ProMicro_OTA") {}
|
||||
PromicroBoard() : NRF52Board("ProMicro_OTA") {}
|
||||
void begin();
|
||||
|
||||
#define BATTERY_SAMPLES 8
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
#define PIN_VBAT_READ 5
|
||||
#define ADC_MULTIPLIER (3 * 1.73 * 1.187 * 1000)
|
||||
|
||||
class RAK4631Board : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class RAK4631Board : public NRF52BoardDCDC {
|
||||
public:
|
||||
RAK4631Board() : NRF52BoardOTA("RAK4631_OTA") {}
|
||||
RAK4631Board() : NRF52Board("RAK4631_OTA") {}
|
||||
void begin();
|
||||
|
||||
#define BATTERY_SAMPLES 8
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#define PIN_VBAT_READ 5
|
||||
#define ADC_MULTIPLIER (3 * 1.73 * 1.187 * 1000)
|
||||
|
||||
class RAKWismeshTagBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class RAKWismeshTagBoard : public NRF52BoardDCDC {
|
||||
public:
|
||||
RAKWismeshTagBoard() : NRF52BoardOTA("WISMESHTAG_OTA") {}
|
||||
RAKWismeshTagBoard() : NRF52Board("WISMESHTAG_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(P_LORA_TX_LED) && defined(LED_STATE_ON)
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#include <Arduino.h>
|
||||
#include <helpers/NRF52Board.h>
|
||||
|
||||
class SenseCapSolarBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class SenseCapSolarBoard : public NRF52BoardDCDC {
|
||||
public:
|
||||
SenseCapSolarBoard() : NRF52BoardOTA("SENSECAP_SOLAR_OTA") {}
|
||||
SenseCapSolarBoard() : NRF52Board("SENSECAP_SOLAR_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(P_LORA_TX_LED)
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include <Arduino.h>
|
||||
#include <helpers/NRF52Board.h>
|
||||
|
||||
class T1000eBoard : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class T1000eBoard : public NRF52BoardDCDC {
|
||||
protected:
|
||||
uint8_t btn_prev_state;
|
||||
|
||||
public:
|
||||
T1000eBoard() : NRF52BoardOTA("T1000E_OTA") {}
|
||||
T1000eBoard() : NRF52Board("T1000E_OTA") {}
|
||||
void begin();
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#define PIN_VBAT_READ (4)
|
||||
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
||||
|
||||
class ThinkNodeM1Board : public NRF52BoardOTA {
|
||||
class ThinkNodeM1Board : public NRF52Board {
|
||||
public:
|
||||
ThinkNodeM1Board() : NRF52BoardOTA("THINKNODE_M1_OTA") {}
|
||||
ThinkNodeM1Board() : NRF52Board("THINKNODE_M1_OTA") {}
|
||||
void begin();
|
||||
uint16_t getBattMilliVolts() override;
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include <Arduino.h>
|
||||
#include <helpers/NRF52Board.h>
|
||||
|
||||
class WioTrackerL1Board : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class WioTrackerL1Board : public NRF52BoardDCDC {
|
||||
protected:
|
||||
uint8_t btn_prev_state;
|
||||
|
||||
public:
|
||||
WioTrackerL1Board() : NRF52BoardOTA("WioTrackerL1 OTA") {}
|
||||
WioTrackerL1Board() : NRF52Board("WioTrackerL1 OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(P_LORA_TX_LED)
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#endif
|
||||
#define Serial Serial1
|
||||
|
||||
class WioWM1110Board : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class WioWM1110Board : public NRF52BoardDCDC {
|
||||
public:
|
||||
WioWM1110Board() : NRF52BoardOTA("WM1110_OTA") {}
|
||||
WioWM1110Board() : NRF52Board("WM1110_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(LED_GREEN)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#ifdef XIAO_NRF52
|
||||
|
||||
class XiaoNrf52Board : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
class XiaoNrf52Board : public NRF52BoardDCDC {
|
||||
public:
|
||||
XiaoNrf52Board() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
|
||||
XiaoNrf52Board() : NRF52Board("XIAO_NRF52_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(P_LORA_TX_LED)
|
||||
|
||||
Reference in New Issue
Block a user