Merge pull request #448 from fdlamotte/rak3x72_LP_Support

rak3x72: support variations in platformio.ini
This commit is contained in:
ripplebiz
2025-06-25 22:27:06 +10:00
committed by GitHub
3 changed files with 18 additions and 5 deletions

View File

@@ -7,6 +7,8 @@ build_flags = ${stm32_base.build_flags}
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
-D SPI_INTERFACES_COUNT=0
-D RX_BOOSTED_GAIN=true
; -D STM32WL_TCXO_VOLTAGE=1.6 ; defaults to 0 if undef
; -D LORA_TX_POWER=14 ; Defaults to 22 for HP, 14 is for LP version
-I variants/rak3x72
build_src_filter = ${stm32_base.build_src_filter}
+<../variants/rak3x72>
@@ -14,7 +16,6 @@ build_src_filter = ${stm32_base.build_src_filter}
[env:rak3x72-repeater]
extends = rak3x72
build_flags = ${rak3x72.build_flags}
-D LORA_TX_POWER=22
-D ADVERT_NAME='"RAK3x72 Repeater"'
-D ADMIN_PASSWORD='"password"'
build_src_filter = ${rak3x72.build_src_filter}
@@ -24,7 +25,6 @@ build_src_filter = ${rak3x72.build_src_filter}
extends = rak3x72
build_flags = ${rak3x72.build_flags}
; -D FORMAT_FS=true
-D LORA_TX_POWER=22
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
build_src_filter = ${rak3x72.build_src_filter}

View File

@@ -24,12 +24,21 @@ SensorManager sensors;
#define LORA_CR 5
#endif
#ifndef STM32WL_TCXO_VOLTAGE
// TCXO set to 0 for RAK3172
#define STM32WL_TCXO_VOLTAGE 0
#endif
#ifndef LORA_TX_POWER
#define LORA_TX_POWER 22
#endif
bool radio_init() {
// rtc_clock.begin(Wire);
radio.setRfSwitchTable(rfswitch_pins, rfswitch_table);
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, 0, 0); // TCXO set to 0 for RAK3172
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, STM32WL_TCXO_VOLTAGE, 0);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");

View File

@@ -18,8 +18,12 @@ public:
}
uint16_t getBattMilliVolts() override {
uint32_t raw = analogRead(PIN_VBAT_READ);
return (ADC_MULTIPLIER * raw) / 1024;
analogReadResolution(12);
uint32_t raw = 0;
for (int i=0; i<8;i++) {
raw += analogRead(PIN_VBAT_READ);
}
return ((double)raw) * ADC_MULTIPLIER / 8 / 4096;
}
};