mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-11-21 22:47:05 +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.
30 lines
800 B
C++
30 lines
800 B
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 handleCommand(const char*, uint32_t, char*) { return false; }
|
|
};
|
|
|
|
}
|