Skip to content

Commit 7bcfbd3

Browse files
committed
T-Beam refactor for radio.std_init
Changed radio init for both T-beam (SX1262) and Supreme (SX1262) to include radio.std_init()
1 parent 7f0f3b7 commit 7bcfbd3

File tree

2 files changed

+6
-44
lines changed

2 files changed

+6
-44
lines changed

variants/lilygo_tbeam_SX1262/target.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,16 @@ SensorManager sensors;
2020
DISPLAY_CLASS display;
2121
#endif
2222

23-
#ifndef LORA_CR
24-
#define LORA_CR 5
25-
#endif
26-
2723
bool radio_init() {
2824
fallback_clock.begin();
2925
rtc_clock.begin(Wire);
30-
31-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
32-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
33-
#else
34-
float tcxo = 1.6f;
35-
#endif
3626

3727
#if defined(P_LORA_SCLK)
3828
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
29+
return radio.std_init(&spi);
30+
#else
31+
return radio.std_init();
3932
#endif
40-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
41-
if (status != RADIOLIB_ERR_NONE) {
42-
Serial.print("ERROR: radio init failed: ");
43-
Serial.println(status);
44-
return false; // fail
45-
}
46-
47-
radio.setCRC(1);
48-
49-
return true; // success
5033
}
5134

5235
uint32_t radio_get_rng_seed() {

variants/lilygo_tbeam_supreme_SX1262/target.cpp

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ TBeamS3SupremeBoard board;
1010

1111
bool pmuIntFlag;
1212

13-
#ifndef LORA_CR
14-
#define LORA_CR 5
15-
#endif
16-
1713
#if defined(P_LORA_SCLK)
1814
static SPIClass spi;
1915
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
@@ -264,29 +260,12 @@ bool radio_init() {
264260

265261
rtc_clock.begin(Wire1);
266262

267-
// #ifdef MESH_DEBUG
268-
// printBMEValues();
269-
// #endif
270-
271-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
272-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
273-
#else
274-
float tcxo = 1.6f;
275-
#endif
276-
277263
#if defined(P_LORA_SCLK)
278264
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
265+
return radio.std_init(&spi);
266+
#else
267+
return radio.std_init();
279268
#endif
280-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
281-
if (status != RADIOLIB_ERR_NONE) {
282-
Serial.print("ERROR: radio init failed: ");
283-
Serial.println(status);
284-
return false; // fail
285-
}
286-
287-
radio.setCRC(1);
288-
289-
return true; // success
290269
}
291270

292271
uint32_t radio_get_rng_seed() {

0 commit comments

Comments
 (0)