mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge pull request #448 from fdlamotte/rak3x72_LP_Support
rak3x72: support variations in platformio.ini
This commit is contained in:
commit
56df7d15a7
3 changed files with 18 additions and 5 deletions
|
|
@ -7,6 +7,8 @@ build_flags = ${stm32_base.build_flags}
|
||||||
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
|
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
|
||||||
-D SPI_INTERFACES_COUNT=0
|
-D SPI_INTERFACES_COUNT=0
|
||||||
-D RX_BOOSTED_GAIN=true
|
-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
|
-I variants/rak3x72
|
||||||
build_src_filter = ${stm32_base.build_src_filter}
|
build_src_filter = ${stm32_base.build_src_filter}
|
||||||
+<../variants/rak3x72>
|
+<../variants/rak3x72>
|
||||||
|
|
@ -14,7 +16,6 @@ build_src_filter = ${stm32_base.build_src_filter}
|
||||||
[env:rak3x72-repeater]
|
[env:rak3x72-repeater]
|
||||||
extends = rak3x72
|
extends = rak3x72
|
||||||
build_flags = ${rak3x72.build_flags}
|
build_flags = ${rak3x72.build_flags}
|
||||||
-D LORA_TX_POWER=22
|
|
||||||
-D ADVERT_NAME='"RAK3x72 Repeater"'
|
-D ADVERT_NAME='"RAK3x72 Repeater"'
|
||||||
-D ADMIN_PASSWORD='"password"'
|
-D ADMIN_PASSWORD='"password"'
|
||||||
build_src_filter = ${rak3x72.build_src_filter}
|
build_src_filter = ${rak3x72.build_src_filter}
|
||||||
|
|
@ -24,7 +25,6 @@ build_src_filter = ${rak3x72.build_src_filter}
|
||||||
extends = rak3x72
|
extends = rak3x72
|
||||||
build_flags = ${rak3x72.build_flags}
|
build_flags = ${rak3x72.build_flags}
|
||||||
; -D FORMAT_FS=true
|
; -D FORMAT_FS=true
|
||||||
-D LORA_TX_POWER=22
|
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=8
|
-D MAX_GROUP_CHANNELS=8
|
||||||
build_src_filter = ${rak3x72.build_src_filter}
|
build_src_filter = ${rak3x72.build_src_filter}
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,21 @@ SensorManager sensors;
|
||||||
#define LORA_CR 5
|
#define LORA_CR 5
|
||||||
#endif
|
#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() {
|
bool radio_init() {
|
||||||
// rtc_clock.begin(Wire);
|
// rtc_clock.begin(Wire);
|
||||||
|
|
||||||
radio.setRfSwitchTable(rfswitch_pins, rfswitch_table);
|
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) {
|
if (status != RADIOLIB_ERR_NONE) {
|
||||||
Serial.print("ERROR: radio init failed: ");
|
Serial.print("ERROR: radio init failed: ");
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getBattMilliVolts() override {
|
uint16_t getBattMilliVolts() override {
|
||||||
uint32_t raw = analogRead(PIN_VBAT_READ);
|
analogReadResolution(12);
|
||||||
return (ADC_MULTIPLIER * raw) / 1024;
|
uint32_t raw = 0;
|
||||||
|
for (int i=0; i<8;i++) {
|
||||||
|
raw += analogRead(PIN_VBAT_READ);
|
||||||
|
}
|
||||||
|
return ((double)raw) * ADC_MULTIPLIER / 8 / 4096;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue