Skip to content

Commit 5ea9e42

Browse files
stig-bjorlykkerlubos
authored andcommitted
applications: serial_lte_modem: Fix read AT+CEREG
`AT+CEREG` read return the unsolicited result code subscription as the first parameter, and network status as the second parameter. Signed-off-by: Stig Bjørlykke <[email protected]>
1 parent d9d598f commit 5ea9e42

File tree

1 file changed

+4
-2
lines changed
  • applications/serial_lte_modem/src

1 file changed

+4
-2
lines changed

applications/serial_lte_modem/src/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ int lte_auto_connect(void)
428428
{
429429
int err = 0;
430430
#if defined(CONFIG_SLM_AUTO_CONNECT)
431+
int ret;
432+
int n;
431433
int stat;
432434
struct network_config {
433435
/* Refer to AT command manual of %XSYSTEMMODE for system mode settings */
@@ -447,8 +449,8 @@ int lte_auto_connect(void)
447449
#include "slm_auto_connect.h"
448450
};
449451

450-
err = slm_util_at_scanf("AT+CEREG?", "+CEREG: %d", &stat);
451-
if (err != 1 || (stat == 1 || stat == 5)) {
452+
ret = slm_util_at_scanf("AT+CEREG?", "+CEREG: %d,%d", &n, &stat);
453+
if (ret != 2 || (stat == 1 || stat == 5)) {
452454
return 0;
453455
}
454456

0 commit comments

Comments
 (0)