Refactor Web Server
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#include "web_server.h"
|
||||
#include "web_server_pages.h"
|
||||
#include "esp_http_server.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
static const char *TAG = "SYS_WEB";
|
||||
static httpd_handle_t s_server;
|
||||
|
||||
esp_err_t web_server_start(void)
|
||||
{
|
||||
if (s_server) return ESP_OK;
|
||||
|
||||
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
|
||||
esp_err_t err = httpd_start(&s_server, &config);
|
||||
if (err != ESP_OK) return err;
|
||||
|
||||
web_server_register_wifi_pages(s_server);
|
||||
web_server_register_ota_page(s_server);
|
||||
ESP_LOGI(TAG, "Web server started");
|
||||
return ESP_OK;
|
||||
}
|
||||
Reference in New Issue
Block a user