Skip to content

Commit d36da0e

Browse files
Alex WoldenAlex Wolden
authored andcommitted
Refactor naming
1 parent ed320ac commit d36da0e

File tree

7 files changed

+116
-241
lines changed

7 files changed

+116
-241
lines changed

examples/companion_radio/main.cpp

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,14 @@
6868
#include <helpers/CustomSX1262Wrapper.h>
6969
#include <helpers/CustomSX1268Wrapper.h>
7070
static XiaoC3Board board;
71-
#elif defined(SEEED_XIAO_S3)
71+
#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3)
7272
#include <helpers/ESP32Board.h>
7373
#include <helpers/CustomSX1262Wrapper.h>
7474
static ESP32Board board;
75-
#elif defined(LILYGO_T3)
76-
#include <helpers/ESP32Board.h>
75+
#elif defined(LILYGO_TLORA)
76+
#include <helpers/LilyGoTLoraBoard.h>
7777
#include <helpers/CustomSX1276Wrapper.h>
78-
static ESP32Board board;
79-
#elif defined(LILYGO_T3S3)
80-
#include <helpers/LilyGoT3S3Board.h>
81-
#if defined(P_LORA_DIO_0) // If P_LORA_DIO_0 is defined, we're using SX1276
82-
#include <helpers/CustomSX1276Wrapper.h>
83-
#else
84-
#include <helpers/CustomSX1262Wrapper.h>
85-
#endif
86-
static LilyGoT3S3Board board;
78+
static LilyGoTLoraBoard board;
8779
#elif defined(RAK_4631)
8880
#include <helpers/nrf52/RAK4631Board.h>
8981
#include <helpers/CustomSX1262Wrapper.h>
@@ -1120,7 +1112,7 @@ class MyMesh : public BaseChatMesh {
11201112

11211113
#if defined(NRF52_PLATFORM)
11221114
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
1123-
#elif defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
1115+
#elif defined(LILYGO_TLORA) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
11241116
SPIClass spi;
11251117
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
11261118
#elif defined(P_LORA_SCLK)
@@ -1141,24 +1133,19 @@ void setup() {
11411133
Serial.begin(115200);
11421134

11431135
board.begin();
1136+
#ifdef SX126X_DIO3_TCXO_VOLTAGE
1137+
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
1138+
#else
1139+
float tcxo = 1.6f;
1140+
#endif
1141+
11441142
#if defined(NRF52_PLATFORM)
11451143
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
11461144
SPI.begin();
11471145
#elif defined(P_LORA_SCLK)
11481146
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
11491147
#endif
1150-
1151-
#if defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
1152-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX127X_SYNC_WORD, LORA_TX_POWER);
1153-
#else // SX126X module
1154-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
1155-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
1156-
#else
1157-
float tcxo = 1.6f;
1158-
#endif
11591148
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
1160-
#endif
1161-
11621149
if (status != RADIOLIB_ERR_NONE) {
11631150
Serial.print("ERROR: radio init failed: ");
11641151
Serial.println(status);
@@ -1167,14 +1154,12 @@ void setup() {
11671154

11681155
radio.setCRC(0);
11691156

1170-
#if !defined(LILYGO_T3) && !defined(HELTEC_LORA_V2) // SX126X specific settings
1171-
#ifdef SX126X_CURRENT_LIMIT
1172-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
1173-
#endif
1157+
#ifdef SX126X_CURRENT_LIMIT
1158+
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
1159+
#endif
11741160

1175-
#ifdef SX126X_DIO2_AS_RF_SWITCH
1176-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
1177-
#endif
1161+
#ifdef SX126X_DIO2_AS_RF_SWITCH
1162+
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
11781163
#endif
11791164

11801165
fast_rng.begin(radio.random(0x7FFFFFFF));

examples/simple_repeater/main.cpp

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,14 @@
7272
#include <helpers/CustomSX1262Wrapper.h>
7373
#include <helpers/CustomSX1268Wrapper.h>
7474
static XiaoC3Board board;
75-
#elif defined(SEEED_XIAO_S3)
75+
#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3)
7676
#include <helpers/ESP32Board.h>
7777
#include <helpers/CustomSX1262Wrapper.h>
7878
static ESP32Board board;
79-
#elif defined(LILYGO_T3)
80-
#include <helpers/ESP32Board.h>
79+
#elif defined(LILYGO_TLORA)
80+
#include <helpers/LilyGoTLoraBoard.h>
8181
#include <helpers/CustomSX1276Wrapper.h>
82-
static ESP32Board board;
83-
#elif defined(LILYGO_T3S3)
84-
#include <helpers/LilyGoT3S3Board.h>
85-
#if defined(P_LORA_DIO_0) // If P_LORA_DIO_0 is defined, we're using SX1276
86-
#include <helpers/CustomSX1276Wrapper.h>
87-
#else
88-
#include <helpers/CustomSX1262Wrapper.h>
89-
#endif
90-
static LilyGoT3S3Board board;
82+
static LilyGoTLoraBoard board;
9183
#elif defined(RAK_4631)
9284
#include <helpers/nrf52/RAK4631Board.h>
9385
#include <helpers/CustomSX1262Wrapper.h>
@@ -616,7 +608,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
616608

617609
#if defined(NRF52_PLATFORM)
618610
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
619-
#elif defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
611+
#elif defined(LILYGO_TLORA) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
620612
SPIClass spi;
621613
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
622614
#elif defined(P_LORA_SCLK)
@@ -653,24 +645,18 @@ void setup() {
653645
#endif
654646
rtc_clock.begin(Wire);
655647

648+
#ifdef SX126X_DIO3_TCXO_VOLTAGE
649+
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
650+
#else
651+
float tcxo = 1.6f;
652+
#endif
656653
#if defined(NRF52_PLATFORM)
657654
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
658655
SPI.begin();
659656
#elif defined(P_LORA_SCLK)
660657
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
661658
#endif
662-
663-
#if defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
664-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX127X_SYNC_WORD, LORA_TX_POWER);
665-
#else // SX126X module
666-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
667-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
668-
#else
669-
float tcxo = 1.6f;
670-
#endif
671659
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
672-
#endif
673-
674660
if (status != RADIOLIB_ERR_NONE) {
675661
delay(5000);
676662
Serial.print("ERROR: radio init failed: ");
@@ -680,14 +666,12 @@ void setup() {
680666

681667
radio.setCRC(0);
682668

683-
#if !defined(LILYGO_T3) && !defined(HELTEC_LORA_V2) // SX126X specific settings
684-
#ifdef SX126X_CURRENT_LIMIT
685-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
686-
#endif
669+
#ifdef SX126X_CURRENT_LIMIT
670+
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
671+
#endif
687672

688-
#ifdef SX126X_DIO2_AS_RF_SWITCH
689-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
690-
#endif
673+
#ifdef SX126X_DIO2_AS_RF_SWITCH
674+
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
691675
#endif
692676

693677
fast_rng.begin(radio.random(0x7FFFFFFF));

examples/simple_room_server/main.cpp

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,14 @@
7676
#include <helpers/CustomSX1262Wrapper.h>
7777
#include <helpers/CustomSX1268Wrapper.h>
7878
static XiaoC3Board board;
79-
#elif defined(SEEED_XIAO_S3)
79+
#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3)
8080
#include <helpers/ESP32Board.h>
8181
#include <helpers/CustomSX1262Wrapper.h>
8282
static ESP32Board board;
83-
#elif defined(LILYGO_T3)
84-
#include <helpers/ESP32Board.h>
83+
#elif defined(LILYGO_TLORA)
84+
#include <helpers/LilyGoTLoraBoard.h>
8585
#include <helpers/CustomSX1276Wrapper.h>
86-
static ESP32Board board;
87-
#elif defined(LILYGO_T3S3)
88-
#include <helpers/LilyGoT3S3Board.h>
89-
#if defined(P_LORA_DIO_0) // If P_LORA_DIO_0 is defined, we're using SX1276
90-
#include <helpers/CustomSX1276Wrapper.h>
91-
#else
92-
#include <helpers/CustomSX1262Wrapper.h>
93-
#endif
94-
static LilyGoT3S3Board board;
86+
static LilyGoTLoraBoard board;
9587
#elif defined(RAK_4631)
9688
#include <helpers/nrf52/RAK4631Board.h>
9789
#include <helpers/CustomSX1262Wrapper.h>
@@ -671,7 +663,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
671663

672664
#if defined(NRF52_PLATFORM)
673665
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
674-
#elif defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
666+
#elif defined(LILYGO_TLORA) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
675667
SPIClass spi;
676668
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
677669
#elif defined(P_LORA_SCLK)
@@ -708,24 +700,19 @@ void setup() {
708700
#endif
709701
rtc_clock.begin(Wire);
710702

703+
#ifdef SX126X_DIO3_TCXO_VOLTAGE
704+
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
705+
#else
706+
float tcxo = 1.6f;
707+
#endif
708+
711709
#if defined(NRF52_PLATFORM)
712710
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
713711
SPI.begin();
714712
#elif defined(P_LORA_SCLK)
715713
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
716714
#endif
717-
718-
#if defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
719-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX127X_SYNC_WORD, LORA_TX_POWER);
720-
#else // SX126X module
721-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
722-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
723-
#else
724-
float tcxo = 1.6f;
725-
#endif
726715
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
727-
#endif
728-
729716
if (status != RADIOLIB_ERR_NONE) {
730717
delay(5000);
731718
Serial.print("ERROR: radio init failed: ");
@@ -735,14 +722,12 @@ void setup() {
735722

736723
radio.setCRC(0);
737724

738-
#if !defined(LILYGO_T3) && !defined(HELTEC_LORA_V2) // SX126X specific settings
739-
#ifdef SX126X_CURRENT_LIMIT
740-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
741-
#endif
725+
#ifdef SX126X_CURRENT_LIMIT
726+
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
727+
#endif
742728

743-
#ifdef SX126X_DIO2_AS_RF_SWITCH
744-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
745-
#endif
729+
#ifdef SX126X_DIO2_AS_RF_SWITCH
730+
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
746731
#endif
747732

748733
fast_rng.begin(radio.random(0x7FFFFFFF));

examples/simple_secure_chat/main.cpp

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,14 @@
6262
#include <helpers/CustomSX1262Wrapper.h>
6363
#include <helpers/CustomSX1268Wrapper.h>
6464
static XiaoC3Board board;
65-
#elif defined(SEEED_XIAO_S3)
65+
#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3)
6666
#include <helpers/ESP32Board.h>
6767
#include <helpers/CustomSX1262Wrapper.h>
6868
static ESP32Board board;
69-
#elif defined(LILYGO_T3)
70-
#include <helpers/ESP32Board.h>
69+
#elif defined(LILYGO_TLORA)
70+
#include <helpers/LilyGoTLoraBoard.h>
7171
#include <helpers/CustomSX1276Wrapper.h>
72-
static ESP32Board board;
73-
#elif defined(LILYGO_T3S3)
74-
#include <helpers/LilyGoT3S3Board.h>
75-
#if defined(P_LORA_DIO_0) // If P_LORA_DIO_0 is defined, we're using SX1276
76-
#include <helpers/CustomSX1276Wrapper.h>
77-
#else
78-
#include <helpers/CustomSX1262Wrapper.h>
79-
#endif
80-
static LilyGoT3S3Board board;
72+
static LilyGoTLoraBoard board;
8173
#elif defined(RAK_4631)
8274
#include <helpers/nrf52/RAK4631Board.h>
8375
#include <helpers/CustomSX1262Wrapper.h>
@@ -553,7 +545,7 @@ class MyMesh : public BaseChatMesh, ContactVisitor {
553545

554546
#if defined(NRF52_PLATFORM)
555547
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
556-
#elif defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
548+
#elif defined(LILYGO_TLORA) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
557549
SPIClass spi;
558550
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
559551
#elif defined(P_LORA_SCLK)
@@ -574,24 +566,19 @@ void setup() {
574566
Serial.begin(115200);
575567

576568
board.begin();
569+
#ifdef SX126X_DIO3_TCXO_VOLTAGE
570+
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
571+
#else
572+
float tcxo = 1.6f;
573+
#endif
574+
577575
#if defined(NRF52_PLATFORM)
578576
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
579577
SPI.begin();
580578
#elif defined(P_LORA_SCLK)
581579
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
582580
#endif
583-
584-
#if defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
585-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX127X_SYNC_WORD, LORA_TX_POWER);
586-
#else // SX126X module
587-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
588-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
589-
#else
590-
float tcxo = 1.6f;
591-
#endif
592581
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
593-
#endif
594-
595582
if (status != RADIOLIB_ERR_NONE) {
596583
Serial.print("ERROR: radio init failed: ");
597584
Serial.println(status);
@@ -600,14 +587,12 @@ void setup() {
600587

601588
radio.setCRC(0);
602589

603-
#if !defined(LILYGO_T3) && !defined(HELTEC_LORA_V2) // SX126X specific settings
604-
#ifdef SX126X_CURRENT_LIMIT
605-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
606-
#endif
590+
#ifdef SX126X_CURRENT_LIMIT
591+
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
592+
#endif
607593

608-
#ifdef SX126X_DIO2_AS_RF_SWITCH
609-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
610-
#endif
594+
#ifdef SX126X_DIO2_AS_RF_SWITCH
595+
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
611596
#endif
612597

613598
fast_rng.begin(radio.random(0x7FFFFFFF));

0 commit comments

Comments
 (0)