remove dependency on MQTT

This commit is contained in:
Nicu Hodos 2024-06-04 20:58:58 +02:00
parent 79d16c0098
commit e9415894ec
2 changed files with 5 additions and 12 deletions

View File

@ -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":
{ {

View File

@ -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();
}
} }