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.
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <MeshCore.h>
|
|
#include <Arduino.h>
|
|
#include <helpers/NRF52Board.h>
|
|
|
|
class WioTrackerL1Board : public NRF52BoardDCDC {
|
|
protected:
|
|
uint8_t btn_prev_state;
|
|
bool _is_pa_enabled = false;
|
|
KeyValueStore* _prefs = NULL;
|
|
|
|
public:
|
|
WioTrackerL1Board() : NRF52Board("WioTrackerL1 OTA") {}
|
|
void begin();
|
|
void attachDynamicPrefs(KeyValueStore* prefs);
|
|
bool handleCommand(const char* command, uint32_t sender_timestamp, char* reply) override;
|
|
bool canControlLoRaFemPaGain() const override { return true; }
|
|
bool setLoRaFemPaGainEnabled(bool enable) override;
|
|
bool isLoRaFemPaGainEnabled() const override { return _is_pa_enabled; }
|
|
|
|
#if defined(P_LORA_TX_LED)
|
|
void onBeforeTransmit() override {
|
|
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
|
|
}
|
|
void onAfterTransmit() override {
|
|
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
|
|
}
|
|
#endif
|
|
|
|
uint16_t getBattMilliVolts() override {
|
|
int adcvalue = 0;
|
|
analogReadResolution(12);
|
|
analogReference(AR_INTERNAL);
|
|
delay(10);
|
|
adcvalue = analogRead(PIN_VBAT_READ);
|
|
return (adcvalue * ADC_MULTIPLIER * AREF_VOLTAGE) / 4.096;
|
|
}
|
|
|
|
const char* getManufacturerName() const override {
|
|
return "Seeed Wio Tracker L1";
|
|
}
|
|
|
|
void powerOff() override {
|
|
setLoRaFemPaGainEnabled(false); // turn Off PA
|
|
NRF52Board::powerOff();
|
|
}
|
|
};
|