Unblock LR2021 retunes and add saved crystal calibration
Repeated preamble/header activity can keep a requested primary or TempRadio change busy indefinitely. Bound unfinished-RX admission for accepted LR2021 changes while preserving completed packets, TX, BUSY and exclusive owners. Ordinary scans and CAD keep their existing admission rules. Expose the failing stage and native status through get radio.apply. Add saved radio.xtrim capacitor calibration and measured radio.freqerror in signed Hz from the last valid LoRa packet. Preserve native trim by default, restore explicit calibration after resets/Morse, verify saves before applying, wait two seconds for the acknowledgement, and roll back failed changes. Calibration motivation and prior upstream work: https://github.com/meshcore-dev/MeshCore/issues/3365 https://github.com/recrof/MeshCore/tree/lr2021-trim Packet-status format follows Semtech's LR20xx driver and RadioLib staging. Tests execute production activity/admission and transaction paths with noisy RX, completion races, protected owners, failed setters, RX restart and save rollback. Physical W12 retuning and RF calibration still require confirmation.
This commit is contained in:
1 parent
b00d346df7
commit
8a8c80ee6a
32 files changed
+1913
-34
No files matched your search
@@ -25,10 +25,17 @@ COMMON = r'''
|
||||
#include <initializer_list>
|
||||
#include <RadioProfiles.h>
|
||||
#include <helpers/radiolib/LR1110ProfileSwitchState.h>
|
||||
#include <helpers/radiolib/LR2021ApplyStatus.h>
|
||||
#define MESH_ENABLE_TX_BEACONS 1
|
||||
#define MESH_ENABLE_MESHTEXT_WIRE 1
|
||||
#define RADIOLIB_ERR_NONE 0
|
||||
#define RADIOLIB_LR2021_LORA_SYNC_WORD_PRIVATE 0x12
|
||||
struct ApplyRecorder {
|
||||
mesh::lr2021::ApplyStatus _apply_status;
|
||||
int16_t recordApply(mesh::lr2021::ApplyStatus::Stage stage, int16_t code) {
|
||||
return _apply_status.record(stage, code);
|
||||
}
|
||||
};
|
||||
struct Wire {
|
||||
unsigned calls = 0, fail = 0;
|
||||
uint8_t sync = 0x12;
|
||||
@@ -74,7 +81,7 @@ struct Custom@FAMILY@ : @FAMILY@ {
|
||||
bool _profilePacketDirty = true;
|
||||
@PROTOCOL@
|
||||
};
|
||||
struct Wrapper {
|
||||
struct Wrapper : ApplyRecorder {
|
||||
Custom@FAMILY@ chip;
|
||||
Custom@FAMILY@* _radio = &chip;
|
||||
@SUPPORT@
|
||||
@@ -138,6 +145,7 @@ int main() {
|
||||
#define USE_LR2021 1
|
||||
#define LORA_BW 125
|
||||
#define RADIOLIB_ERR_UNKNOWN -1
|
||||
#define RADIOLIB_ERR_INVALID_SIDE_DETECT -1000
|
||||
#define RADIOLIB_CHANNEL_FREE -2
|
||||
#define MESH_DEBUG_PRINTLN(...) ((void)0)
|
||||
#include <helpers/radiolib/LR2021SideDetectorConfig.h>
|
||||
@@ -176,7 +184,7 @@ struct Board {
|
||||
unsigned watchdog_services = 0;
|
||||
void serviceWatchdog() { ++watchdog_services; }
|
||||
};
|
||||
struct Wrapper : RadioLibWrapper {
|
||||
struct Wrapper : RadioLibWrapper, ApplyRecorder {
|
||||
CustomLR2021 chip;
|
||||
CustomLR2021* _radio = &chip;
|
||||
Board board;
|
||||
|
||||
Reference in new issue
Block a user