sx126x-rx-boosted-gain: add support for setting Rx gain mode on SX126x chipsets

This commit is contained in:
Andrew Moroz 2023-01-16 23:35:56 -05:00
parent cc0cccbd1b
commit 0a2539650e
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

@ -162,6 +162,7 @@ void NodeDB::installDefaultConfig()
config.has_bluetooth = true;
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;
config.lora.sx126x_rx_boosted_gain = false;
config.lora.region = Config_LoRaConfig_RegionCode_UNSET;
config.lora.modem_preset = Config_LoRaConfig_ModemPreset_LONG_FAST;
config.lora.hop_limit = HOP_RELIABLE;

View File

@ -1,5 +1,6 @@
#include "configuration.h"
#include "SX126xInterface.h"
#include "mesh/NodeDB.h"
#include "error.h"
// Particular boards might define a different max power based on what their hardware can do
@ -73,6 +74,14 @@ 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;