mirror of
https://github.com/manuelbl/ttn-esp32.git
synced 2025-08-17 12:10:34 +02:00
Fix ttn_wait_for_idle for MAC cmd processing
This commit is contained in:
@ -391,7 +391,12 @@ TickType_t hal_esp32_get_timer_duration(void)
|
||||
return 1; // busy, not waiting
|
||||
|
||||
if (alarm_time != 0)
|
||||
return pdMS_TO_TICKS((alarm_time - get_current_time() + 999) / 1000);
|
||||
{
|
||||
TickType_t dur = pdMS_TO_TICKS((alarm_time - get_current_time() + 999) / 1000);
|
||||
if (dur > pdMS_TO_TICKS(30000))
|
||||
dur = pdMS_TO_TICKS(200);
|
||||
return dur;
|
||||
}
|
||||
|
||||
|
||||
return 0; // waiting indefinitely
|
||||
|
@ -337,6 +337,7 @@ bool ttn_is_provisioned(void)
|
||||
void ttn_prepare_for_deep_sleep(void)
|
||||
{
|
||||
ttn_rtc_save();
|
||||
stop();
|
||||
}
|
||||
|
||||
|
||||
@ -357,8 +358,8 @@ TickType_t ttn_busy_duration(void)
|
||||
if (duration != 0)
|
||||
return duration; // busy or timer scheduled
|
||||
|
||||
if (current_rx_tx_window != TTN_WINDOW_IDLE)
|
||||
return pdMS_TO_TICKS(100); // within TX/RX window
|
||||
if ((LMIC.opmode & (OP_JOINING | OP_TXDATA | OP_POLL | OP_TXRXPEND)) != 0)
|
||||
return pdMS_TO_TICKS(100); // pending action
|
||||
|
||||
return 0; // idle
|
||||
}
|
||||
|
Reference in New Issue
Block a user