BugFix, ktery opravuje nepouziti staticke adresy v SDK2.2.1(cfd48f3)
This commit is contained in:
parent
febbcefcb6
commit
7fdca6fa92
@ -12,7 +12,7 @@
|
||||
"type": "git",
|
||||
"url": "http://git.xpablo.cz/pablo2048/WiFiConfig.git"
|
||||
},
|
||||
"version": "5.5",
|
||||
"version": "5.7",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "espressif8266",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=WiFiConfig
|
||||
version=5.4.0
|
||||
version=5.7
|
||||
author=Pavel Brychta
|
||||
maintainer=Pavel Brychta <Pablo@xpablo.cz>
|
||||
sentence=Enables seamless module configuration.
|
||||
|
@ -1,4 +1,9 @@
|
||||
/*
|
||||
* V5.7 - 4.7.2018 - BugFix - staticka konfigurace ip adresy se neuplatnila - vypada to, jako kdyby SDK ukladalo SSID a Password, ale uz neuklada
|
||||
* konfiguraci ip adres, takze je treba je vzdycky nastavit znovu
|
||||
*
|
||||
* V5.6 - 1.7.2018 - BugFix - odstraneno volani _plusDecode, protoze parametry jsou nyni predavany v 'ciste' forme uz z weboveho serveru a tato metoda znehodnotila retezce, ktere obsahovaly ynak '+'
|
||||
*
|
||||
* V5.5 - 3.6.2018 - Flash Chip ID a ESP Chip ID jsou zobrazeny hexadecimalne v prehledove strance
|
||||
*
|
||||
* V5.4 - 9.1.2018 - na titulni stranku pridan duvod, proc je spusteny konfiguracni AP. Usnadni to diagnostiku pripadu, kdy se ESP nechce pripojit k AP.
|
||||
@ -494,14 +499,6 @@ void WiFiConfig::_handleDisplayAP(void)
|
||||
server->send(200, TEXTHTML, content);
|
||||
}
|
||||
|
||||
// Deal with (potentially) plus-encoded ssid/pass
|
||||
void WiFiConfig::_plusDecode(String &s)
|
||||
{
|
||||
|
||||
for (unsigned int i = 0; i < s.length(); i++)
|
||||
s[i] = (s[i] == '+' ? ' ' : s[i]);
|
||||
}
|
||||
|
||||
void WiFiConfig::_handleSetAP(void)
|
||||
{
|
||||
uint8_t mode;
|
||||
@ -511,11 +508,9 @@ void WiFiConfig::_handleSetAP(void)
|
||||
str = server->arg(F("_s"));
|
||||
if (str.length() > 0)
|
||||
{
|
||||
_plusDecode(str);
|
||||
setEEPROMString(configBase + offsetof(wificonfigarea_t, ssid), elementSize(wificonfigarea_t, ssid), str);
|
||||
|
||||
str = server->arg(F("_p"));
|
||||
_plusDecode(str);
|
||||
setEEPROMString(configBase + offsetof(wificonfigarea_t, pass), elementSize(wificonfigarea_t, pass), str);
|
||||
|
||||
str = server->arg(F("_n"));
|
||||
@ -585,17 +580,21 @@ void WiFiConfig::_handleSetAP(void)
|
||||
case WIFIMODE_STA:
|
||||
{
|
||||
DEBUG_MSG("STA mode.\r\n");
|
||||
WiFi.mode(WIFI_STA); // startujeme WiFi v rezimu klienta
|
||||
if (strlen(WiFiDeviceName))
|
||||
{
|
||||
WiFi.hostname(WiFiDeviceName); // nastavime jmeno zarizeni
|
||||
WiFi.begin(s.c_str(), pass.c_str());
|
||||
}
|
||||
if (IPCONFIG_STATIC == EEPROM.read(configBase + offsetof(wificonfigarea_t, ip)))
|
||||
{
|
||||
DEBUG_MSG("Static configuration.\r\n");
|
||||
WiFi.config(IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, ipaddr))), IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, gateway))),
|
||||
IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, netmask))), IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, dns))));
|
||||
delay(100);
|
||||
}
|
||||
WiFi.mode(WIFI_STA); // startujeme WiFi v rezimu klienta
|
||||
WiFi.begin(s.c_str(), pass.c_str());
|
||||
wifi_station_set_auto_connect(true);
|
||||
delay(1000);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -603,14 +602,20 @@ void WiFiConfig::_handleSetAP(void)
|
||||
DEBUG_MSG("AP mode.\r\n");
|
||||
WiFi.mode(WIFI_AP); // startujeme AP
|
||||
if (pass.length())
|
||||
// je zadane heslo do AP
|
||||
{
|
||||
// je zadane heslo do AP
|
||||
WiFi.softAP(s.c_str(), pass.c_str(), EEPROM.read(configBase + offsetof(wificonfigarea_t, apchannel)));
|
||||
}
|
||||
else
|
||||
// otevreny AP
|
||||
WiFi.softAP(s.c_str(), NULL, EEPROM.read(configBase + offsetof(wificonfigarea_t, apchannel)));
|
||||
{
|
||||
// otevreny AP
|
||||
WiFi.softAP(s.c_str(), NULL, EEPROM.read(configBase + offsetof(wificonfigarea_t, apchannel)));
|
||||
}
|
||||
if (IPCONFIG_STATIC == EEPROM.read(configBase + offsetof(wificonfigarea_t, ip)))
|
||||
{
|
||||
WiFi.softAPConfig(IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, ipaddr))), IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, gateway))),
|
||||
IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, netmask))));
|
||||
}
|
||||
break;
|
||||
|
||||
default: // jakykoliv neznamy rezim (mozna zavada na EEPROM???)
|
||||
@ -744,6 +749,12 @@ wificonfigresult_t WiFiConfig::begin(int configarea, uint8_t forceConfigure, wif
|
||||
case WIFIMODE_STA:
|
||||
{
|
||||
WiFi.hostname(WiFiDeviceName); // nastavime jmeno zarizeni
|
||||
if (IPCONFIG_STATIC == EEPROM.read(configBase + offsetof(wificonfigarea_t, ip)))
|
||||
{
|
||||
DEBUG_MSG("Static configuration SET.\r\n");
|
||||
WiFi.config(IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, ipaddr))), IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, gateway))),
|
||||
IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, netmask))), IPAddress(getEEPROMuint32(configBase + offsetof(wificonfigarea_t, dns))));
|
||||
}
|
||||
DEBUG_MSG("STA mode.\r\n");
|
||||
if (WC_DONT_RUN_CONFIGAP == _timeout)
|
||||
result = WCR_CONFIGAP_NOT_STARTED; // nemame spoustet konfiguracni AP - vracime se hned
|
||||
|
@ -168,7 +168,6 @@ private:
|
||||
void _handleRoot(); // jen jednoducha stranka kvuli CaptivePortalu umoznuje prejit na spravnou stranku (ale nedela to...)
|
||||
bool _testWifi(wificonfig_cb cb);
|
||||
WiFiConfigUsrParameter *_searchUsrParameter(const char *name);
|
||||
void _plusDecode(String &s);
|
||||
|
||||
WiFiConfigUsrParameter *_params; // ukazatel na posledni zadany uzivatelsky parametr
|
||||
int _timeout; // timeout pri cekani na konfiguraci
|
||||
|
@ -56,7 +56,7 @@ static const char PAGE_INDEX2[] PROGMEM = R"=====(
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label><input id='_st' name='_st' type='checkbox' style="width: 10%; float: left; margin-top: 5px;" onclick='hSC();' {a}>Staticka IP konfigurace</label>
|
||||
<label><input id='_st' name='_st' type='checkbox' style="width: 10%; float: left; margin-top: 5px;" onclick='hSC();' {c}>Staticka IP konfigurace</label>
|
||||
<div id="staticip">
|
||||
<label>IP adresa<br><input type="text" name="_i" pattern='((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$' title='ip adresa ve formatu <cislo>.<cislo>.<cislo>.<cislo>' value='{i}'></label><br>
|
||||
<label>Síťová maska<br><input type="text" name="_m" pattern='((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$' title='ip adresa ve formatu <cislo>.<cislo>.<cislo>.<cislo>' value='{m}'></label><br>
|
||||
|
Loading…
Reference in New Issue
Block a user