Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions variants/rak3x72/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ 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>

[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}
Expand All @@ -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}
Expand Down
11 changes: 10 additions & 1 deletion variants/rak3x72/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: ");
Expand Down
8 changes: 6 additions & 2 deletions variants/rak3x72/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ class RAK3x72Board : public STM32Board {
}

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;
}
};

Expand Down