Merge pull request #2157 from andrew-moroz/sx126x-rx-boosted-gain

sx126x-rx-boosted-gain: add support for setting Rx gain mode on SX126x chipsets
This commit is contained in:
Ben Meadors 2023-01-24 11:54:16 -06:00 committed by GitHub
commit 0b1e1687ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -66,7 +66,7 @@ lib_deps =
nanopb/Nanopb@^0.4.6
erriez/ErriezCRC32@^1.0.1
; jgromes/RadioLib@^5.5.1
https://github.com/jgromes/RadioLib.git#395844922c5d88d5db0481a9c91479931172428d
https://github.com/jgromes/RadioLib.git#7a25b27c3183ffe3627c5c221243c378d8951da7
; Used for the code analysis in PIO Home / Inspect
check_tool = cppcheck

View File

@ -160,6 +160,7 @@ void NodeDB::installDefaultConfig()
config.has_power = true;
config.has_network = true;
config.has_bluetooth = true;
config.lora.sx126x_rx_boosted_gain = false;
config.lora.tx_enabled =
true; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off)
config.lora.override_duty_cycle = false;

View File

@ -1,4 +1,5 @@
#include "SX126xInterface.h"
#include "mesh/NodeDB.h"
#include "configuration.h"
#include "error.h"
@ -78,6 +79,14 @@ template <typename T> bool SX126xInterface<T>::init()
res = lora.setDio2AsRfSwitch(true);
#endif
if (config.lora.sx126x_rx_boosted_gain) {
uint16_t result = lora.setRxBoostedGainMode(true);
LOG_INFO("Set Rx Boosted Gain mode; result: %d\n", result);
} else {
uint16_t result = lora.setRxBoostedGainMode(false);
LOG_INFO("Set Rx Power Saving Gain mode; result: %d\n", result);
}
#if 0
// Read/write a register we are not using (only used for FSK mode) to test SPI comms
uint8_t crcLSB = 0;