feature/APSTA #8

Merged
pablo2048 merged 2 commits from feature/APSTA into master 2020-08-21 14:05:01 +02:00
2 changed files with 16 additions and 0 deletions
Showing only changes of commit f42c8a1bf3 - Show all commits

View File

@ -941,4 +941,16 @@ wificonfigresult_t WiFiConfig::begin(int configarea, int forceConfigure, int tim
_time = millis() + (_timeout * 1000); // spocitame si novy cas, kdy budeme modul restartovat _time = millis() + (_timeout * 1000); // spocitame si novy cas, kdy budeme modul restartovat
return begin(configarea, forceConfigure, cb); // spustime WiFi return begin(configarea, forceConfigure, cb); // spustime WiFi
} }
void WiFiConfigPrepare(int configBase, String ssid, String pass)
{
EES_storeString(configBase + offsetof(wificonfigarea_t, ssid), elementSize(wificonfigarea_t, ssid), ssid);
EES_storeString(configBase + offsetof(wificonfigarea_t, pass), elementSize(wificonfigarea_t, pass), pass);
EEPROM.write(configBase + offsetof(wificonfigarea_t, mode), WIFIMODE_STA);
EEPROM.write(configBase + offsetof(wificonfigarea_t, ip), IPCONFIG_DHCP); // mame DHCP dynamickou konfiguraci
EEPROM.commit(); // ulozime zmeny v EEPROM
WiFi.mode(WIFI_STA); // startujeme WiFi v rezimu klienta
WiFi.begin(ssid.c_str(), pass.c_str());
}
// EOF // EOF

View File

@ -188,4 +188,8 @@ private:
uint32_t _time; // hodnota, po ktere bude ESP restartovano (pokud je _timeout != 0) uint32_t _time; // hodnota, po ktere bude ESP restartovano (pokud je _timeout != 0)
uint8_t _status; // stav pripojeni - je pouzity pro signalizaci duvodu, proc se nepripoji k AP uint8_t _status; // stav pripojeni - je pouzity pro signalizaci duvodu, proc se nepripoji k AP
}; };
// Priprava (inicializace) EEPROM oblasti napr. u zcela noveho zarizeni
// EEPROM je inicializovana pro rezim jen STA!!!
void WiFiConfigPrepare(int configBase, String ssid, String pass);
#endif #endif