Changed evaluation timing of AutoConnectOTA enabled

pull/197/head
Hieromon Ikasamo 5 years ago
parent ef65329a75
commit 38a1f8c7d1
  1. 16
      src/AutoConnect.cpp

@ -95,13 +95,6 @@ bool AutoConnect::begin(const char* ssid, const char* passphrase, unsigned long
_ticker->start(AUTOCONNECT_FLICKER_PERIODDC, (uint8_t)AUTOCONNECT_FLICKER_WIDTHDC); _ticker->start(AUTOCONNECT_FLICKER_PERIODDC, (uint8_t)AUTOCONNECT_FLICKER_WIDTHDC);
} }
// Attach AutoConnectOTA if OTA is available.
if (_apConfig.ota == AC_OTA_BUILTIN) {
_ota.reset(new AutoConnectOTA());
_ota->attach(*this);
_ota->setTicker(_apConfig.tickerPort, _apConfig.tickerOn);
}
// Advance configuration for STA mode. Restore previous configuration of STA. // Advance configuration for STA mode. Restore previous configuration of STA.
station_config_t current; station_config_t current;
if (_getConfigSTA(&current)) { if (_getConfigSTA(&current)) {
@ -594,6 +587,15 @@ void AutoConnect::handleRequest(void) {
if (_update) if (_update)
_update->handleUpdate(); _update->handleUpdate();
// Attach AutoConnectOTA if OTA is available.
if (_apConfig.ota == AC_OTA_BUILTIN) {
if (!_ota) {
_ota.reset(new AutoConnectOTA());
_ota->attach(*this);
_ota->setTicker(_apConfig.tickerPort, _apConfig.tickerOn);
}
}
// Post-process for AutoConnectOTA // Post-process for AutoConnectOTA
if (_ota) { if (_ota) {
if (_ota->status() == AutoConnectOTA::OTA_RIP) { if (_ota->status() == AutoConnectOTA::OTA_RIP) {

Loading…
Cancel
Save