Skip to content

Commit cb7674e

Browse files
committed
feat(modem): Updated console example to support other console types, fixed warning
1 parent fbd296f commit cb7674e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Diff for: components/esp_modem/examples/modem_console/main/console_helper.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ void ConsoleCommand::RegisterCommand(const char *command, const char *help, cons
6868
.help = help,
6969
.hint = nullptr,
7070
.func = command_func_pts[last_command],
71-
.argtable = &arg_table[0]
71+
.argtable = &arg_table[0],
72+
.func_w_context = nullptr,
73+
.context = nullptr
7274
};
7375
ESP_ERROR_CHECK(esp_console_cmd_register(&command_def));
7476
last_command++;

Diff for: components/esp_modem/examples/modem_console/main/modem_console_main.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,18 @@ extern "C" void app_main(void)
205205

206206
// init console REPL environment
207207
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
208+
#if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) || defined(CONFIG_ESP_CONSOLE_UART_CUSTOM)
208209
esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
209210
ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &s_repl));
211+
#elif defined(CONFIG_ESP_CONSOLE_USB_CDC)
212+
esp_console_dev_usb_cdc_config_t hw_config = ESP_CONSOLE_DEV_CDC_CONFIG_DEFAULT();
213+
ESP_ERROR_CHECK(esp_console_new_repl_usb_cdc(&hw_config, &repl_config, &s_repl));
214+
#elif defined(CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG)
215+
esp_console_dev_usb_serial_jtag_config_t hw_config = ESP_CONSOLE_DEV_USB_SERIAL_JTAG_CONFIG_DEFAULT();
216+
ESP_ERROR_CHECK(esp_console_new_repl_usb_serial_jtag(&hw_config, &repl_config, &s_repl));
217+
#else
218+
#error Unsupported console type
219+
#endif
210220

211221
switch (esp_sleep_get_wakeup_cause()) {
212222
case ESP_SLEEP_WAKEUP_TIMER:

0 commit comments

Comments
 (0)