mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-07-25 23:31:47 +00:00
fix(room_server): support RX boosted gain
The room server never supported RX boosted gain, while the repeater does. Three consequences on SX1262/SX1268 boards: - boosted gain was never applied to the radio at boot, so a room server ran in power-saving RX mode while an identical repeater ran boosted - a real receive-sensitivity difference with nothing pointing at it - _prefs.rx_boosted_gain was never initialised (the prefs are memset to 0 before defaults are set), so it defaulted to off - 'set radio.rxgain on' replied "Error: unsupported" but CommonCLI had already written the value to prefs and saved them, so a stale setting survived reboot and was never applied Mirror the repeater's implementation: initialise the pref default under the same USE_SX1262/USE_SX1268 and SX126X_RX_BOOSTED_GAIN guards, apply it during radio init, and override setRxBoostedGain() so the CLI reports success and takes effect. Built Heltec_v3_room_server (SX1262) and LilyGo_T3S3_sx1276_room_server (guards compile out cleanly).
This commit is contained in:
@@ -658,6 +658,14 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
||||
_prefs.gps_enabled = 0;
|
||||
_prefs.gps_interval = 0;
|
||||
_prefs.advert_loc_policy = ADVERT_LOC_PREFS;
|
||||
|
||||
#if defined(USE_SX1262) || defined(USE_SX1268)
|
||||
#ifdef SX126X_RX_BOOSTED_GAIN
|
||||
_prefs.rx_boosted_gain = SX126X_RX_BOOSTED_GAIN;
|
||||
#else
|
||||
_prefs.rx_boosted_gain = 1; // enabled by default;
|
||||
#endif
|
||||
#endif
|
||||
_prefs.radio_fem_rxgain = 1;
|
||||
|
||||
next_post_idx = 0;
|
||||
@@ -700,6 +708,7 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
|
||||
radio_driver.setParams(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
|
||||
radio_driver.setTxPower(_prefs.tx_power_dbm);
|
||||
radio_driver.setRxBoostedGainMode(_prefs.rx_boosted_gain);
|
||||
board.setLoRaFemLnaEnabled(_prefs.radio_fem_rxgain);
|
||||
|
||||
updateAdvertTimer();
|
||||
@@ -807,6 +816,10 @@ void MyMesh::setTxPower(int8_t power_dbm) {
|
||||
radio_driver.setTxPower(power_dbm);
|
||||
}
|
||||
|
||||
bool MyMesh::setRxBoostedGain(bool enable) {
|
||||
return radio_driver.setRxBoostedGainMode(enable);
|
||||
}
|
||||
|
||||
void MyMesh::saveIdentity(const mesh::LocalIdentity &new_id) {
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
IdentityStore store(*_fs, "");
|
||||
|
||||
@@ -206,6 +206,7 @@ public:
|
||||
|
||||
void dumpLogFile() override;
|
||||
void setTxPower(int8_t power_dbm) override;
|
||||
bool setRxBoostedGain(bool enable) override;
|
||||
|
||||
void formatNeighborsReply(char *reply) override {
|
||||
strcpy(reply, "not supported");
|
||||
|
||||
Reference in New Issue
Block a user