use the new ESP Framework for our older boards too

This commit is contained in:
Thomas Göttgens
2022-09-09 22:31:30 +02:00
parent e375a8460b
commit bf3306fbc8
5 changed files with 27 additions and 52 deletions

View File

@@ -23,16 +23,9 @@
#endif
#if defined(ARCH_ESP32)
#if CONFIG_IDF_TARGET_ESP32S3
#include <LittleFS.h> //esp32s3 uses the framework's built-in LittleFS
#define FSCom LittleFS
#else
// ESP32 version
#include "LITTLEFS.h"
#define FSCom LITTLEFS
#endif
#include "LittleFS.h"
#define FSCom LittleFS
#define FSBegin() FSCom.begin(true)
#define FILE_O_WRITE "w"
#define FILE_O_READ "r"

View File

@@ -48,8 +48,6 @@ using namespace httpsserver;
HTTPClient httpClient;
#define DEST_FS_USES_LITTLEFS
#define ESP_ARDUINO_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
#define ESP_ARDUINO_VERSION ESP_ARDUINO_VERSION_VAL(1, 0, 4)
// We need to specify some content-type mapping, so the resources get delivered with the
// right content type and are displayed correctly in the browser

View File

@@ -238,10 +238,8 @@ bool initWifi(bool forceSoftAP)
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
DEBUG_MSG("MY IP AP ADDRESS: %s\n", WiFi.softAPIP().toString().c_str());
#if !CONFIG_IDF_TARGET_ESP32S3
// This is needed to improve performance.
esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
#endif
// esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
dnsServer.start(53, "*", apIP);
@@ -254,19 +252,14 @@ bool initWifi(bool forceSoftAP)
WiFi.setHostname(ourHost);
WiFi.onEvent(WiFiEvent);
#if !CONFIG_IDF_TARGET_ESP32S3
// This is needed to improve performance.
esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
#endif
// esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
WiFi.onEvent(
[](WiFiEvent_t event, WiFiEventInfo_t info) {
Serial.print("\nWiFi lost connection. Reason: ");
#if CONFIG_IDF_TARGET_ESP32S3
Serial.println(info.wifi_sta_disconnected.reason);
wifiDisconnectReason = info.wifi_sta_disconnected.reason;
#else
Serial.println(info.disconnected.reason);
/*
If we are disconnected from the AP for some reason,
save the error code.
@@ -274,15 +267,9 @@ bool initWifi(bool forceSoftAP)
For a reference to the codes:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#wi-fi-reason-code
*/
wifiDisconnectReason = info.disconnected.reason;
#endif
wifiDisconnectReason = info.wifi_sta_disconnected.reason;
},
#if CONFIG_IDF_TARGET_ESP32S3
WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
#else
WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
#endif
DEBUG_MSG("JOINING WIFI soon: ssid=%s\n", wifiName);
wifiReconnect = new Periodic("WifiConnect", reconnectWiFi);

View File

@@ -1,16 +1,8 @@
#include "CryptoEngine.h"
#include "configuration.h"
#if CONFIG_IDF_TARGET_ESP32S3
#include "mbedtls/aes.h"
#else
#include "crypto/includes.h"
#include "crypto/common.h"
// #include "esp_system.h"
#include "crypto/aes.h"
#include "crypto/aes_wrap.h"
#include "mbedtls/aes.h"
#endif
class ESP32CryptoEngine : public CryptoEngine