fix: double call to esp event loop initialisation
This commit is contained in:
parent
466dec9fc1
commit
d5327a0808
2 changed files with 7 additions and 7 deletions
|
@ -4,13 +4,13 @@ menu "Project Configuration"
|
||||||
|
|
||||||
config ESP_WIFI_SSID
|
config ESP_WIFI_SSID
|
||||||
string "WiFi SSID"
|
string "WiFi SSID"
|
||||||
default "myssid"
|
default ""
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config ESP_WIFI_PASSWORD
|
config ESP_WIFI_PASSWORD
|
||||||
string "WiFi Password"
|
string "WiFi Password"
|
||||||
default "mypassword"
|
default ""
|
||||||
help
|
help
|
||||||
WiFi password (WPA or WPA2) for the example to use.
|
WiFi password (WPA or WPA2) for the example to use.
|
||||||
|
|
||||||
|
|
10
main/main.c
10
main/main.c
|
@ -112,9 +112,6 @@ void wifi_init_sta(void)
|
||||||
{
|
{
|
||||||
s_wifi_event_group = xEventGroupCreate();
|
s_wifi_event_group = xEventGroupCreate();
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
|
||||||
esp_netif_create_default_wifi_sta();
|
esp_netif_create_default_wifi_sta();
|
||||||
|
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
|
@ -183,8 +180,9 @@ static esp_err_t status_get_handler(httpd_req_t *req)
|
||||||
/* Send response with custom headers and body set as the
|
/* Send response with custom headers and body set as the
|
||||||
* string passed in user context*/
|
* string passed in user context*/
|
||||||
char buf[7];
|
char buf[7];
|
||||||
|
ESP_LOGI(TAG, "SENT STATUS");
|
||||||
sprintf(buf, "v02-%d%d", status_one, status_two);
|
sprintf(buf, "v02-%d%d", status_one, status_two);
|
||||||
httpd_resp_send(req, buf, 2);
|
httpd_resp_send(req, buf, strlen(buf));
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
@ -198,6 +196,8 @@ static const httpd_uri_t status = {
|
||||||
/* An HTTP POST handler */
|
/* An HTTP POST handler */
|
||||||
static esp_err_t post_one_handler(httpd_req_t *req)
|
static esp_err_t post_one_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "RECEIVED DATA");
|
||||||
char buf[1];
|
char buf[1];
|
||||||
int ret, remaining = req->content_len;
|
int ret, remaining = req->content_len;
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ static esp_err_t post_one_handler(httpd_req_t *req)
|
||||||
set = true;
|
set = true;
|
||||||
};
|
};
|
||||||
if (set) {
|
if (set) {
|
||||||
ESP_LOGI(TAG, "RECEIVED DATA");
|
ESP_LOGI(TAG, "CHANGED DATA");
|
||||||
gpio_set_level(GPIO_OUTPUT_IO_0, status_one);
|
gpio_set_level(GPIO_OUTPUT_IO_0, status_one);
|
||||||
httpd_resp_send(req, NULL, 0); // TODO check simplification
|
httpd_resp_send(req, NULL, 0); // TODO check simplification
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
Loading…
Add table
Reference in a new issue