Moznost pouzit editor souboroveho systemu pomoci USE_WIFICONFIG_FSEDITOR, bugfix v ID cipu pro ESP32

This commit is contained in:
Pavel Brychta 2021-08-07 11:20:44 +02:00
parent ba361b7ae4
commit 95a15b11dc
2 changed files with 34 additions and 3 deletions

View File

@ -20,6 +20,10 @@
# define USEDFS LittleFS
# endif
#endif
#ifdef USE_WIFICONFIG_FSEDITOR
# include <SPIFFSEditor.h>
# include <FSWebEditor.h>
#endif
#if defined(ESP8266)
// ESP8266
@ -39,10 +43,8 @@
extern "C" {
# include "user_interface.h"
}
# define ESP_getChipId() (ESP.getChipId())
#else
# include <esp_wifi.h>
# define ESP_getChipId() ((uint32_t)ESP.getEfuseMac())
#endif
#define DNS_PORT 53
@ -53,6 +55,20 @@ static const char CHECKED[] PROGMEM = "checked='checked'";
static bool _doReconfig = false; // TODO: mozna nejak elegantneji? Ale zase setrime RAM...
static uint32_t ESP_getChipId(void)
{
#if defined(ESP8266)
return ESP.getChipId();
#else
uint32_t id = 0;
for (int i = 0; i < 17; i = i + 8) {
id |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
return id;
#endif
}
IPAddress getOurIP(void)
{
IPAddress ipa;
@ -592,6 +608,21 @@ wificonfigresult_t WiFiConfig::_setupAP(wificonfig_cb cb)
}
yield();
});
#endif
#ifdef USE_WIFICONFIG_FSEDITOR
#if 0
#if defined(ESP8266)
server->addHandler(new SPIFFSEditor("admin", "nimda", USEDFS));
#else
server->addHandler(new SPIFFSEditor(USEDFS, "admin", "nimda"));
#endif
#else
#if defined(ESP8266)
server->addHandler(new FSWebEditor("admin", "nimda"));
#else
server->addHandler(new FSWebEditor(USEDFS, "admin", "nimda"));
#endif
#endif
#endif
server->begin(); // startujeme webovy server

View File

@ -135,7 +135,7 @@ private:
class WiFiConfig
{
public:
WiFiConfig(): _params(NULL), _timeout(0) {}
WiFiConfig(): _params(nullptr), _timeout(0) {}
wificonfigresult_t begin(int forceConfigure, wificonfig_cb cb);
wificonfigresult_t begin(int forceConfigure, int timeout, wificonfig_cb cb);
void addParameter(WiFiConfigUsrParameter *p);