wip:
This commit is contained in:
38
README.md
38
README.md
@@ -1,3 +1,39 @@
|
||||
# esp_component_template
|
||||
|
||||
esp_component_template
|
||||
esp_component_template
|
||||
|
||||
#include "zh_ota_server.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "nvs_flash.h"
|
||||
|
||||
#define WIFI_SSID "ZH_OTA_TEST"
|
||||
#define WIFI_PASS "zh_ota_test"
|
||||
#define WIFI_CHANNEL 1
|
||||
#define MAX_STA_CONNECTION 4
|
||||
|
||||
static httpd_handle_t ota_server_handle = NULL;
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
esp_log_level_set("zh_ota_server", ESP_LOG_ERROR);
|
||||
nvs_flash_init();
|
||||
esp_event_loop_create_default();
|
||||
esp_netif_init();
|
||||
esp_netif_create_default_wifi_ap();
|
||||
wifi_init_config_t wifi_config = WIFI_INIT_CONFIG_DEFAULT();
|
||||
esp_wifi_init(&wifi_config);
|
||||
wifi_config_t ap_config = {
|
||||
.ap = {
|
||||
.ssid = WIFI_SSID,
|
||||
.password = WIFI_PASS,
|
||||
.max_connection = 4,
|
||||
.authmode = WIFI_AUTH_WPA2_PSK,
|
||||
},
|
||||
};
|
||||
esp_wifi_set_mode(WIFI_MODE_AP);
|
||||
esp_wifi_set_config(WIFI_IF_AP, &ap_config);
|
||||
esp_wifi_start();
|
||||
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
|
||||
httpd_start(&ota_server_handle, &config);
|
||||
zh_ota_server_init(ota_server_handle);
|
||||
}
|
||||
Reference in New Issue
Block a user