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