mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-08-28 02:54:54 +00:00
PA PL1 re-targets the PA's DC-DC supply rail rather than selecting a logic-level gain, and the serial CLI is serviced on every main-loop pass regardless of whether a transmit is in flight. A `set radio.fem.txgain` write could therefore move the rail mid-transmit, while the SX1262 was still driving the PA at full input power. Record the requested level in setPAGainEnable() and drive the pin from setTxModeEnable(), which runs from onBeforeTransmit() ahead of startTransmit(). The level only matters while transmitting, so deferring costs nothing. Document that the pref is saved immediately but applied at the next transmit, so `get radio.fem.txgain` can lead the hardware until then.
23 lines
484 B
C++
23 lines
484 B
C++
#pragma once
|
|
|
|
class LoRaFEMControl {
|
|
public:
|
|
void init();
|
|
void setSleepModeEnable();
|
|
void setTxModeEnable();
|
|
void setRxModeEnable();
|
|
void setLNAEnable(bool enabled);
|
|
void setPAGainEnable(bool enabled);
|
|
|
|
bool canControlLNA() const;
|
|
bool canControlPAGain() const;
|
|
bool isLNAEnabled() const { return lna_enabled; }
|
|
bool isPAGainEnabled() const { return pa_gain_enabled; }
|
|
|
|
private:
|
|
void applyPAGain();
|
|
|
|
bool lna_enabled = true;
|
|
bool pa_gain_enabled = false;
|
|
};
|