-
Notifications
You must be signed in to change notification settings - Fork 14
/
autoUpdate.ino
39 lines (37 loc) · 1 KB
/
autoUpdate.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <Arduino.h>
#include <MAGELLAN_SIM7600E_MQTT.h>
MAGELLAN_SIM7600E_MQTT magel;
int checkStatusUpdate = UNKNOWN;
void setup()
{
Serial.begin(115200);
magel.OTA.autoUpdate(); // this function ENABLED by default unless you set FALSE
setting.clientBufferSize = defaultOTABuffer; // set buffer size compatible for OTA
magel.begin(setting);
}
void loop()
{
magel.loop();
magel.subscribes([](){
checkStatusUpdate = magel.OTA.checkUpdate();
// subscribe function here!
});
magel.interval(10,[](){ //time interval function inside every 10000 millis
// doing function something every 10 sec here!
switch (checkStatusUpdate)
{
case UP_TO_DATE:
Serial.print(F("checkStatusUpdate: "));
Serial.println("# UP_TO_DATE");
break;
case OUT_OF_DATE:
Serial.print(F("checkStatusUpdate: "));
Serial.println(F("# OUT_OF_DATE"));
break;
default:
Serial.print(F("checkStatusUpdate: "));
Serial.println("# UNKNOWN");
break;
}
});
}