Examples: Cleanup the modem console

This commit is contained in:
David Cermak
2021-04-18 20:19:53 +02:00
parent 77db911a48
commit 26bde89834
8 changed files with 130 additions and 180 deletions

View File

@ -140,7 +140,15 @@ extern "C" void app_main(void)
esp_netif_t *esp_netif = esp_netif_new(&netif_ppp_config);
assert(esp_netif);
#if CONFIG_EXAMPLE_MODEM_DEVICE_BG96 == 1
auto dce = create_BG96_dce(&dce_config, uart_dte, esp_netif);
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM800 == 1
auto dce = create_SIM800_dce(&dce_config, uart_dte, esp_netif);
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1
auto dce = create_SIM7600_dce(&dce_config, uart_dte, esp_netif);
#else
#error "Unsupported device"
#endif
dce->set_command_mode();
@ -149,7 +157,7 @@ extern "C" void app_main(void)
std::cout << "Module name:" << str << std::endl;
bool pin_ok = true;
if (dce->read_pin(pin_ok) == command_result::OK && !pin_ok) {
throw_if_false(dce->set_pin("1234") == command_result::OK, "Cannot set PIN!");
throw_if_false(dce->set_pin(CONFIG_EXAMPLE_SIM_PIN) == command_result::OK, "Cannot set PIN!");
}
vTaskDelay(pdMS_TO_TICKS(1000));
@ -180,5 +188,3 @@ extern "C" void app_main(void)
ESP_LOGI(TAG, "Example finished");
}