Skip to content

Commit fe0234d

Browse files
authored
Merge pull request #449 from recrof/dev
Station G2 refactor for radio.std_init, set max tx power to 19dBm
2 parents 56df7d1 + f15f32e commit fe0234d

File tree

2 files changed

+5
-28
lines changed

2 files changed

+5
-28
lines changed

variants/station_g2/platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build_flags =
77
-D STATION_G2
88
-D RADIO_CLASS=CustomSX1262
99
-D WRAPPER_CLASS=CustomSX1262Wrapper
10-
-D LORA_TX_POWER=7
10+
-D LORA_TX_POWER=19
1111
; -D P_LORA_TX_LED=35
1212
-D PIN_BOARD_SDA=5
1313
-D PIN_BOARD_SCL=6
@@ -16,9 +16,9 @@ build_flags =
1616
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
1717
-D SX126X_CURRENT_LIMIT=140
1818
; -D SX126X_RX_BOOSTED_GAIN=1 - DO NOT ENABLE THIS!
19+
; https://wiki.uniteng.com/en/meshtastic/station-g2#impact-of-lora-node-dense-areashigh-noise-environments-on-rf-performance
1920
-I src/helpers/ui
2021
-D DISPLAY_CLASS=SH1106Display
21-
; https://wiki.uniteng.com/en/meshtastic/station-g2#impact-of-lora-node-dense-areashigh-noise-environments-on-rf-performance
2222
build_src_filter = ${esp32_base.build_src_filter}
2323
+<../variants/station_g2>
2424
+<helpers/ui/SH1106Display.cpp>

variants/station_g2/target.cpp

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,13 @@ SensorManager sensors;
2727
bool radio_init() {
2828
fallback_clock.begin();
2929
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
3630

3731
#if defined(P_LORA_SCLK)
3832
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
33+
return radio.std_init(&spi);
34+
#else
35+
return radio.std_init();
3936
#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-
#ifdef SX126X_CURRENT_LIMIT
50-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
51-
#endif
52-
#ifdef SX126X_DIO2_AS_RF_SWITCH
53-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
54-
#endif
55-
#ifdef SX126X_RX_BOOSTED_GAIN
56-
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
57-
#endif
58-
59-
return true; // success
6037
}
6138

6239
uint32_t radio_get_rng_seed() {

0 commit comments

Comments
 (0)