more fixes for idf-5 incompatibility and some refactoring
This commit is contained in:
parent
95c4dd4714
commit
4762442213
|
|
@ -77,7 +77,7 @@ static void on_ppp_changed(void *arg, esp_event_base_t event_base,
|
||||||
int32_t event_id,
|
int32_t event_id,
|
||||||
void *event_data)
|
void *event_data)
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "PPP state changed event %d", event_id);
|
ESP_LOGI(TAG, "PPP state changed event %u", (unsigned int)event_id);
|
||||||
if (event_id == NETIF_PPP_ERRORUSER)
|
if (event_id == NETIF_PPP_ERRORUSER)
|
||||||
{
|
{
|
||||||
/* User interrupted event from esp-netif */
|
/* User interrupted event from esp-netif */
|
||||||
|
|
@ -90,7 +90,7 @@ static void on_ip_event(void *arg, esp_event_base_t event_base,
|
||||||
int32_t event_id,
|
int32_t event_id,
|
||||||
void *event_data)
|
void *event_data)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "IP event! %d", event_id);
|
ESP_LOGD(TAG, "IP event! %u", (unsigned int)event_id);
|
||||||
if (event_id == IP_EVENT_PPP_GOT_IP)
|
if (event_id == IP_EVENT_PPP_GOT_IP)
|
||||||
{
|
{
|
||||||
esp_netif_dns_info_t dns_info;
|
esp_netif_dns_info_t dns_info;
|
||||||
|
|
@ -264,13 +264,13 @@ modem_init_fail:
|
||||||
void PPPModemColdStart(void)
|
void PPPModemColdStart(void)
|
||||||
{
|
{
|
||||||
ResetType = 0;
|
ResetType = 0;
|
||||||
xTaskCreate(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3, initTaskhandle);
|
xTaskCreate(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3, &initTaskhandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPPModemSoftRestart(void)
|
void PPPModemSoftRestart(void)
|
||||||
{
|
{
|
||||||
ResetType = 1;
|
ResetType = 1;
|
||||||
xTaskCreate(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3, initTaskhandle);
|
xTaskCreate(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3, &initTaskhandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GSMRunTask(void *pvParameter)
|
static void GSMRunTask(void *pvParameter)
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ static void HTTPPrint_ipap(char *VarData, void *arg)
|
||||||
if (GetAPNetifAdapter() && esp_netif_is_netif_up(GetAPNetifAdapter()))
|
if (GetAPNetifAdapter() && esp_netif_is_netif_up(GetAPNetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetAPNetifAdapter(), IP);
|
PrintIPFromInterface(VarData, arg, GetAPNetifAdapter(), IP);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->wifiSettings.ApIPAddr));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->wifiSettings.ApIPAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HTTPPrint_ssid(char *VarData, void *arg)
|
static void HTTPPrint_ssid(char *VarData, void *arg)
|
||||||
|
|
@ -307,7 +307,7 @@ static void HTTPPrint_ip(char *VarData, void *arg)
|
||||||
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), IP);
|
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), IP);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->wifiSettings.InfIPAddr));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->wifiSettings.InfIPAddr));
|
||||||
}
|
}
|
||||||
/*STA NETMASK*/
|
/*STA NETMASK*/
|
||||||
static void HTTPPrint_msk(char *VarData, void *arg)
|
static void HTTPPrint_msk(char *VarData, void *arg)
|
||||||
|
|
@ -315,7 +315,7 @@ static void HTTPPrint_msk(char *VarData, void *arg)
|
||||||
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), NETMASK);
|
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), NETMASK);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->wifiSettings.InfMask));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->wifiSettings.InfMask));
|
||||||
}
|
}
|
||||||
/*STA GATEWAY*/
|
/*STA GATEWAY*/
|
||||||
static void HTTPPrint_gate(char *VarData, void *arg)
|
static void HTTPPrint_gate(char *VarData, void *arg)
|
||||||
|
|
@ -323,7 +323,7 @@ static void HTTPPrint_gate(char *VarData, void *arg)
|
||||||
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), GW);
|
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), GW);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->wifiSettings.InfGateway));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->wifiSettings.InfGateway));
|
||||||
}
|
}
|
||||||
/*Current DNS*/
|
/*Current DNS*/
|
||||||
static void HTTPPrint_dns(char *VarData, void *arg)
|
static void HTTPPrint_dns(char *VarData, void *arg)
|
||||||
|
|
@ -390,7 +390,7 @@ static void HTTPPrint_eip(char *VarData, void *arg)
|
||||||
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), IP);
|
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), IP);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->ethSettings.IPAddr));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->ethSettings.IPAddr));
|
||||||
}
|
}
|
||||||
/*Etherbox NETMASK*/
|
/*Etherbox NETMASK*/
|
||||||
static void HTTPPrint_emsk(char *VarData, void *arg)
|
static void HTTPPrint_emsk(char *VarData, void *arg)
|
||||||
|
|
@ -398,7 +398,7 @@ static void HTTPPrint_emsk(char *VarData, void *arg)
|
||||||
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), NETMASK);
|
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), NETMASK);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->ethSettings.Mask));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->ethSettings.Mask));
|
||||||
}
|
}
|
||||||
/*Ethernet GATEWAY*/
|
/*Ethernet GATEWAY*/
|
||||||
static void HTTPPrint_egate(char *VarData, void *arg)
|
static void HTTPPrint_egate(char *VarData, void *arg)
|
||||||
|
|
@ -406,7 +406,7 @@ static void HTTPPrint_egate(char *VarData, void *arg)
|
||||||
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), GW);
|
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), GW);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->ethSettings.Gateway));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->ethSettings.Gateway));
|
||||||
}
|
}
|
||||||
/*Current DNS*/
|
/*Current DNS*/
|
||||||
static void HTTPPrint_edns(char *VarData, void *arg)
|
static void HTTPPrint_edns(char *VarData, void *arg)
|
||||||
|
|
@ -919,7 +919,7 @@ void GenerateSystemSettingsJSONFile(void)
|
||||||
strcat(val, "~");
|
strcat(val, "~");
|
||||||
strcat(val, HANDLERS_ARRAY[i].tag);
|
strcat(val, HANDLERS_ARRAY[i].tag);
|
||||||
strcat(val, "~");
|
strcat(val, "~");
|
||||||
jwObj_string(HANDLERS_ARRAY[i].tag, val);
|
jwObj_string((char*)HANDLERS_ARRAY[i].tag, val);
|
||||||
}
|
}
|
||||||
jwEnd();
|
jwEnd();
|
||||||
jwClose();
|
jwClose();
|
||||||
|
|
|
||||||
|
|
@ -489,7 +489,6 @@ void WiFiConnect(void)
|
||||||
static void WiFiControlTask(void *arg)
|
static void WiFiControlTask(void *arg)
|
||||||
{
|
{
|
||||||
//WiFi init and start block
|
//WiFi init and start block
|
||||||
static int reconnect_interval = BASE_RECONNECT_INTERVAL;
|
|
||||||
static int reconnect_counter = BASE_RECONNECT_INTERVAL;
|
static int reconnect_counter = BASE_RECONNECT_INTERVAL;
|
||||||
s_wifi_event_group = xEventGroupCreate();
|
s_wifi_event_group = xEventGroupCreate();
|
||||||
switch (GetSysConf()->wifiSettings.WiFiMode)
|
switch (GetSysConf()->wifiSettings.WiFiMode)
|
||||||
|
|
@ -515,7 +514,6 @@ static void WiFiControlTask(void *arg)
|
||||||
portMAX_DELAY);
|
portMAX_DELAY);
|
||||||
if (bits & WIFI_CONNECTED_BIT)
|
if (bits & WIFI_CONNECTED_BIT)
|
||||||
{
|
{
|
||||||
reconnect_interval = BASE_RECONNECT_INTERVAL;
|
|
||||||
reconnect_counter = BASE_RECONNECT_INTERVAL;
|
reconnect_counter = BASE_RECONNECT_INTERVAL;
|
||||||
}
|
}
|
||||||
else if (bits & WIFI_FAIL_BIT)
|
else if (bits & WIFI_FAIL_BIT)
|
||||||
|
|
@ -524,12 +522,6 @@ static void WiFiControlTask(void *arg)
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "WiFi STA started, reconnecting to AP...");
|
ESP_LOGI(TAG, "WiFi STA started, reconnecting to AP...");
|
||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
/*
|
|
||||||
reconnect_interval += BASE_RECONNECT_INTERVAL;
|
|
||||||
if (reconnect_interval >= BASE_RECONNECT_INTERVAL * 10)
|
|
||||||
reconnect_interval = BASE_RECONNECT_INTERVAL * 10;
|
|
||||||
reconnect_counter = reconnect_interval;
|
|
||||||
*/
|
|
||||||
reconnect_counter = BASE_RECONNECT_INTERVAL;
|
reconnect_counter = BASE_RECONNECT_INTERVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user