diff --git a/src/WiFiConfig.cpp b/src/WiFiConfig.cpp index 050f456..be6c72e 100644 --- a/src/WiFiConfig.cpp +++ b/src/WiFiConfig.cpp @@ -167,11 +167,11 @@ void setEEPROMuint32(unsigned int start, uint32_t val) String getEEPROMString(unsigned int start, size_t maxlen) { uint8_t mac[WL_MAC_ADDR_LENGTH]; - unsignd int enciphidx = 0; + unsigned int enciphidx = 0; String string = ""; WiFi.softAPmacAddress(mac); - for (unsigned int i = start; i < + start + len; ++i) + for (unsigned int i = start; i < + start + maxlen; ++i) { uint8_t b = EEPROM.read(i); @@ -186,14 +186,14 @@ String getEEPROMString(unsigned int start, size_t maxlen) return string; } -void setEEPROMString(unsigned int start, size_t len, String &string) +void setEEPROMString(unsigned int start, size_t maxlen, String &string) { uint8_t mac[WL_MAC_ADDR_LENGTH]; - unsignd int enciphidx = 0; + unsigned int enciphidx = 0; unsigned int si = 0; WiFi.softAPmacAddress(mac); - for (unsigned int i = start; i < start + len; ++i) + for (unsigned int i = start; i < start + maxlen; ++i) { char c; @@ -213,7 +213,7 @@ void setEEPROMString(unsigned int start, size_t len, String &string) } } -WiFiConfigUsrParameter::WiFiConfigUsrParameter(const char *id, const char *label, const char *defaultValue, int length, storeparam_cb cb) +WiFiConfigUsrParameter::WiFiConfigUsrParameter(const char *id, const char *label, const char *defaultValue, unsigned int length, storeparam_cb cb) { _next = NULL; _cb = cb; @@ -300,12 +300,12 @@ void WiFiConfig::_handleNotFound(void) if (server->uri().endsWith(String(F("favicon.ico")))) { - server->send_P(404, FPSTR(TEXTPLAIN), PSTR("Err")); + server->send_P(404, TEXTPLAIN, PSTR("Err")); } else { server->sendHeader(F("Location"), String(F("http://")) + server->client().localIP().toString() + String(F("/index.htm")), true); - server->send_P(302, FPSTR(TEXTPLAIN), PSTR("Redirect")); + server->send_P(302, TEXTPLAIN, PSTR("Redirect")); } } @@ -319,7 +319,7 @@ void WiFiConfig::_handleReset(void) ESP.restart(); }); - server->send_P(200, FPSTR(TEXTHTML), FPSTR(PAGE_RESTART)); + server->send_P(200, TEXTHTML, PAGE_RESTART); } void WiFiConfig::_handleInfo(void) @@ -579,7 +579,7 @@ void WiFiConfig::_handleSetAP(void) } EEPROM.commit(); // skutecne ulozime data } - server->send_P(200, FPSTR(TEXTHTML), FPSTR(PAGE_SAVED)); + server->send_P(200, TEXTHTML, PAGE_SAVED); delay(2000); // cekame na odeslani dat // nakonfigurujeme ESP dle nove nastavenych parametru WiFi.disconnect(); // vsechno odpojime diff --git a/src/WiFiConfig.h b/src/WiFiConfig.h index 3fdfce4..ad089c2 100644 --- a/src/WiFiConfig.h +++ b/src/WiFiConfig.h @@ -94,7 +94,7 @@ typedef void (*storeparam_cb)(const char *newvalue); // callback pro ulozeni uzi * \param [in] len Delka retezce * \return Vycteny retezec */ -String getEEPROMString(unsigned int start, size_t len); +String getEEPROMString(unsigned int start, size_t maxlen); /** * \brief Ulozeni retezce do EEPROM @@ -103,7 +103,7 @@ String getEEPROMString(unsigned int start, size_t len); * \param [in] len Maximalni delka ulozeneho retezce * \param [in] string Ukladany retezec */ -void setEEPROMString(unsigned int start, size_t len, String string); +void setEEPROMString(unsigned int start, size_t maxlen, String &string); /** * \brief Ziskani nasi ip adresy @@ -144,7 +144,7 @@ extern char WiFiDeviceName[]; // jmeno zarizeni, pouzivane i pro DHCP class WiFiConfigUsrParameter { public: - WiFiConfigUsrParameter(const char *id, const char *label, const char *defaultValue, int length, storeparam_cb cb); + WiFiConfigUsrParameter(const char *id, const char *label, const char *defaultValue, unsigned int length, storeparam_cb cb); const char *getID(); const char *getValue();