Skip to content

Commit c6d4b75

Browse files
authored
Merge pull request #538 from oltaco/ct62-std-init
Heltec CT62: use radio.std_init()
2 parents a2e3e66 + c578366 commit c6d4b75

File tree

1 file changed

+2
-35
lines changed

1 file changed

+2
-35
lines changed

variants/heltec_ct62/target.cpp

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,10 @@ ESP32RTCClock fallback_clock;
1010
AutoDiscoverRTCClock rtc_clock(fallback_clock);
1111
SensorManager sensors;
1212

13-
#ifndef LORA_CR
14-
#define LORA_CR 5
15-
#endif
16-
1713
bool radio_init() {
1814
fallback_clock.begin();
19-
rtc_clock.begin(Wire);
20-
21-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
22-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
23-
#else
24-
float tcxo = 1.6f;
25-
#endif
26-
27-
#if defined(P_LORA_SCLK)
28-
SPI.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
29-
#endif
30-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
31-
if (status != RADIOLIB_ERR_NONE) {
32-
Serial.print("ERROR: radio init failed: ");
33-
Serial.println(status);
34-
return false; // fail
35-
}
36-
37-
radio.setCRC(1);
38-
39-
#ifdef SX126X_CURRENT_LIMIT
40-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
41-
#endif
42-
#ifdef SX126X_DIO2_AS_RF_SWITCH
43-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
44-
#endif
45-
#ifdef SX126X_RX_BOOSTED_GAIN
46-
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
47-
#endif
48-
49-
return true; // success
15+
rtc_clock.begin(Wire);
16+
return radio.std_init(&SPI);
5017
}
5118

5219
uint32_t radio_get_rng_seed() {

0 commit comments

Comments
 (0)