From 290197c210415a7296f649245ca7f6668a802d94 Mon Sep 17 00:00:00 2001 From: Jonathan Dreyer Date: Tue, 14 Jun 2022 23:22:06 +0200 Subject: [PATCH 1/2] feat(esp-modem): Add exit PPP in example --- .../examples/simple_cmux_client/main/Kconfig.projbuild | 6 ++++++ .../main/simple_cmux_client_main.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/components/esp_modem/examples/simple_cmux_client/main/Kconfig.projbuild b/components/esp_modem/examples/simple_cmux_client/main/Kconfig.projbuild index 2933fe830..ed9e96989 100644 --- a/components/esp_modem/examples/simple_cmux_client/main/Kconfig.projbuild +++ b/components/esp_modem/examples/simple_cmux_client/main/Kconfig.projbuild @@ -61,4 +61,10 @@ menu "Example Configuration" help HTTPS address of the update binary. + config EXAMPLE_CLOSE_CMUX_AT_END + bool "Close multiplexed mode at the end of the example" + default n + help + Close the multiplexed mode at the end of the example and rollback to command mode. + endmenu diff --git a/components/esp_modem/examples/simple_cmux_client/main/simple_cmux_client_main.cpp b/components/esp_modem/examples/simple_cmux_client/main/simple_cmux_client_main.cpp index 31a89b764..62da2fee9 100644 --- a/components/esp_modem/examples/simple_cmux_client/main/simple_cmux_client_main.cpp +++ b/components/esp_modem/examples/simple_cmux_client/main/simple_cmux_client_main.cpp @@ -164,4 +164,14 @@ extern "C" void app_main(void) return; } #endif // CONFIG_EXAMPLE_PERFORM_OTA + + /* Close multiplexed command/data mode */ +#if CONFIG_EXAMPLE_CLOSE_CMUX_AT_END == 1 + if (dce->set_mode(esp_modem::modem_mode::COMMAND_MODE)) { + std::cout << "Modem has correctly entered command mode" << std::endl; + } else { + ESP_LOGE(TAG, "Failed to configure desired mode... exiting"); + return; + } +#endif } From accf9244ca3581ec46b569afa77d748f87b2cbaf Mon Sep 17 00:00:00 2001 From: Jonathan Dreyer Date: Mon, 19 Sep 2022 17:11:57 +0200 Subject: [PATCH 2/2] Minor formatting fix and spelling --- .../esp_modem/include/generate/esp_modem_command_declare.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/esp_modem/include/generate/esp_modem_command_declare.inc b/components/esp_modem/include/generate/esp_modem_command_declare.inc index 5c512b3ad..3406c75fd 100644 --- a/components/esp_modem/include/generate/esp_modem_command_declare.inc +++ b/components/esp_modem/include/generate/esp_modem_command_declare.inc @@ -47,6 +47,7 @@ * @return OK, FAIL or TIMEOUT */ \ ESP_MODEM_DECLARE_DCE_COMMAND(sync, command_result, 0) \ + \ /** * @brief Reads the operator name * @param[out] operator name @@ -113,7 +114,7 @@ ESP_MODEM_DECLARE_DCE_COMMAND(sms_character_set, command_result, 0) \ ESP_MODEM_DECLARE_DCE_COMMAND(send_sms, command_result, 2, STRING_IN(p1, number), STRING_IN(p2, message)) \ \ /** - * @brief Resumes data mode (Switches back to th data mode, which was temporarily suspended) + * @brief Resumes data mode (Switches back to the data mode, which was temporarily suspended) * @return OK, FAIL or TIMEOUT */ \ ESP_MODEM_DECLARE_DCE_COMMAND(resume_data_mode, command_result, 0) \