29
29
#define TIMEOUT_POWER_ON (1 *1000 )
30
30
#define TIMEOUT_SIM_PIN (1 *1000 )
31
31
#define TIMEOUT_NETWORK (10 *1000 )
32
+ #define TIMEOUT_CONNECT (60 *1000 )
32
33
#define TIMEOUT_REGISTRATION (180 *1000 )
33
34
34
35
// maximum time when retrying network register, attach and connect in seconds ( 20minutes )
@@ -441,7 +442,7 @@ void CellularConnectionFSM::state_registering()
441
442
442
443
void CellularConnectionFSM::state_attaching ()
443
444
{
444
- _cellularDevice->set_timeout (TIMEOUT_NETWORK );
445
+ _cellularDevice->set_timeout (TIMEOUT_CONNECT );
445
446
CellularNetwork::AttachStatus attach_status;
446
447
if (get_attach_network (attach_status)) {
447
448
if (attach_status == CellularNetwork::Attached) {
@@ -457,9 +458,11 @@ void CellularConnectionFSM::state_attaching()
457
458
458
459
void CellularConnectionFSM::state_connect_to_network ()
459
460
{
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 );
462
463
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);
463
466
// when using modems stack connect is synchronous
464
467
_next_state = STATE_CONNECTED;
465
468
} else {
0 commit comments