Skip to content

OTA Update from Arduino IDE #346

Answered by Hieromon
phelje asked this question in How can I?
Mar 31, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

AutoConnect can coexist with the Arduino OTA class, but it's best to avoid AutoConnect responding to HTTP requests during OTA updates. Therefore, use the Arduino OTA callback function to detect the OTA start and skip the AutoConnect::handleClient process while OTA is in progress.
The following sketch is a sample based on this technique.

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <AutoConnect.h>

#define OTA_PASSWORD  "otaadmin"

AutoConnect portal;
ota_state_t otaState;

void setupOTA() {
  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH)
  …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@phelje
Comment options

Answer selected by Hieromon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants