Skip to content

Commit ac79b38

Browse files
authored
Merge pull request #1246 from fschrempf/nrf-dcdc
NRF52 boards: Enable internal DC/DC regulator to reduce power consumption and enable OTA support for all boards
2 parents c0194d8 + 3f3978c commit ac79b38

28 files changed

Lines changed: 60 additions & 316 deletions

File tree

src/helpers/NRF52Board.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ float NRF52Board::getMCUTemperature() {
271271
return temp * 0.25f; // Convert to *C
272272
}
273273

274-
bool NRF52BoardOTA::startOTAUpdate(const char *id, char reply[]) {
274+
bool NRF52Board::startOTAUpdate(const char *id, char reply[]) {
275275
// Config the peripheral connection with maximum bandwidth
276276
// more SRAM required by SoftDevice
277277
// Note: All config***() function must be called before begin()

src/helpers/NRF52Board.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class NRF52Board : public mesh::MainBoard {
3131

3232
protected:
3333
uint8_t startup_reason;
34+
char *ota_name;
3435

3536
#ifdef NRF52_POWER_MANAGEMENT
3637
uint32_t reset_reason; // RESETREAS register value
@@ -44,10 +45,12 @@ class NRF52Board : public mesh::MainBoard {
4445
#endif
4546

4647
public:
48+
NRF52Board(char *otaname) : ota_name(otaname) {}
4749
virtual void begin();
4850
virtual uint8_t getStartupReason() const override { return startup_reason; }
4951
virtual float getMCUTemperature() override;
5052
virtual void reboot() override { NVIC_SystemReset(); }
53+
virtual bool startOTAUpdate(const char *id, char reply[]) override;
5154

5255
#ifdef NRF52_POWER_MANAGEMENT
5356
bool isExternalPowered() override;
@@ -68,15 +71,7 @@ class NRF52Board : public mesh::MainBoard {
6871
*/
6972
class NRF52BoardDCDC : virtual public NRF52Board {
7073
public:
74+
NRF52BoardDCDC() {}
7175
virtual void begin() override;
7276
};
73-
74-
class NRF52BoardOTA : virtual public NRF52Board {
75-
private:
76-
char *ota_name;
77-
78-
public:
79-
NRF52BoardOTA(char *name) : ota_name(name) {}
80-
virtual bool startOTAUpdate(const char *id, char reply[]) override;
81-
};
8277
#endif

variants/heltec_mesh_solar/MeshSolarBoard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#define SX126X_DIO2_AS_RF_SWITCH true
2121
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
2222

23-
class MeshSolarBoard : public NRF52BoardOTA {
23+
class MeshSolarBoard : public NRF52BoardDCDC {
2424
public:
25-
MeshSolarBoard() : NRF52BoardOTA("MESH_SOLAR_OTA") {}
25+
MeshSolarBoard() : NRF52Board("MESH_SOLAR_OTA") {}
2626
void begin();
2727

2828
uint16_t getBattMilliVolts() override {

variants/heltec_t114/T114Board.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
#define PIN_BAT_CTL 6
1010
#define MV_LSB (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range
1111

12-
class T114Board : public NRF52BoardOTA {
12+
class T114Board : public NRF52BoardDCDC {
1313
protected:
1414
#ifdef NRF52_POWER_MANAGEMENT
1515
void initiateShutdown(uint8_t reason) override;
1616
#endif
1717

1818
public:
19-
T114Board() : NRF52BoardOTA("T114_OTA") {}
19+
T114Board() : NRF52Board("T114_OTA") {}
2020
void begin();
2121

2222
#if defined(P_LORA_TX_LED)

variants/ikoka_handheld_nrf/IkokaNrf52Board.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#ifdef IKOKA_NRF52
88

9-
class IkokaNrf52Board : public NRF52BoardOTA {
9+
class IkokaNrf52Board : public NRF52BoardDCDC {
1010
public:
11-
IkokaNrf52Board() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
11+
IkokaNrf52Board() : NRF52Board("XIAO_NRF52_OTA") {}
1212
void begin();
1313

1414
#if defined(P_LORA_TX_LED)

variants/ikoka_nano_nrf/IkokaNanoNRFBoard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#ifdef XIAO_NRF52
88

9-
class IkokaNanoNRFBoard : public NRF52BoardOTA {
9+
class IkokaNanoNRFBoard : public NRF52BoardDCDC {
1010
public:
11-
IkokaNanoNRFBoard() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
11+
IkokaNanoNRFBoard() : NRF52Board("XIAO_NRF52_OTA") {}
1212
void begin();
1313

1414
#if defined(P_LORA_TX_LED)

variants/ikoka_stick_nrf/IkokaStickNRFBoard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#ifdef XIAO_NRF52
88

9-
class IkokaStickNRFBoard : public NRF52BoardOTA {
9+
class IkokaStickNRFBoard : public NRF52BoardDCDC {
1010
public:
11-
IkokaStickNRFBoard() : NRF52BoardOTA("XIAO_NRF52_OTA") {}
11+
IkokaStickNRFBoard() : NRF52Board("XIAO_NRF52_OTA") {}
1212
void begin();
1313

1414
#if defined(P_LORA_TX_LED)

variants/keepteen_lt1/KeepteenLT1Board.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#include <Arduino.h>
55
#include <helpers/NRF52Board.h>
66

7-
class KeepteenLT1Board : public NRF52BoardOTA {
7+
class KeepteenLT1Board : public NRF52Board {
88
protected:
99
uint8_t btn_prev_state;
1010

1111
public:
12-
KeepteenLT1Board() : NRF52BoardOTA("KeepteenLT1_OTA") {}
12+
KeepteenLT1Board() : NRF52Board("KeepteenLT1_OTA") {}
1313
void begin();
1414

1515
#define BATTERY_SAMPLES 8

variants/lilygo_techo/TechoBoard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#define PIN_VBAT_READ (4)
1414
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
1515

16-
class TechoBoard : public NRF52BoardOTA {
16+
class TechoBoard : public NRF52BoardDCDC {
1717
public:
18-
TechoBoard() : NRF52BoardOTA("TECHO_OTA") {}
18+
TechoBoard() : NRF52Board("TECHO_OTA") {}
1919
void begin();
2020
uint16_t getBattMilliVolts() override;
2121

variants/lilygo_techo_lite/TechoBoard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#define PIN_VBAT_READ (4)
1414
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
1515

16-
class TechoBoard : public NRF52BoardOTA {
16+
class TechoBoard : public NRF52BoardDCDC {
1717
public:
18-
TechoBoard() : NRF52BoardOTA("TECHO_OTA") {}
18+
TechoBoard() : NRF52Board("TECHO_OTA") {}
1919
void begin();
2020
uint16_t getBattMilliVolts() override;
2121

0 commit comments

Comments
 (0)