Skip to content

Commit 61301da

Browse files
authored
Merge pull request #415 from jquatier/thinknode-std_init
Thinknode radio.std_init refactor
2 parents 5eb0847 + bbde446 commit 61301da

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

variants/thinknode_m1/target.cpp

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,9 @@ ThinkNodeM1SensorManager sensors = ThinkNodeM1SensorManager(nmea);
1818
DISPLAY_CLASS display;
1919
#endif
2020

21-
#ifndef LORA_CR
22-
#define LORA_CR 5
23-
#endif
24-
2521
bool radio_init() {
2622
rtc_clock.begin(Wire);
27-
28-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
29-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
30-
#else
31-
float tcxo = 1.6f;
32-
#endif
33-
34-
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
35-
SPI.begin();
36-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
37-
if (status != RADIOLIB_ERR_NONE) {
38-
Serial.print("ERROR: radio init failed: ");
39-
Serial.println(status);
40-
return false; // fail
41-
}
42-
43-
radio.setCRC(1);
44-
45-
#ifdef SX126X_CURRENT_LIMIT
46-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
47-
#endif
48-
#ifdef SX126X_DIO2_AS_RF_SWITCH
49-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
50-
#endif
51-
#ifdef SX126X_RX_BOOSTED_GAIN
52-
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
53-
#endif
54-
55-
return true; // success
23+
return radio.std_init(&SPI);
5624
}
5725

5826
uint32_t radio_get_rng_seed() {

0 commit comments

Comments
 (0)