Skip to content

Commit a80a3cb

Browse files
fix(modem): CEREG parsing fails due to incorrect state index
1 parent 2cc7c99 commit a80a3cb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

components/esp_modem/src/esp_modem_command_library.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,8 @@ command_result get_network_registration_state(CommandableIf *t, int &state)
641641
return command_result::FAIL;
642642
}
643643

644+
state_pos_start += 1; // move past the comma
645+
644646
if (out.find(pattern) == std::string::npos || (state_pos_end = out.find(',', state_pos_start)) == std::string::npos) {
645647
if (std::from_chars(out.data() + state_pos_start, out.data() + out.size(), state).ec == std::errc::invalid_argument) {
646648
return command_result::FAIL;

0 commit comments

Comments
 (0)