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",
"version": "1.0.0",
"version": "1.0.1",
"description": "Helper classes for handling wifi connectiviy and OTA",
"repository":
{

View File

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