Skip to content

Commit

Permalink
Add OTA support
Browse files Browse the repository at this point in the history
  • Loading branch information
netmindz committed Nov 11, 2023
1 parent 14f89cd commit b419b4f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/Sys/SysModOTA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
@title StarMod
@file SysModOTA.h
@date 20231111
@repo https://github.com/ewowi/StarMod
@Authors https://github.com/ewowi/StarMod/commits/main
@Copyright (c) 2023 Github StarMod Commit Authors
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
*/

#include "SysModule.h"

#include <ArduinoOTA.h>

class SysModOTA : public SysModule {

public:
SysModOTA() : SysModule("OTA") {
this->isEnabled = false;
this->success = false;
};

void connectedChanged() {
if(!SysModules::isConnected) return;
ArduinoOTA.begin();
this->success = true;
}

void loop1s() {
ArduinoOTA.handle();
this->isEnabled = true;
}
};

static SysModOTA *ota;
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Sys/SysModModel.h"
#include "Sys/SysModNetwork.h"
#include "Sys/SysModPins.h"
#include "Sys/SysModOTA.h"
#include "User/UserModInstances.h"
#include "User/UserModMDNS.h"
#ifdef APPMOD_LEDS
Expand Down Expand Up @@ -56,6 +57,7 @@ void setup() {
ui = new SysModUI();
sys = new SysModSystem();
pins = new SysModPins();
ota = new SysModOTA();
instances = new UserModInstances();
mdns = new UserModMDNS();
#ifdef APPMOD_LEDS
Expand Down Expand Up @@ -92,6 +94,7 @@ void setup() {
mdls->add(print);
mdls->add(web);
mdls->add(net);
mdls->add(ota);
#ifdef APPMOD_LEDS
#ifdef USERMOD_DDP
mdls->add(ddpmod);
Expand Down

0 comments on commit b419b4f

Please sign in to comment.