Skip to content

Commit

Permalink
fix(modem): Make the escape sequence configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cermak committed Nov 29, 2024
1 parent 0f258c2 commit cc1ac2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/esp_modem/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,13 @@ menu "esp-modem"
help
If enabled, APIs to add URC handler are available

config ESP_MODEM_PPP_ESCAPE_BEFORE_EXIT
bool "Send escape sequence when switching PPP -> CMD"
default n
help
If enabled, the library sends a PPP escape ("+++" command)
to switch to command mode. This make switching from PPP to CMD
mode more robust for some devices (e.g. Quectel), but might cause
trouble for other devices (e.g. SIMCOM).

endmenu
2 changes: 2 additions & 0 deletions components/esp_modem/src/esp_modem_dce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ static bool exit_data(DTE &dte, ModuleIf &device, Netif &netif)
});
netif.stop();
netif.wait_until_ppp_exits();
#ifdef ESP_MODEM_PPP_ESCAPE_BEFORE_EXIT
std::array<uint8_t, 3> ppp_escape = {'+', '+', '+'};
dte.write(ppp_escape.data(), ppp_escape.size());
#endif
if (!signal->wait(1, 2000)) { // wait for any of the disconnection messages
// if no reply -> set device to command mode
dte.set_read_cb(nullptr);
Expand Down

0 comments on commit cc1ac2f

Please sign in to comment.