Skip to content

Commit 75c5e35

Browse files
author
Teppo Järvelin
committed
modified at timeout while doing attach and connect as it might take up to one minute and at timeout was 10s.
1 parent 5f15b73 commit 75c5e35

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

features/cellular/easy_cellular/CellularConnectionFSM.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define TIMEOUT_POWER_ON (1*1000)
3030
#define TIMEOUT_SIM_PIN (1*1000)
3131
#define TIMEOUT_NETWORK (10*1000)
32+
#define TIMEOUT_CONNECT (60*1000)
3233
#define TIMEOUT_REGISTRATION (180*1000)
3334

3435
// maximum time when retrying network register, attach and connect in seconds ( 20minutes )
@@ -441,7 +442,7 @@ void CellularConnectionFSM::state_registering()
441442

442443
void CellularConnectionFSM::state_attaching()
443444
{
444-
_cellularDevice->set_timeout(TIMEOUT_NETWORK);
445+
_cellularDevice->set_timeout(TIMEOUT_CONNECT);
445446
CellularNetwork::AttachStatus attach_status;
446447
if (get_attach_network(attach_status)) {
447448
if (attach_status == CellularNetwork::Attached) {
@@ -457,9 +458,11 @@ void CellularConnectionFSM::state_attaching()
457458

458459
void CellularConnectionFSM::state_connect_to_network()
459460
{
460-
_cellularDevice->set_timeout(TIMEOUT_NETWORK);
461-
tr_info("Connect to cellular network (timeout %d ms)", TIMEOUT_NETWORK);
461+
_cellularDevice->set_timeout(TIMEOUT_CONNECT);
462+
tr_info("Connect to cellular network (timeout %d ms)", TIMEOUT_CONNECT);
462463
if (_network->connect() == NSAPI_ERROR_OK) {
464+
_cellularDevice->set_timeout(TIMEOUT_NETWORK);
465+
tr_debug("Connected to cellular network, set at timeout (timeout %d ms)", TIMEOUT_NETWORK);
463466
// when using modems stack connect is synchronous
464467
_next_state = STATE_CONNECTED;
465468
} else {

0 commit comments

Comments
 (0)