Skip to content

Commit ea7a84b

Browse files
authored
Merge pull request #427 from cod3doomy/dev
T-Beam refactor for radio.std_init
2 parents 1295c46 + ff10f37 commit ea7a84b

File tree

2 files changed

+2
-52
lines changed

2 files changed

+2
-52
lines changed

variants/lilygo_tbeam_SX1262/target.cpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,10 @@ 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
36-
37-
#if defined(P_LORA_SCLK)
38-
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
39-
#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
26+
return radio.std_init(&spi);
5027
}
5128

5229
uint32_t radio_get_rng_seed() {

variants/lilygo_tbeam_supreme_SX1262/target.cpp

Lines changed: 1 addition & 28 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);
@@ -261,32 +257,9 @@ static bool readStringUntil(Stream& s, char dest[], size_t max_len, char term, u
261257

262258
bool radio_init() {
263259
fallback_clock.begin();
264-
265260
rtc_clock.begin(Wire1);
266-
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;
261+
return radio.std_init(&spi);
275262
#endif
276-
277-
#if defined(P_LORA_SCLK)
278-
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
279-
#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
290263
}
291264

292265
uint32_t radio_get_rng_seed() {

0 commit comments

Comments
 (0)