Added the use of the OTAManager class in the SAB class
This commit is contained in:
parent
d0d5df2b98
commit
63b6cf626f
@ -6,6 +6,7 @@ _screenManager(_display, &_sdCardManager),
|
||||
_connectivityManager(_sdCardManager),
|
||||
_webServer(80, &_sdCardManager, 10),
|
||||
_ftpServer(21, &_sdCardManager, "ESP8266", "12345678", 10),
|
||||
_otaManager(_sdCardManager, _boardConfig),
|
||||
_dbWSServer(81),
|
||||
_pcf(_boardConfig.getI2C_IOExpanderAddress(), Wire),
|
||||
_ioManager(_pcf),
|
||||
@ -21,6 +22,7 @@ _screenManager(_display, &_sdCardManager),
|
||||
_connectivityManager(_sdCardManager),
|
||||
_webServer(webServerPort, &_sdCardManager, 10),
|
||||
_ftpServer(ftpServerPort, &_sdCardManager, "ESP8266", "12345678", 10),
|
||||
_otaManager(_sdCardManager, _boardConfig),
|
||||
_dbWSServer(81),
|
||||
_pcf(_boardConfig.getI2C_IOExpanderAddress(), Wire),
|
||||
_ioManager(_pcf),
|
||||
@ -39,12 +41,18 @@ void SAB::initCommonConfig()
|
||||
|
||||
//We initialize the pins for the I2C communication
|
||||
Wire.begin(_boardConfig.getI2C_sda(), _boardConfig.getI2C_scl());
|
||||
if(!_rtc.begin()) _error |= RTC_BEGIN_ERR;
|
||||
if(!_rtc.begin())
|
||||
_error |= RTC_BEGIN_ERR;
|
||||
else
|
||||
{
|
||||
_rtcManager.setDateTime(_rtc.now());
|
||||
}
|
||||
if(!_display.begin(SSD1306_SWITCHCAPVCC, _boardConfig.getI2C_screenAddress())){ _error |= DISP_BEGIN_ERR;}
|
||||
|
||||
if(!_display.begin(SSD1306_SWITCHCAPVCC, _boardConfig.getI2C_screenAddress()))
|
||||
{
|
||||
_error |= DISP_BEGIN_ERR;
|
||||
}
|
||||
|
||||
if(!_sdCardManager.mountSD())
|
||||
{
|
||||
_error |= SDCARD_INIT_ERR;
|
||||
@ -52,9 +60,11 @@ void SAB::initCommonConfig()
|
||||
_boardConfig.getSPISpeed(),
|
||||
_boardConfig.getSPI_SDCard_cs());
|
||||
}
|
||||
|
||||
_screenManager.init();
|
||||
if(!_connectivityManager.connect()){ _error |= CONNECT_ERR;}
|
||||
if(!_pcf.begin()){_error |= IO_INIT_ERR;}
|
||||
if(!_otaManager.init()){_error |= OTA_INIT_ERR;}
|
||||
|
||||
//We set the different servers :
|
||||
_webServer.setWWWDir(WWW_DIR);
|
||||
@ -104,7 +114,12 @@ FTPServer<FTPClient>& SAB::getFtpServer()
|
||||
return _ftpServer;
|
||||
}
|
||||
|
||||
IOManager& SAB::getIoManager()
|
||||
OTAManager& SAB::getOTAManager()
|
||||
{
|
||||
return _otaManager;
|
||||
}
|
||||
|
||||
IOManager& SAB::getIOManager()
|
||||
{
|
||||
return _ioManager;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "IOManager.h"
|
||||
#include "TaskSchedulerManager.h"
|
||||
#include "PowerManager.h"
|
||||
#include "OTAManager.h"
|
||||
#include "versions.h"
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#include <RTClib.h>
|
||||
@ -20,7 +21,7 @@
|
||||
class SAB
|
||||
{
|
||||
public:
|
||||
enum Error {RTC_BEGIN_ERR = 1, DISP_BEGIN_ERR = 2, SDCARD_INIT_ERR = 4, IO_INIT_ERR = 8, CONNECT_ERR = 16};
|
||||
enum Error {RTC_BEGIN_ERR = 1, DISP_BEGIN_ERR = 2, SDCARD_INIT_ERR = 4, IO_INIT_ERR = 8, CONNECT_ERR = 16, OTA_INIT_ERR = 32};
|
||||
|
||||
SAB();
|
||||
SAB(const BoardConfig boardConfig, const unsigned int webServerPort = 80, const unsigned int ftpServerPort = 21);
|
||||
@ -33,10 +34,10 @@ class SAB
|
||||
RTC_DS3231& getRTC_DS3231();
|
||||
SDCardManager& getSdCardManager();
|
||||
ConnectivityManager& getConnectivityManager();
|
||||
//WEBServerManager& getWebServerManager();
|
||||
WEBServer<WEBClient>& getWebServer();
|
||||
FTPServer<FTPClient>& getFtpServer();
|
||||
IOManager& getIoManager();
|
||||
OTAManager& getOTAManager();
|
||||
IOManager& getIOManager();
|
||||
TaskSchedulerManager& getTaskSchedulerManager();
|
||||
PowerManager& getPowerManager();
|
||||
TimeSpan getUpTime() const;
|
||||
@ -56,10 +57,10 @@ class SAB
|
||||
RTC_DS3231 _rtc;
|
||||
RtcManager _rtcManager;
|
||||
ConnectivityManager _connectivityManager;
|
||||
//WEBServerManager _webServerManager;
|
||||
WEBServer<WEBClient> _webServer;
|
||||
FTPServer<FTPClient> _ftpServer;
|
||||
DashboardWSServer _dbWSServer;
|
||||
OTAManager _otaManager;
|
||||
DashboardWSServer _dbWSServer;
|
||||
PCF8574 _pcf;
|
||||
IOManager _ioManager;
|
||||
TaskSchedulerManager _taskSchedulerManager;
|
||||
|
Loading…
Reference in New Issue
Block a user