Implemented web server

This commit is contained in:
2021-07-12 20:43:24 +02:00
parent de8a94c8d1
commit 40ad1d87e8
2 changed files with 19 additions and 8 deletions

View File

@@ -14,6 +14,7 @@
#include <esp_ota_ops.h> #include <esp_ota_ops.h>
#endif #endif
#include <nvs_flash.h> #include <nvs_flash.h>
#include <esp_http_server.h>
// Arduino includes // Arduino includes
#include <Arduino.h> #include <Arduino.h>
@@ -70,10 +71,10 @@ extern "C" void app_main()
// return result; // return result;
} }
nvs_handle_t handle; nvs_handle_t nvsHandle;
{ {
const auto result = nvs_open("deckenlampe", NVS_READWRITE, &handle); const auto result = nvs_open("deckenlampe", NVS_READWRITE, &nvsHandle);
ESP_LOG_LEVEL_LOCAL((result == ESP_OK ? ESP_LOG_INFO : ESP_LOG_ERROR), TAG, "nvs_open(): %s", esp_err_to_name(result)); ESP_LOG_LEVEL_LOCAL((result == ESP_OK ? ESP_LOG_INFO : ESP_LOG_ERROR), TAG, "nvs_open(): %s", esp_err_to_name(result));
//if (result != ESP_OK) //if (result != ESP_OK)
// return result; // return result;
@@ -112,7 +113,7 @@ extern "C" void app_main()
.ssid_hidden = false, .ssid_hidden = false,
.max_connection = 4, .max_connection = 4,
.beacon_interval = 100, .beacon_interval = 100,
.ip{10, 128, 250, 181}, .ip{192, 168, 4, 1},
.subnet{255, 255, 255, 0} .subnet{255, 255, 255, 0}
}, },
.min_rssi = -90 .min_rssi = -90
@@ -120,6 +121,17 @@ extern "C" void app_main()
wifi_stack::init(wifiConfig); wifi_stack::init(wifiConfig);
httpd_handle_t httpdHandle{};
{
httpd_config_t httpConfig HTTPD_DEFAULT_CONFIG();
const auto result = httpd_start(&httpdHandle, &httpConfig);
ESP_LOG_LEVEL_LOCAL((result == ESP_OK ? ESP_LOG_INFO : ESP_LOG_ERROR), TAG, "httpd_start(): %s", esp_err_to_name(result));
//if (result != ESP_OK)
// return result;
}
while (true) while (true)
{ {
wifi_stack::update(wifiConfig); wifi_stack::update(wifiConfig);

View File

@@ -71,11 +71,9 @@ CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0
# #
# Security features # Security features
# #
CONFIG_SECURE_BOOT_SUPPORTS_RSA=y
# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set
# CONFIG_SECURE_BOOT is not set # CONFIG_SECURE_BOOT is not set
# CONFIG_SECURE_FLASH_ENC_ENABLED is not set # CONFIG_SECURE_FLASH_ENC_ENABLED is not set
# CONFIG_SECURE_DISABLE_ROM_DL_MODE is not set
# end of Security features # end of Security features
# #
@@ -322,10 +320,11 @@ CONFIG_ESP_TLS_SERVER=y
# ESP32-specific # ESP32-specific
# #
# CONFIG_ESP32_REV_MIN_0 is not set # CONFIG_ESP32_REV_MIN_0 is not set
# CONFIG_ESP32_REV_MIN_1 is not set CONFIG_ESP32_REV_MIN_1=y
# CONFIG_ESP32_REV_MIN_2 is not set # CONFIG_ESP32_REV_MIN_2 is not set
CONFIG_ESP32_REV_MIN_3=y # CONFIG_ESP32_REV_MIN_3 is not set
CONFIG_ESP32_REV_MIN=3 CONFIG_ESP32_REV_MIN=1
CONFIG_ESP32_DPORT_WORKAROUND=y
# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set # CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set
CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y
# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set # CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set