mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-11-22 05:27:02 +00:00
Boards own their FEM control through handleCommand() ("get/set
radio.fem.rxgain|txgain"). Use that instead of a parallel set of FEM
virtuals on MainBoard, so any board that implements the commands works
in KISS with no extra code.
- Remove the six FEM virtuals from MainBoard and the board overrides.
- KissModem talks to the board in one adapter. A gain counts as
controllable only if "get" replies exactly "> on" or "> off". "set"
is checked by reading the state back, never by its reply wording.
- SetFemState always replies with the read-back state once the
requested bits pass the capability check.
- Guard the boards' prefs writes against a NULL store. KISS attaches
no prefs, so "set radio.fem.*" would dereference NULL.
- Wio Tracker L1 1W TX gain is exposed again, matching its CLI.
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <helpers/RefCountedDigitalPin.h>
|
|
#include <helpers/ESP32Board.h>
|
|
#include "LoRaFEMControl.h"
|
|
|
|
#ifndef ADC_MULTIPLIER
|
|
#define ADC_MULTIPLIER 5.42
|
|
#endif
|
|
|
|
class HeltecV4Board : public ESP32Board {
|
|
KeyValueStore* _prefs = NULL;
|
|
|
|
bool setLoRaFemLnaEnabled(bool enable);
|
|
bool isLoRaFemLnaEnabled() const;
|
|
|
|
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 attachDynamicPrefs(KeyValueStore* prefs);
|
|
bool handleCommand(const char* command, uint32_t sender_timestamp, char* reply) override;
|
|
|
|
void onBeforeTransmit(void) override;
|
|
void onAfterTransmit(void) override;
|
|
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;
|
|
};
|