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 # define USEDFS LittleFS
# endif # endif
#endif #endif
#ifdef USE_WIFICONFIG_FSEDITOR
# include <SPIFFSEditor.h>
# include <FSWebEditor.h>
#endif
#if defined(ESP8266) #if defined(ESP8266)
// ESP8266 // ESP8266
@ -39,10 +43,8 @@
extern "C" { extern "C" {
# include "user_interface.h" # include "user_interface.h"
} }
# define ESP_getChipId() (ESP.getChipId())
#else #else
# include <esp_wifi.h> # include <esp_wifi.h>
# define ESP_getChipId() ((uint32_t)ESP.getEfuseMac())
#endif #endif
#define DNS_PORT 53 #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 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 getOurIP(void)
{ {
IPAddress ipa; IPAddress ipa;
@ -592,6 +608,21 @@ wificonfigresult_t WiFiConfig::_setupAP(wificonfig_cb cb)
} }
yield(); 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 #endif
server->begin(); // startujeme webovy server server->begin(); // startujeme webovy server

View File

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