mirror of
https://github.com/agessaman/MeshCore.git
synced 2026-09-25 13:24:15 +00:00
Completes the FEM RX-gain restoration begun in the CAD/prefs change, which
persisted radio_fem_rxgain but didn't yet drive the hardware. Also dropped
by the 22eb9b87 revert; restored to match upstream.
- MainBoard: setLoRaFemLnaEnabled()/canControlLoRaFemLna()/isLoRaFemLnaEnabled()
virtuals (default: can't control — non-FEM boards report unsupported)
- heltec_v4: board overrides driving loRaFEMControl; LoRaFEMControl gains the
isLNAEnabled() getter (it already tracked lna_enabled and drove the FEM)
- CLI: `set radio.fem.rxgain on/off` / `get radio.fem.rxgain` (guarded by
canControlLoRaFemLna, so it reports "unsupported" on non-FEM boards)
- app startup applies the persisted pref: board.setLoRaFemLnaEnabled(
_prefs.radio_fem_rxgain), beside setRxBoostedGainMode
Default is ON (upstream), so on FEM boards the LNA is enabled after upgrade —
a real reception behavior change to confirm on hardware. The other FEM
variants (heltec_t096/tower_v2/tracker_v2) need the same small board-override
addition; until then `radio.fem.rxgain` reports unsupported there (no
regression — status quo).
Builds: heltec_v4 repeater-observer + room-observer (FEM board), Heltec_v3
repeater (non-FEM, base virtuals no-op). NEEDS on-device validation on a
Heltec V4.
31 lines
787 B
C++
31 lines
787 B
C++
#pragma once
|
|
#include <stdint.h>
|
|
|
|
typedef enum {
|
|
GC1109_PA,
|
|
KCT8103L_PA,
|
|
OTHER_FEM_TYPES
|
|
} LoRaFEMType;
|
|
|
|
class LoRaFEMControl
|
|
{
|
|
public:
|
|
LoRaFEMControl(){ }
|
|
virtual ~LoRaFEMControl(){ }
|
|
void init(void);
|
|
void setSleepModeEnable(void);
|
|
void setTxModeEnable(void);
|
|
void setRxModeEnable(void);
|
|
void setRxModeEnableWhenMCUSleep(void);
|
|
void setLNAEnable(bool enabled);
|
|
bool isLnaCanControl(void) const { return lna_can_control; }
|
|
bool isLNAEnabled(void) const { return lna_enabled; }
|
|
void setLnaCanControl(bool can_control) { lna_can_control = can_control; }
|
|
LoRaFEMType getFEMType(void) const { return fem_type; }
|
|
private:
|
|
LoRaFEMType fem_type=OTHER_FEM_TYPES;
|
|
bool lna_enabled=false;
|
|
bool lna_can_control=false;
|
|
};
|
|
|