diff --git a/components/esp_modem/examples/modem_console/main/console_helper.cpp b/components/esp_modem/examples/modem_console/main/console_helper.cpp index be8d369c6..ae0391cb3 100644 --- a/components/esp_modem/examples/modem_console/main/console_helper.cpp +++ b/components/esp_modem/examples/modem_console/main/console_helper.cpp @@ -63,13 +63,12 @@ void ConsoleCommand::RegisterCommand(const char *command, const char *help, cons arg_type end = { .end = arg_end(1) }; arg_table.emplace_back(end); - const esp_console_cmd_t command_def = { - .command = command, - .help = help, - .hint = nullptr, - .func = command_func_pts[last_command], - .argtable = &arg_table[0] - }; + esp_console_cmd_t command_def = { }; + command_def.command = command; + command_def.help = help; + command_def.hint = nullptr; + command_def.func = command_func_pts[last_command]; + command_def.argtable = &arg_table[0]; ESP_ERROR_CHECK(esp_console_cmd_register(&command_def)); last_command++; console_commands.emplace_back(this); diff --git a/components/esp_modem/examples/modem_console/main/modem_console_main.cpp b/components/esp_modem/examples/modem_console/main/modem_console_main.cpp index 7fa21503c..16bff15b2 100644 --- a/components/esp_modem/examples/modem_console/main/modem_console_main.cpp +++ b/components/esp_modem/examples/modem_console/main/modem_console_main.cpp @@ -21,6 +21,7 @@ #include "cxx_include/esp_modem_dte.hpp" #include "esp_modem_config.h" #include "cxx_include/esp_modem_api.hpp" +#include "esp_idf_version.h" #if defined(CONFIG_EXAMPLE_SERIAL_CONFIG_USB) #include "esp_modem_usb_config.h" #include "cxx_include/esp_modem_usb_api.hpp" @@ -29,6 +30,12 @@ #include "console_helper.hpp" #include "my_module_dce.hpp" +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) +#define GET_WAKEUP_CAUSE() esp_sleep_get_wakeup_causes() +#else +#define GET_WAKEUP_CAUSE() esp_sleep_get_wakeup_cause() +#endif + #if defined(CONFIG_EXAMPLE_FLOW_CONTROL_NONE) #define EXAMPLE_FLOW_CONTROL ESP_MODEM_FLOW_CONTROL_NONE #elif defined(CONFIG_EXAMPLE_FLOW_CONTROL_SW) @@ -208,7 +215,7 @@ extern "C" void app_main(void) esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT(); ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &s_repl)); - switch (esp_sleep_get_wakeup_cause()) { + switch (GET_WAKEUP_CAUSE()) { case ESP_SLEEP_WAKEUP_TIMER: if (esp_modem::modem_mode::CMUX_MODE == mode_rtc) { ESP_LOGI(TAG, "Deep sleep reset\n"); @@ -428,7 +435,7 @@ extern "C" void app_main(void) const ConsoleCommand SetDeepSleep("set_deep_sleep", "Put esp32 to deep sleep", &deep_sleep_args, sizeof(deep_sleep_args), [&](ConsoleCommand * c) { int tout = c->get_int_of(&DeepSleepArgs::timeout); ESP_LOGI(TAG, "Entering deep sleep for %d sec", tout); - ESP_LOGI(TAG, "Wakeup Cause: %d ", esp_sleep_get_wakeup_cause()); + ESP_LOGI(TAG, "Wakeup Cause: %d ", GET_WAKEUP_CAUSE()); esp_deep_sleep(tout * 1000000); return 0; }); diff --git a/components/esp_modem/test/target_ota/main/ota_test.cpp b/components/esp_modem/test/target_ota/main/ota_test.cpp index 8eeb6c3c0..2f3985673 100644 --- a/components/esp_modem/test/target_ota/main/ota_test.cpp +++ b/components/esp_modem/test/target_ota/main/ota_test.cpp @@ -14,11 +14,17 @@ #include "cxx_include/esp_modem_dte.hpp" #include "esp_modem_config.h" #include "cxx_include/esp_modem_api.hpp" -#include "esp_vfs_dev.h" // For optional VFS support -#include "vfs_resource/vfs_create.hpp" +#include "esp_idf_version.h" #include "network_dce.hpp" #include "manual_ota.hpp" #include "mqtt_client.h" +// For optional VFS support +#include "vfs_resource/vfs_create.hpp" +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0) +#include "driver/uart_vfs.h" +#else +#include "esp_vfs_dev.h" +#endif using namespace esp_modem; @@ -189,7 +195,12 @@ extern "C" void app_main(void) assert(vfs_create_uart(&uart_config, &dte_config.vfs_config) == true); auto dte = create_vfs_dte(&dte_config); +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0) + uart_vfs_dev_use_driver(uart_config.uart.port_num); +#else esp_vfs_dev_uart_use_driver(uart_config.uart.port_num); +#endif + #else auto dte = create_uart_dte(&dte_config); #endif // CONFIG_TEST_USE_VFS_TERM