esp_ota_example/src/main.cpp

32 lines
523 B
C++
Raw Normal View History

2022-07-25 10:31:08 +00:00
#include <Arduino.h>
2022-07-25 10:53:27 +00:00
#include "simpleota.h"
2022-07-25 10:31:08 +00:00
void setup() {
Serial.begin(115200);
Serial.println();
2022-07-25 10:53:27 +00:00
Serial.println("Initializing");
2022-07-25 10:31:08 +00:00
checkOTA();
2022-07-25 10:53:27 +00:00
if(initOTA()) { //initialize ota if ota enabled
return; //if ota do nothing else for setup
2022-07-25 10:31:08 +00:00
}
2022-07-25 10:53:27 +00:00
Serial.println("Booting normal");
2022-07-25 10:31:08 +00:00
}
2022-07-25 10:53:27 +00:00
void loop() {
2022-07-25 11:16:07 +00:00
if (loopOTA()) {
2022-07-25 10:53:27 +00:00
return; //just wait for ota
}
2022-07-25 10:31:08 +00:00
static unsigned long last_print=0;
if (millis()-last_print>1000) {
last_print=millis();
Serial.println("Loop");
}
2022-07-25 10:53:27 +00:00
}