Skip to content

Commit b6b15e5

Browse files
authored
Merge pull request #428 from 446564/radio-init-nano-g2
update nano g2 to use radio.std_init
2 parents 60d0064 + b99d294 commit b6b15e5

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

variants/nano_g2_ultra/target.cpp

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,10 @@ NanoG2UltraSensorManager sensors = NanoG2UltraSensorManager(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
{
2723
rtc_clock.begin(Wire);
28-
29-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
30-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
31-
#else
32-
float tcxo = 1.6f;
33-
#endif
34-
35-
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
36-
SPI.begin();
37-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
38-
if (status != RADIOLIB_ERR_NONE)
39-
{
40-
Serial.print("ERROR: radio init failed: ");
41-
Serial.println(status);
42-
return false; // fail
43-
}
44-
45-
radio.setCRC(1);
46-
47-
#ifdef SX126X_CURRENT_LIMIT
48-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
49-
#endif
50-
#ifdef SX126X_DIO2_AS_RF_SWITCH
51-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
52-
#endif
53-
#ifdef SX126X_RX_BOOSTED_GAIN
54-
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
55-
#endif
56-
57-
return true; // success
24+
return radio.std_init(&SPI);
5825
}
5926

6027
uint32_t radio_get_rng_seed()

0 commit comments

Comments
 (0)