mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-02 11:03:42 +00:00
agc reset fix
This commit is contained in:
@@ -403,7 +403,7 @@ index 7b0b67f89d5..7154eb074ce 100644
|
||||
/* Start transmission with 10 second timeout */
|
||||
ret = sx126x_set_tx(dev, 10000);
|
||||
if (ret < 0) {
|
||||
@@ -1038,6 +1260,121 @@ static int sx126x_lora_test_cw(const struct device *dev, uint32_t frequency,
|
||||
@@ -1038,6 +1260,126 @@ static int sx126x_lora_test_cw(const struct device *dev, uint32_t frequency,
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -519,6 +519,11 @@ index 7b0b67f89d5..7154eb074ce 100644
|
||||
+ sx126x_set_rx_gain(dev, true);
|
||||
+ }
|
||||
+
|
||||
+ /* Chip is now in STANDBY. Update state so lora_recv_async() can
|
||||
+ * transition back to RX — without this, the CAS(REST→RX) fails
|
||||
+ * because state was still SX126X_STATE_RX from before the reset. */
|
||||
+ atomic_set(&data->state, SX126X_STATE_IDLE);
|
||||
+
|
||||
+ k_mutex_unlock(&data->lock);
|
||||
+}
|
||||
+
|
||||
|
||||
@@ -133,15 +133,19 @@ void Dispatcher::maintenanceLoop()
|
||||
/* Noise floor calibration — one EMA tick per housekeeping cycle */
|
||||
_radio->triggerNoiseFloorCalibrate(getInterferenceThreshold());
|
||||
|
||||
/* RX mode watchdog — detect if radio is stuck outside RX */
|
||||
bool is_recv = _radio->isInRecvMode();
|
||||
if (is_recv != prev_isrecv_mode) {
|
||||
prev_isrecv_mode = is_recv;
|
||||
if (!is_recv) {
|
||||
/* RX mode watchdog — detect if radio is stuck in neither RX nor TX.
|
||||
* Count TX time as "active" so rapid consecutive relays on a busy
|
||||
* repeater don't falsely trigger the flag: the housekeeping timer
|
||||
* (5 s) can miss brief RX windows between TXes, leaving
|
||||
* radio_nonrx_start stale and firing the watchdog spuriously. */
|
||||
bool is_active = _radio->isInRecvMode() || !_radio->isSendComplete();
|
||||
if (is_active != prev_isrecv_mode) {
|
||||
prev_isrecv_mode = is_active;
|
||||
if (!is_active) {
|
||||
radio_nonrx_start = (uint32_t)_ms->getMillis();
|
||||
}
|
||||
}
|
||||
if (!is_recv && (uint32_t)_ms->getMillis() - radio_nonrx_start > 8000) {
|
||||
if (!is_active && (uint32_t)_ms->getMillis() - radio_nonrx_start > 8000) {
|
||||
_err_flags |= ERR_EVENT_STARTRX_TIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user