From ce0fc25892f39eaf54a8699ffae3a8727fd1854a Mon Sep 17 00:00:00 2001 From: Aren Moynihan Date: Mon, 28 Oct 2024 12:11:23 -0400 Subject: [PATCH] at: don't clear the resetting state on sequence end If the reset sequence fails, we don't want to transition to the powered state, instead we should stay in the resetting state so we eventually timeout and try a gpio reset. If the reset command succeeds the modem will eventually send RDY and transition the state to STARTED. Since this might take longer to change the modem state, add 15 seconds (for a total of 45) to the at reset timeout just in case. It looks like the modem typically takes about 20 between sending "AT+CFUN=1,1" and receiving "RDY", so this should be plenty. --- src/at.c | 2 -- src/manager.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/at.c b/src/at.c index cb79b10..327b394 100644 --- a/src/at.c +++ b/src/at.c @@ -146,8 +146,6 @@ gboolean at_send_command(struct EG25Manager *manager) } } else if (manager->modem_state == EG25_STATE_SUSPENDING) { modem_suspend_post(manager); - } else if (manager->modem_state == EG25_STATE_RESETTING) { - manager->modem_state = EG25_STATE_POWERED; } } diff --git a/src/manager.c b/src/manager.c index 7420c5f..1d578fd 100644 --- a/src/manager.c +++ b/src/manager.c @@ -271,7 +271,7 @@ error: at_sequence_reset(manager); // Setup timer for making sure we don't queue other reset commands - manager->complete_reset_timer = g_timeout_add_seconds(30, G_SOURCE_FUNC(modem_at_reset_done), manager); + manager->complete_reset_timer = g_timeout_add_seconds(45, G_SOURCE_FUNC(modem_at_reset_done), manager); return G_SOURCE_REMOVE; }