Apply saved TX power automatically across firmware roles

This commit is contained in:
mikecarper committed 2026-10-25 14:08:15 -07:00
1 parent 31e5d54074
commit 65928aae95
51 files changed
+3838 -2728

No files matched your search

+12 -1
View File
@@ -1110,6 +1110,7 @@ bool SensorMesh::handleIncomingMsg(ClientInfo& from, uint32_t timestamp, uint8_t
#if !MESH_ENABLE_SENSOR_TRACKER
void SensorMesh::onSendComplete(mesh::Packet* packet) {
mesh::Mesh::onSendComplete(packet);
_cli.servicePendingTxPower();
_cli.morseReply().complete(packet);
}
@@ -1460,6 +1461,16 @@ bool SensorMesh::setTxPower(int8_t power_dbm) {
return radio_driver.setTxPower(power_dbm);
}
mesh::RadioParamApplyResult SensorMesh::trySetTxPower(int8_t power_dbm) {
return radio_driver.trySetTxPower(power_dbm);
}
#if defined(MESH_HIL_TX_FREQ_MHZ)
bool SensorMesh::isTxPowerApplied(int8_t power_dbm) const {
return radio_driver.isTxPowerApplied(power_dbm);
}
#endif
bool SensorMesh::setRxPowerSaving(bool enable, uint32_t rx_us, uint32_t sleep_us) {
return radio_driver.setRxPowerSaving(enable, rx_us, sleep_us);
}
@@ -1730,7 +1741,7 @@ mesh::powerdiag::Mask SensorMesh::pendingWorkReason() const {
#endif
if (!canIdleDualRadio()) return mask(Reason::DualRadio);
if (hasPendingOtaApply()) return mask(Reason::Ota);
if (_cli.hasActiveUserGpioTimer()) return mask(Reason::Scheduled);
if (_cli.hasActiveUserGpioTimer() || _cli.hasPendingTxPower()) return mask(Reason::Scheduled);
if (radio_driver.isWatchdogObserving()) return mask(Reason::RadioWatchdog);
uint32_t noise_floor_delay_ms;
if (getNextNoiseFloorWakeDelay(noise_floor_delay_ms) && noise_floor_delay_ms == 0)
+5 -1
View File
@@ -73,7 +73,7 @@ public:
void loop();
bool canRecoverUsbLogging() const {
return dirty_contacts_expiry == 0 && !hasOutbound() && !isAnyTempRadioActive()
&& !hasPendingOtaApply() && !saved_radio_apply_pending
&& !hasPendingOtaApply() && !saved_radio_apply_pending && !_cli.hasPendingTxPower()
&& set_radio_at == 0;
}
void handleCommand(uint32_t sender_timestamp, char* command, char* reply,
@@ -115,6 +115,10 @@ public:
void eraseLogFile() override { }
void dumpLogFile() override { }
bool setTxPower(int8_t power_dbm) override;
mesh::RadioParamApplyResult trySetTxPower(int8_t power_dbm) override;
#if defined(MESH_HIL_TX_FREQ_MHZ)
bool isTxPowerApplied(int8_t power_dbm) const override;
#endif
bool setRxPowerSaving(bool enable, uint32_t rx_us, uint32_t sleep_us) override;
void recalibrateNoiseFloor() override { _radio->recalibrateNoiseFloor(); }
void getRxPsWatchdogCounts(uint32_t* soft, uint32_t* hard) override;
+3 -1
View File
@@ -83,7 +83,8 @@ bool SensorMesh::trackerNeedsRadio() const {
|| board.isRadioTestActive() || mesh::isUsbLoggingWatchdogArmed()
|| isAnyTempRadioActive() || hasPendingOtaApply() || isDualRadioActive()
|| set_radio_at || revert_radio_at || saved_radio_apply_pending
|| _cli.hasActiveUserGpioTimer() || hasOutbound() || _mgr->getOutboundTotal() != 0)
|| _cli.hasActiveUserGpioTimer() || _cli.hasPendingTxPower()
|| hasOutbound() || _mgr->getOutboundTotal() != 0)
return true;
uint32_t delay;
if (hasPendingRadioWork() || getNextRetryWakeDelay(delay)) return true;
@@ -269,6 +270,7 @@ bool SensorMesh::handleTrackerPath(mesh::Packet* packet, uint8_t* path, uint8_t
void SensorMesh::onSendComplete(mesh::Packet* packet) {
mesh::Mesh::onSendComplete(packet);
_cli.servicePendingTxPower();
_cli.morseReply().complete(packet);
if (!tracker_pending || !packet || packet->getPayloadType() != PAYLOAD_TYPE_REQ) return;
uint8_t hash[MAX_HASH_SIZE];