Adds menu config of AutoConnectOTA

pull/197/head
Hieromon Ikasamo 5 years ago
parent 44efc54659
commit 371606942a
  1. 9
      src/AutoConnect.cpp
  2. 9
      src/AutoConnectOTA.h

@ -96,7 +96,7 @@ bool AutoConnect::begin(const char* ssid, const char* passphrase, unsigned long
} }
// Attach AutoConnectOTA if OTA is available. // Attach AutoConnectOTA if OTA is available.
if (_apConfig.ota) { if (_apConfig.ota != AC_OTA_NONE) {
_ota.reset(new AutoConnectOTA()); _ota.reset(new AutoConnectOTA());
_ota->attach(*this); _ota->attach(*this);
_ota->setTicker(_apConfig.tickerPort, _apConfig.tickerOn); _ota->setTicker(_apConfig.tickerPort, _apConfig.tickerOn);
@ -594,13 +594,16 @@ void AutoConnect::handleRequest(void) {
if (_update) if (_update)
_update->handleUpdate(); _update->handleUpdate();
// Indicate the reboot at the next handleClient turn // Post-process for AutoConnectOTA
// with on completion of the update via OTA.
if (_ota) { if (_ota) {
if (_ota->status() == AutoConnectOTA::OTA_RIP) { if (_ota->status() == AutoConnectOTA::OTA_RIP) {
// Indicate the reboot at the next handleClient turn
// with on completion of the update via OTA.
_webServer->client().setNoDelay(true); _webServer->client().setNoDelay(true);
_rfReset = true; _rfReset = true;
} }
// Reflect the menu display specifier from AutoConnectConfig to AutoConnectOTA page
_ota->menu(_apConfig.menuItems & AC_MENUITEM_UPDATE);
} }
} }

@ -36,9 +36,10 @@ class AutoConnectOTA : public AutoConnectUploadHandler {
AutoConnectOTA() : _status(OTA_IDLE), _tickerPort(-1), _tickerOn(LOW) {} AutoConnectOTA() : _status(OTA_IDLE), _tickerPort(-1), _tickerOn(LOW) {}
~AutoConnectOTA(); ~AutoConnectOTA();
void attach(AutoConnect& portal); void attach(AutoConnect& portal);
String error(void) const { return _err; } String error(void) const { return _err; } /**< Returns current error string */
AC_OTAStatus_t status(void) const { return _status; } void menu(const bool post) { _auxUpdate->menu(post); }; /**< Enabel or disable arranging a created AutoConnectOTA page in the menu. */
void setTicker(uint8_t pin, uint8_t on) { _tickerPort = pin, _tickerOn = on; } AC_OTAStatus_t status(void) const { return _status; } /**< Return current error status of the Update class */
void setTicker(int8_t pin, uint8_t on) { _tickerPort = pin, _tickerOn = on; } /**< Set ticker LED port */
protected: protected:
// Attribute definition of the element to be placed on the update page. // Attribute definition of the element to be placed on the update page.
@ -72,7 +73,7 @@ class AutoConnectOTA : public AutoConnectUploadHandler {
void _setError(void); void _setError(void);
AC_OTAStatus_t _status; /**< Status for update progress */ AC_OTAStatus_t _status; /**< Status for update progress */
uint8_t _tickerPort; /**< GPIO for flicker */ int8_t _tickerPort; /**< GPIO for flicker */
uint8_t _tickerOn; /**< A signal for flicker turn on */ uint8_t _tickerOn; /**< A signal for flicker turn on */
String _binName; /**< An updater file name */ String _binName; /**< An updater file name */
String _err; /**< Occurred error stamp */ String _err; /**< Occurred error stamp */

Loading…
Cancel
Save