Add normalradio to common CLI

This commit is contained in:
mikecarper committed 2026-08-19 12:44:49 -07:00
1 parent 5ba511cfb7
commit a39bbbd467
12 files changed
+67 -8

No files matched your search

+15
View File
@@ -4239,6 +4239,21 @@ void MyMesh::applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr,
refreshScheduledRadioState();
}
bool MyMesh::scheduleNormalRadio() {
// Cancel every pending/active temporary entry, but leave permanent radioat
// changes intact. The saved apply waits for the CLI reply to leave the
// outbound queue before changing modulation parameters.
for (int i = 0; i < MAX_SCHEDULED_RADIO_SETTINGS; i++) {
if (!scheduled_radio_settings[i].temporary) continue;
scheduled_radio_settings[i].active = false;
scheduled_radio_settings[i].started = false;
}
temp_radio_handoff_pending = false;
refreshScheduledRadioState();
queueSavedRadioApply();
return true;
}
bool MyMesh::formatFileSystem() {
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
return InternalFS.format();
+1
View File
@@ -869,6 +869,7 @@ public:
// CommonCLICallbacks
void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) override;
bool scheduleNormalRadio() override;
#if defined(ESP32_PLATFORM) || defined(USER_GPIO_CONTROL)
uint32_t getUserGpioRequestSource() const override {
return _gpio_reply_tracker.requestSource();
+10
View File
@@ -1443,6 +1443,16 @@ void MyMesh::applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr,
revert_radio_at = futureMillis(2000 + timeout_mins * 60 * 1000); // schedule when to revert radio params
}
bool MyMesh::scheduleNormalRadio() {
// A one-tick deadline cancels a not-yet-applied window or restores an active
// one as soon as the command reply has drained from the outbound queue.
set_radio_at = 0;
revert_radio_at = futureMillis(1);
radio_apply_retry_at = 0;
radio_apply_failures = 0;
return true;
}
bool MyMesh::formatFileSystem() {
#if defined(NRF52_PLATFORM)
return InternalFS.format();
+1
View File
@@ -371,6 +371,7 @@ public:
// CommonCLICallbacks
void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) override;
bool scheduleNormalRadio() override;
#if defined(ESP32_PLATFORM) || defined(USER_GPIO_CONTROL)
uint32_t getUserGpioRequestSource() const override {
return _gpio_reply_tracker.requestSource();
+10
View File
@@ -1062,6 +1062,16 @@ void SensorMesh::applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t
revert_radio_at = futureMillis(2000 + timeout_mins*60*1000); // schedule when to revert radio params
}
bool SensorMesh::scheduleNormalRadio() {
// Keep the reply on the current tuple, then let the existing safe restore
// path wait for an idle outbound queue before touching the radio.
set_radio_at = 0;
revert_radio_at = futureMillis(1);
radio_apply_retry_at = 0;
radio_apply_failures = 0;
return true;
}
void SensorMesh::sendSelfAdvertisement(int delay_millis, bool flood) {
mesh::Packet* pkt = createSelfAdvert();
if (pkt) {
+1
View File
@@ -93,6 +93,7 @@ public:
void saveIdentity(const mesh::LocalIdentity& new_id) override;
void clearStats() override { }
void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) override;
bool scheduleNormalRadio() override;
#if defined(ESP32_PLATFORM) || defined(USER_GPIO_CONTROL)
uint32_t getUserGpioRequestSource() const override {
return _gpio_reply_tracker.requestSource();