fix(modem): Fix netif to set PPP config in C++ way

If the config struct contains more items (or more items will be added in
future) this init will not compile cleanly
This commit is contained in:
David Cermak
2023-09-20 10:46:53 +02:00
parent 25a35e20a3
commit 5287432197

View File

@ -49,9 +49,9 @@ esp_err_t Netif::esp_modem_post_attach(esp_netif_t *esp_netif, void *args)
ESP_ERROR_CHECK(esp_netif_set_driver_config(esp_netif, &driver_ifconfig)); ESP_ERROR_CHECK(esp_netif_set_driver_config(esp_netif, &driver_ifconfig));
// check if PPP error events are enabled, if not, do enable the error occurred/state changed // check if PPP error events are enabled, if not, do enable the error occurred/state changed
// to notify the modem layer when switching modes // to notify the modem layer when switching modes
esp_netif_ppp_config_t ppp_config = { .ppp_phase_event_enabled = true, // assuming phase enabled, as earlier IDFs esp_netif_ppp_config_t ppp_config = { };
.ppp_error_event_enabled = false ppp_config.ppp_phase_event_enabled = true; // assuming phase enabled, as earlier IDFs
}; // don't provide cfg getters so we enable both events ppp_config.ppp_error_event_enabled = false; // don't provide cfg getters so we enable both events
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
esp_netif_ppp_get_params(esp_netif, &ppp_config); esp_netif_ppp_get_params(esp_netif, &ppp_config);
#endif // ESP-IDF >= v4.4 #endif // ESP-IDF >= v4.4