fixed mqtt test publication on switched off client;
added default version into default config; some refactoring in wifi transport;
This commit is contained in:
parent
fc53cee0ad
commit
94081ea62d
6
Kconfig
6
Kconfig
|
|
@ -116,8 +116,6 @@ menu "WebGUIApp"
|
|||
|
||||
if WEBGUIAPP_SPI_ENABLE
|
||||
|
||||
|
||||
|
||||
config SPI_HOST
|
||||
int "SPI Host Number"
|
||||
range 0 2
|
||||
|
|
@ -699,7 +697,7 @@ menu "WebGUIApp"
|
|||
|
||||
config WEBGUIAPP_MQTT_ON
|
||||
bool "Enable MQTT client"
|
||||
default y
|
||||
default n
|
||||
|
||||
config WEBGUIAPP_MQTT_MAX_TOPIC_LENGTH
|
||||
int "Max topic length"
|
||||
|
|
@ -708,7 +706,7 @@ menu "WebGUIApp"
|
|||
|
||||
config WEBGUIAPP_MQTT_SERVER_URL
|
||||
string "MQTT server URL"
|
||||
default "myfirstmqttserver.com"
|
||||
default "mqttbroker.com"
|
||||
|
||||
config WEBGUIAPP_MQTT_SERVER_PORT
|
||||
int "MQTT server port"
|
||||
|
|
|
|||
|
|
@ -397,30 +397,27 @@ static HTTP_IO_RESULT HTTPPostServicesSettings(httpd_req_t *req, char *PostData)
|
|||
httpd_query_key_value(PostData, "tsr", GetSysConf()->sntpClient.SntpServerAdr,
|
||||
sizeof(GetSysConf()->sntpClient.SntpServerAdr));
|
||||
|
||||
|
||||
/*MQTT Test button handlers*/
|
||||
if (httpd_query_key_value(PostData, "mqtttest1", tmp, 6) == ESP_OK)
|
||||
{
|
||||
if(!strcmp(tmp, (const char*) "prs"))
|
||||
if (!strcmp(tmp, (const char*) "prs"))
|
||||
{
|
||||
ESP_LOGI(TAG,"MQTT TEST 1");
|
||||
PublicTestMQTT(0);
|
||||
if (GetSysConf()->mqttStation[0].Flags1.bIsGlobalEnabled)
|
||||
PublicTestMQTT(0);
|
||||
return HTTP_IO_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (httpd_query_key_value(PostData, "mqtttest2", tmp, 6) == ESP_OK)
|
||||
{
|
||||
if(!strcmp(tmp, (const char*) "prs"))
|
||||
if (!strcmp(tmp, (const char*) "prs"))
|
||||
{
|
||||
ESP_LOGI(TAG,"MQTT TEST 2");
|
||||
PublicTestMQTT(1);
|
||||
if (GetSysConf()->mqttStation[1].Flags1.bIsGlobalEnabled)
|
||||
PublicTestMQTT(1);
|
||||
return HTTP_IO_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (httpd_query_key_value(PostData, "save", tmp, 6) == ESP_OK ||
|
||||
httpd_query_key_value(PostData, "apply", tmp, 6) == ESP_OK)
|
||||
{
|
||||
|
|
@ -454,8 +451,6 @@ static HTTP_IO_RESULT HTTPPostServicesSettings(httpd_req_t *req, char *PostData)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
return HTTP_IO_DONE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,19 +108,9 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
|||
}
|
||||
else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED)
|
||||
{
|
||||
ESP_LOGI(TAG, "Disconnected from AP");
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
||||
xEventGroupClearBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
|
||||
isWiFiGotIp = false;
|
||||
//esp_wifi_connect();
|
||||
|
||||
/*
|
||||
ESP_LOGE(TAG, "Connect to the AP fail");
|
||||
if (!reconnect_task)
|
||||
{
|
||||
xTaskCreate(resonnectWithDelay, "reconnect_delay", 1024, NULL, 3, &reconnect_task);
|
||||
ESP_LOGW(TAG, "Pending reconnect in %d seconds", WIFI_CONNECT_AFTER_FAIL_DELAY);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP)
|
||||
{
|
||||
|
|
@ -153,8 +143,7 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
|||
isWiFiGotIp = false;
|
||||
}
|
||||
|
||||
|
||||
if (event_id == WIFI_EVENT_AP_STACONNECTED)
|
||||
else if (event_id == WIFI_EVENT_AP_STACONNECTED)
|
||||
{
|
||||
wifi_event_ap_staconnected_t *event = (wifi_event_ap_staconnected_t*) event_data;
|
||||
ESP_LOGI(TAG, "station "MACSTR" join, AID=%d", MAC2STR(event->mac), event->aid);
|
||||
|
|
@ -476,10 +465,6 @@ static void wifi_init_apsta(void *pvParameter)
|
|||
CC.max_tx_power);
|
||||
|
||||
ESP_LOGI(TAG, "wifi_init_softap_sta finished");
|
||||
|
||||
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum
|
||||
* number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user