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.
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <helpers/RefCountedDigitalPin.h>
|
|
#include <helpers/ESP32Board.h>
|
|
#include <driver/rtc_io.h>
|
|
#include "LoRaFEMControl.h"
|
|
|
|
#ifndef ADC_MULTIPLIER
|
|
#define ADC_MULTIPLIER 5.42
|
|
#endif
|
|
|
|
class HeltecV4Board : public ESP32Board {
|
|
|
|
protected:
|
|
float adc_mult = ADC_MULTIPLIER;
|
|
|
|
public:
|
|
RefCountedDigitalPin periph_power;
|
|
LoRaFEMControl loRaFEMControl;
|
|
HeltecV4Board() : periph_power(PIN_VEXT_EN,PIN_VEXT_EN_ACTIVE) { }
|
|
|
|
void begin();
|
|
void onBeforeTransmit(void) override;
|
|
void onAfterTransmit(void) override;
|
|
void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1);
|
|
void powerOff() override;
|
|
uint16_t getBattMilliVolts() override;
|
|
bool setAdcMultiplier(float multiplier) override {
|
|
if (multiplier == 0.0f) {
|
|
adc_mult = ADC_MULTIPLIER;
|
|
} else {
|
|
adc_mult = multiplier;
|
|
}
|
|
return true;
|
|
}
|
|
float getAdcMultiplier() const override { return adc_mult; }
|
|
const char* getManufacturerName() const override;
|
|
|
|
bool setLoRaFemLnaEnabled(bool enable) override;
|
|
bool canControlLoRaFemLna() const override;
|
|
bool isLoRaFemLnaEnabled() const override;
|
|
};
|