remove dependency on MQTT
This commit is contained in:
parent
79d16c0098
commit
e9415894ec
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Wifi",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Helper classes for handling wifi connectiviy and OTA",
|
||||
"repository":
|
||||
{
|
||||
|
||||
15
src/ota.h
15
src/ota.h
@ -2,16 +2,13 @@
|
||||
|
||||
namespace Ota {
|
||||
|
||||
void loop();
|
||||
Task tLoop(TASK_IMMEDIATE, TASK_FOREVER, loop, &ts, true);
|
||||
Task tLoop(TASK_IMMEDIATE, TASK_FOREVER, [] {ArduinoOTA.handle();}, &ts, true);
|
||||
|
||||
void setup() {
|
||||
void setup(void (*onStart)() = nullptr, void (*onEnd)() = nullptr, void (*onError)() = nullptr) {
|
||||
ArduinoOTA.onStart(
|
||||
[]() {
|
||||
[onStart]() {
|
||||
Serial.println("Starting OTA");
|
||||
Mqtt::publishCleanupConfig();
|
||||
delay(2000);
|
||||
Mqtt::disconnect();
|
||||
if (onStart) onStart();
|
||||
});
|
||||
ArduinoOTA.onEnd(
|
||||
[]() {
|
||||
@ -32,8 +29,4 @@ namespace Ota {
|
||||
});
|
||||
ArduinoOTA.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
ArduinoOTA.handle();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user