Skip to content

Commit 8090992

Browse files
authored
Merge pull request #429 from oltaco/rak4631-radioinit-refactor
refactor: RAK4631 with CustomSX1262::std_init()
2 parents 81a0816 + 9eff882 commit 8090992

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

variants/rak4631/target.cpp

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ RAK4631SensorManager sensors;
2323
DISPLAY_CLASS display;
2424
#endif
2525

26-
#ifndef LORA_CR
27-
#define LORA_CR 5
28-
#endif
29-
3026
#ifdef MESH_DEBUG
3127
uint32_t deviceOnline = 0x00;
3228
void scanDevices(TwoWire *w)
@@ -75,35 +71,7 @@ void scanDevices(TwoWire *w)
7571

7672
bool radio_init() {
7773
rtc_clock.begin(Wire);
78-
79-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
80-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
81-
#else
82-
float tcxo = 1.6f;
83-
#endif
84-
85-
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
86-
SPI.begin();
87-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
88-
if (status != RADIOLIB_ERR_NONE) {
89-
Serial.print("ERROR: radio init failed: ");
90-
Serial.println(status);
91-
return false; // fail
92-
}
93-
94-
radio.setCRC(1);
95-
96-
#ifdef SX126X_CURRENT_LIMIT
97-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
98-
#endif
99-
#ifdef SX126X_DIO2_AS_RF_SWITCH
100-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
101-
#endif
102-
#ifdef SX126X_RX_BOOSTED_GAIN
103-
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
104-
#endif
105-
106-
return true; // success
74+
return radio.std_init(&SPI);
10775
}
10876

10977
uint32_t radio_get_rng_seed() {

0 commit comments

Comments
 (0)