diff --git a/src/WiFiConfig.cpp b/src/WiFiConfig.cpp index 93a6d04..d2c78c4 100644 --- a/src/WiFiConfig.cpp +++ b/src/WiFiConfig.cpp @@ -20,6 +20,10 @@ # define USEDFS LittleFS # endif #endif +#ifdef USE_WIFICONFIG_FSEDITOR +# include +# include +#endif #if defined(ESP8266) // ESP8266 @@ -39,10 +43,8 @@ extern "C" { # include "user_interface.h" } -# define ESP_getChipId() (ESP.getChipId()) #else # include -# 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 diff --git a/src/WiFiConfig.h b/src/WiFiConfig.h index 489126a..2c623b6 100644 --- a/src/WiFiConfig.h +++ b/src/WiFiConfig.h @@ -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);