mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-11-22 16:07:58 +00:00
Add SetHardware sub-commands so a host can probe and configure per-board RF front-end settings: - GetCapabilities (0x1B): uint32 feature bits (AGC, FEM RX, FEM TX) - Set/GetAgcResetInterval (0x1C/0x1D): 0-1020 s, 4 s resolution, 0 disables; default stays 30 s - Set/GetFemState (0x1E/0x1F): apply/value masks for FEM RX (LNA) and TX (PA) gain; all-or-nothing, Unsupported (0x08) if any requested bit is not controllable on this board The AGC scheduler moves from main.cpp into KissModem so it is configurable and unit-tested. FEM changes that arrive mid-TX are deferred until the packet ends, since board setters drive FEM pins directly. MainBoard gains virtual FEM hooks (canControl/set/is for LNA and PA gain). Boards that already implemented these methods privately now expose them as overrides: Heltec V4, V4 R8, T096, Tracker V2, Station G3 and Wio Tracker L1 1W. KISS_FIRMWARE_VERSION bumped to 2.
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
namespace mesh {
|
|
|
|
class Radio {
|
|
public:
|
|
virtual ~Radio() = default;
|
|
virtual bool isReceiving() { return false; }
|
|
virtual uint32_t getEstAirtimeFor(uint16_t) { return 10; }
|
|
virtual bool startSendRaw(const uint8_t*, uint16_t) { return true; }
|
|
virtual bool isSendComplete() { return true; }
|
|
virtual void onSendFinished() {}
|
|
virtual int16_t getNoiseFloor() { return -120; }
|
|
virtual void resetAGC() {}
|
|
};
|
|
|
|
class MainBoard {
|
|
public:
|
|
virtual ~MainBoard() = default;
|
|
virtual uint16_t getBattMilliVolts() { return 4200; }
|
|
virtual float getMCUTemperature() { return 25.0f; }
|
|
virtual const char* getManufacturerName() { return "mock-board"; }
|
|
virtual void reboot() {}
|
|
virtual bool canControlLoRaFemLna() const { return false; }
|
|
virtual bool setLoRaFemLnaEnabled(bool) { return false; }
|
|
virtual bool isLoRaFemLnaEnabled() const { return false; }
|
|
virtual bool canControlLoRaFemPaGain() const { return false; }
|
|
virtual bool setLoRaFemPaGainEnabled(bool) { return false; }
|
|
virtual bool isLoRaFemPaGainEnabled() const { return false; }
|
|
};
|
|
|
|
}
|