forked from backinabit/ESP32-OTA-Webserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
46 lines (34 loc) · 936 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <stdlib.h>
#include <nvs_flash.h>
#include "OTAServer.h"
#include "MyWiFi.h"
/*
*
* void app_main()
*
**/
void app_main()
{
//Initialize NVS
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
printf("\r\n***************************\r\n");
printf("*** ESP32 System Up ***\r\n");
printf("***************************\r\n");
printf("Compiled at:");
printf(__TIME__);
printf(" ");
printf(__DATE__);
printf("\r\n");
// Need this task to spin up, see why in task
xTaskCreate(&systemRebootTask, "rebootTask", 2048, NULL, 5, NULL);
// Start as an AP
//init_wifi_softap(&OTA_server);
// Connect to a Router so as to give a quick test
init_wifi_station(&OTA_server);
}