Removed as many warnings as I could ... after enabling the all warning compiler flag
This commit is contained in:
parent
d2f620597c
commit
460db55496
@ -18,7 +18,7 @@ _I2C_scl(I2C_scl == DEFAULT_PIN ? GPIO_5_SCL : I2C_scl),
|
|||||||
_SPI_mosi(SPI_mosi == DEFAULT_PIN ? GPIO_13_MOSI : SPI_mosi),
|
_SPI_mosi(SPI_mosi == DEFAULT_PIN ? GPIO_13_MOSI : SPI_mosi),
|
||||||
_SPI_miso(SPI_miso == DEFAULT_PIN ? GPIO_12_MISO : SPI_miso),
|
_SPI_miso(SPI_miso == DEFAULT_PIN ? GPIO_12_MISO : SPI_miso),
|
||||||
_SPI_clk(SPI_clk == DEFAULT_PIN ? GPIO_14_CLK : SPI_clk),
|
_SPI_clk(SPI_clk == DEFAULT_PIN ? GPIO_14_CLK : SPI_clk),
|
||||||
_SPI_SDCard_cs(_SPI_SDCard_cs == DEFAULT_PIN ? GPIO_2 : SPI_SDCard_cs),
|
_SPI_SDCard_cs(SPI_SDCard_cs == DEFAULT_PIN ? GPIO_2 : SPI_SDCard_cs),
|
||||||
_I2C_screenAddress(I2C_screenAddress),
|
_I2C_screenAddress(I2C_screenAddress),
|
||||||
_I2C_IOExpanderAddress(I2C_IOExpanderAddress),
|
_I2C_IOExpanderAddress(I2C_IOExpanderAddress),
|
||||||
_I2C_RTCFlashAddress(_I2C_RTCFlashAddress),
|
_I2C_RTCFlashAddress(_I2C_RTCFlashAddress),
|
||||||
|
@ -22,7 +22,7 @@ class BoardConfig
|
|||||||
const Pin SPI_mosi = GPIO_13_MOSI,
|
const Pin SPI_mosi = GPIO_13_MOSI,
|
||||||
const Pin SPI_miso = GPIO_12_MISO,
|
const Pin SPI_miso = GPIO_12_MISO,
|
||||||
const Pin SPI_clk = GPIO_14_CLK,
|
const Pin SPI_clk = GPIO_14_CLK,
|
||||||
const uint32_t spiSpeed = SPI_FULL_SPEED
|
const uint32_t spiSpeed = 0//SPI_FULL_SPEED
|
||||||
);
|
);
|
||||||
|
|
||||||
Pin getI2C_sda() const;
|
Pin getI2C_sda() const;
|
||||||
|
@ -142,6 +142,8 @@ void *CFGFileParser::parseFile()
|
|||||||
parsedParameter = NULL;
|
parsedParameter = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +196,8 @@ boolean CFGFileParser::save(void *data)
|
|||||||
_state = COMMENT_SECTION;
|
_state = COMMENT_SECTION;
|
||||||
else if(readChar == '\n') _state = DONE;
|
else if(readChar == '\n') _state = DONE;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +208,7 @@ boolean CFGFileParser::save(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Let's write the settings
|
//Let's write the settings
|
||||||
for(int i = 0; i < ref->count(); i++)
|
for(unsigned int i = 0; i < ref->count(); i++)
|
||||||
{
|
{
|
||||||
CFGParameterValue *cfgPV = ref->getAt(i);
|
CFGParameterValue *cfgPV = ref->getAt(i);
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ public:
|
|||||||
return strcmp(_value,"true") == 0 || strcmp(_value,"TRUE") == 0 ? true : false;
|
return strcmp(_value,"true") == 0 || strcmp(_value,"TRUE") == 0 ? true : false;
|
||||||
}
|
}
|
||||||
const char *getParameter() const{return _parameter == NULL ? "" : _parameter;}
|
const char *getParameter() const{return _parameter == NULL ? "" : _parameter;}
|
||||||
const bool isQuotedParameter()const{return _quotedParameter;}
|
bool isQuotedParameter()const{return _quotedParameter;}
|
||||||
const bool isQuotedValue()const{return _quotedValue;}
|
bool isQuotedValue()const{return _quotedValue;}
|
||||||
virtual const char *toString()
|
virtual const char *toString()
|
||||||
{
|
{
|
||||||
return _value;
|
return _value;
|
||||||
|
@ -11,7 +11,7 @@ protected:
|
|||||||
}
|
}
|
||||||
DictionaryInterface(const DictionaryInterface &Object)
|
DictionaryInterface(const DictionaryInterface &Object)
|
||||||
{
|
{
|
||||||
|
(void)Object;
|
||||||
}
|
}
|
||||||
virtual ~DictionaryInterface(){}
|
virtual ~DictionaryInterface(){}
|
||||||
virtual const char *toString() = 0;
|
virtual const char *toString() = 0;
|
||||||
|
@ -1,21 +1,6 @@
|
|||||||
#include "FTPClient.h"
|
#include "FTPClient.h"
|
||||||
|
|
||||||
FTPClient::FTPClient(WiFiClient client, uint8_t id, uint16_t clientCommandDataBufferSize) : TCPClient(client, id, clientCommandDataBufferSize),
|
FTPClient::FTPClient(WiFiClient client, uint8_t id, uint16_t clientCommandDataBufferSize) : TCPClient(client, id, clientCommandDataBufferSize)
|
||||||
_ftpCommand({'\0'}),
|
|
||||||
_cmdParameters(NULL),
|
|
||||||
_loggedIn(false),
|
|
||||||
_username(NULL),
|
|
||||||
_currentDirectory(NULL),
|
|
||||||
_currentFile(NULL),
|
|
||||||
_fileSentBytes(0),
|
|
||||||
_fileRecvBytes(0),
|
|
||||||
_waitingForDataConnection(false),
|
|
||||||
_fileIsBeeingReceived(false),
|
|
||||||
_actionTimeout(0),
|
|
||||||
_dataClientConnected(false),
|
|
||||||
_ftpClientState(FTPServer<FTPClient>::FTPClientState::INIT),
|
|
||||||
_binaryFlag(FTPServer<FTPClient>::BinaryFlag::OFF),
|
|
||||||
_dataTransferPending(FTPServer<FTPClient>::FTPClientDataTransfer::NONE)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,22 +23,22 @@ class FTPClient : public TCPClient
|
|||||||
void startTimeout();
|
void startTimeout();
|
||||||
void closeDataConnection();
|
void closeDataConnection();
|
||||||
|
|
||||||
char _ftpCommand[5];
|
char _ftpCommand[5] = {'\0'};
|
||||||
Dictionary<DictionaryHelper::StringEntity> *_cmdParameters;
|
Dictionary<DictionaryHelper::StringEntity> *_cmdParameters = NULL;
|
||||||
boolean _loggedIn;
|
boolean _loggedIn = false;
|
||||||
char *_username;
|
char *_username = NULL;
|
||||||
char *_currentDirectory;
|
char *_currentDirectory = NULL;
|
||||||
char *_currentFile;
|
char *_currentFile = NULL;
|
||||||
uint64_t _fileSentBytes;
|
uint64_t _fileSentBytes = 0;
|
||||||
uint64_t _fileRecvBytes;
|
uint64_t _fileRecvBytes = 0;
|
||||||
boolean _waitingForDataConnection;
|
boolean _waitingForDataConnection = false;
|
||||||
boolean _fileIsBeeingReceived;
|
boolean _fileIsBeeingReceived = false;
|
||||||
uint64_t _actionTimeout;
|
uint64_t _actionTimeout = 0;
|
||||||
boolean _dataClientConnected;
|
boolean _dataClientConnected = false;
|
||||||
|
|
||||||
FTPServer<FTPClient>::FTPClientState _ftpClientState;
|
FTPServer<FTPClient>::FTPClientState _ftpClientState = FTPServer<FTPClient>::FTPClientState::INIT;
|
||||||
FTPServer<FTPClient>::BinaryFlag _binaryFlag;
|
FTPServer<FTPClient>::BinaryFlag _binaryFlag = FTPServer<FTPClient>::BinaryFlag::OFF;
|
||||||
FTPServer<FTPClient>::FTPClientDataTransfer _dataTransferPending;
|
FTPServer<FTPClient>::FTPClientDataTransfer _dataTransferPending = FTPServer<FTPClient>::FTPClientDataTransfer::NONE;
|
||||||
WiFiClient _dataClient; //data socket
|
WiFiClient _dataClient; //data socket
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class FTPServer : public TCPServer<T>
|
|||||||
client->_clientState = TCPClient::HANDLED;
|
client->_clientState = TCPClient::HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICACHE_RAM_ATTR virtual void processClientData(T *client)
|
IRAM_ATTR virtual void processClientData(T *client)
|
||||||
{
|
{
|
||||||
/*if (client->_waitingForDataConnection)
|
/*if (client->_waitingForDataConnection)
|
||||||
{
|
{
|
||||||
@ -263,6 +263,8 @@ class FTPServer : public TCPServer<T>
|
|||||||
client->_fileRecvBytes = 0;
|
client->_fileRecvBytes = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_FTPS
|
#ifdef DEBUG_FTPS
|
||||||
@ -790,7 +792,7 @@ class FTPServer : public TCPServer<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Here we write the received file to the sd card
|
//Here we write the received file to the sd card
|
||||||
ICACHE_RAM_ATTR inline boolean writeToSdCard(T *client, FileTransferStatus *fts, boolean append = false)
|
IRAM_ATTR inline boolean writeToSdCard(T *client, FileTransferStatus *fts, boolean append = false)
|
||||||
{
|
{
|
||||||
if (client->_currentFile != NULL)
|
if (client->_currentFile != NULL)
|
||||||
{
|
{
|
||||||
@ -828,7 +830,7 @@ class FTPServer : public TCPServer<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Here we send the fs tree to the ftp client
|
//Here we send the fs tree to the ftp client
|
||||||
ICACHE_RAM_ATTR inline boolean sendFSTree(T *client)
|
IRAM_ATTR inline boolean sendFSTree(T *client)
|
||||||
{
|
{
|
||||||
if (client->_currentDirectory != NULL)
|
if (client->_currentDirectory != NULL)
|
||||||
{
|
{
|
||||||
@ -886,7 +888,7 @@ class FTPServer : public TCPServer<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
//The binary flag needs to be taken into consideration
|
//The binary flag needs to be taken into consideration
|
||||||
ICACHE_RAM_ATTR inline boolean sendFile(T *client, FileTransferStatus *fts)
|
IRAM_ATTR inline boolean sendFile(T *client, FileTransferStatus *fts)
|
||||||
{
|
{
|
||||||
if (client->_currentFile != NULL)
|
if (client->_currentFile != NULL)
|
||||||
{
|
{
|
||||||
@ -992,6 +994,8 @@ class FTPServer : public TCPServer<T>
|
|||||||
case _550:
|
case _550:
|
||||||
client->_client.printf_P(PSTR("550 Requested action not taken. %s\r\n"), msg);
|
client->_client.printf_P(PSTR("550 Requested action not taken. %s\r\n"), msg);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
client->_client.printf_P(PSTR("XXX Unhandled error code. %s\r\n"), msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,6 @@ public:
|
|||||||
|
|
||||||
T* removeLastRef()
|
T* removeLastRef()
|
||||||
{
|
{
|
||||||
unsigned int position(0);
|
|
||||||
if(_head->_next == NULL) return NULL;
|
if(_head->_next == NULL) return NULL;
|
||||||
|
|
||||||
List *cursor = _head, *toRemove(NULL);
|
List *cursor = _head, *toRemove(NULL);
|
||||||
@ -211,7 +210,7 @@ public:
|
|||||||
int contains(T *value)
|
int contains(T *value)
|
||||||
{
|
{
|
||||||
unsigned int position(-1);
|
unsigned int position(-1);
|
||||||
if(_head->_next == NULL) return NULL;
|
if(_head->_next == NULL) return 0;
|
||||||
|
|
||||||
List *cursor = _head;
|
List *cursor = _head;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void SAB::initCommonConfig()
|
|||||||
initGPIO();
|
initGPIO();
|
||||||
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
|
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
delay(200);
|
delay(1000);
|
||||||
|
|
||||||
//We initialize the pins for the I2C communication
|
//We initialize the pins for the I2C communication
|
||||||
Wire.begin(_boardConfig.getI2C_sda(), _boardConfig.getI2C_scl());
|
Wire.begin(_boardConfig.getI2C_sda(), _boardConfig.getI2C_scl());
|
||||||
@ -57,7 +57,7 @@ void SAB::initCommonConfig()
|
|||||||
{
|
{
|
||||||
SAB::_rtcManagerP = &_rtcManager;
|
SAB::_rtcManagerP = &_rtcManager;
|
||||||
}
|
}
|
||||||
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; Serial.print("Failed to init SDCard : SPI_SPEED : "); Serial.print(8000000); Serial.print(" CS PIN : "); Serial.println(_boardConfig.getSPI_SDCard_cs());}
|
if(!_sdCardManager.mountSD()){ _error |= SDCARD_INIT_ERR; Serial.print("Failed to init SDCard : SPI_SPEED : "); Serial.print(8000000); Serial.print(" CS PIN : "); Serial.println(_boardConfig.getSPI_SDCard_cs());}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -50,15 +50,14 @@ class SAB
|
|||||||
void initGPIO();
|
void initGPIO();
|
||||||
static time_t myTimeCallback();
|
static time_t myTimeCallback();
|
||||||
void initCommonConfig();
|
void initCommonConfig();
|
||||||
|
|
||||||
const BoardConfig _boardConfig;
|
const BoardConfig _boardConfig;
|
||||||
|
SDCardManager _sdCardManager;
|
||||||
|
|
||||||
Adafruit_SSD1306 _display;
|
Adafruit_SSD1306 _display;
|
||||||
ScreenManager _screenManager;
|
ScreenManager _screenManager;
|
||||||
RTC_DS3231 _rtc;
|
RTC_DS3231 _rtc;
|
||||||
RtcManager _rtcManager;
|
RtcManager _rtcManager;
|
||||||
static RtcManager *_rtcManagerP;
|
static RtcManager *_rtcManagerP;
|
||||||
SDCardManager _sdCardManager;
|
|
||||||
ConnectivityManager *_connectivityManager;
|
ConnectivityManager *_connectivityManager;
|
||||||
//WEBServerManager _webServerManager;
|
//WEBServerManager _webServerManager;
|
||||||
WEBServer<WEBClient> _webServer;
|
WEBServer<WEBClient> _webServer;
|
||||||
@ -68,7 +67,6 @@ class SAB
|
|||||||
IOManager _ioManager;
|
IOManager _ioManager;
|
||||||
TaskSchedulerManager _taskSchedulerManager;
|
TaskSchedulerManager _taskSchedulerManager;
|
||||||
PowerManager _powerManager;
|
PowerManager _powerManager;
|
||||||
|
|
||||||
DateTime _powerUpTime;
|
DateTime _powerUpTime;
|
||||||
uint8_t _error;
|
uint8_t _error;
|
||||||
};
|
};
|
||||||
|
@ -5,35 +5,35 @@ SDCardManager::SDCardManager(const Pin csPin, uint32_t cfg) : _csPin(csPin), _sp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double SDCardManager::getSize(const SizeUnit sizeUnit)
|
float SDCardManager::getSize(const SizeUnit sizeUnit)
|
||||||
{
|
{
|
||||||
uint64_t numberOf512BytesChunks = blocksPerCluster() * totalClusters();//cardSize();
|
uint64_t numberOf512BytesChunks = blocksPerCluster() * totalClusters();//cardSize();
|
||||||
double result = 0;
|
float result = 0;
|
||||||
|
|
||||||
if(!isMounted()) return 0.0;
|
if(!isMounted()) return 0.0;
|
||||||
|
|
||||||
switch(sizeUnit)
|
switch(sizeUnit)
|
||||||
{
|
{
|
||||||
case KBIT:
|
case KBIT:
|
||||||
result = (double)numberOf512BytesChunks/2.0*8;
|
result = (float)numberOf512BytesChunks/2.0*8;
|
||||||
break;
|
break;
|
||||||
case KBYTE:
|
case KBYTE:
|
||||||
result = (double)numberOf512BytesChunks/2.0;
|
result = (float)numberOf512BytesChunks/2.0;
|
||||||
break;
|
break;
|
||||||
case MBIT:
|
case MBIT:
|
||||||
result = (double)numberOf512BytesChunks/2.0/1024.0*8;
|
result = (float)numberOf512BytesChunks/2.0/1024.0*8;
|
||||||
break;
|
break;
|
||||||
case MBYTE:
|
case MBYTE:
|
||||||
result = (double)numberOf512BytesChunks/2.0/1024.0;
|
result = (float)numberOf512BytesChunks/2.0/1024.0;
|
||||||
break;
|
break;
|
||||||
case GBIT:
|
case GBIT:
|
||||||
result = (double)numberOf512BytesChunks/2.0/1024.0/1024.0*8;
|
result = (float)numberOf512BytesChunks/2.0/1024.0/1024.0*8;
|
||||||
break;
|
break;
|
||||||
case GBYTE:
|
case GBYTE:
|
||||||
result = (double)numberOf512BytesChunks/2.0/1024.0/1024.0;
|
result = (float)numberOf512BytesChunks/2.0/1024.0/1024.0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = (double)numberOf512BytesChunks/2.0/1024.0/1024.0;
|
result = (float)numberOf512BytesChunks/2.0/1024.0/1024.0;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ class SDCardManager : public SDClass
|
|||||||
friend class SAB;
|
friend class SAB;
|
||||||
public:
|
public:
|
||||||
SDCardManager(const Pin csPin, uint32_t cfg);
|
SDCardManager(const Pin csPin, uint32_t cfg);
|
||||||
double getSize(const SizeUnit sizeUnit = GBYTE);
|
float getSize(const SizeUnit sizeUnit = GBYTE);
|
||||||
boolean mountSD();
|
boolean mountSD();
|
||||||
void unMountSD();
|
void unMountSD();
|
||||||
boolean isMounted();
|
boolean isMounted();
|
||||||
|
@ -18,7 +18,7 @@ ScreenManager::ScreenManager(Adafruit_SSD1306 &display, SDCardManager *sdCardMan
|
|||||||
|
|
||||||
boolean ScreenManager::init()
|
boolean ScreenManager::init()
|
||||||
{
|
{
|
||||||
applyCfgFromSD();
|
return applyCfgFromSD();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean ScreenManager::applyCfgFromSD()
|
boolean ScreenManager::applyCfgFromSD()
|
||||||
@ -60,7 +60,7 @@ boolean ScreenManager::applyCfgFromSD()
|
|||||||
else //Default value applied
|
else //Default value applied
|
||||||
{
|
{
|
||||||
setDefault();
|
setDefault();
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ class ScreenManager
|
|||||||
struct viewLink *next, *previous;
|
struct viewLink *next, *previous;
|
||||||
} ViewLink, *ViewLinkedList;
|
} ViewLink, *ViewLinkedList;
|
||||||
|
|
||||||
|
ScreenManager(Adafruit_SSD1306 &display, SDCardManager *sdCardManager = NULL);
|
||||||
|
|
||||||
boolean addView(boolean (*viewLogicFunction)(Adafruit_SSD1306&, void*), void *pData, const unsigned char UID);
|
boolean addView(boolean (*viewLogicFunction)(Adafruit_SSD1306&, void*), void *pData, const unsigned char UID);
|
||||||
boolean removeView(const unsigned char UID);
|
boolean removeView(const unsigned char UID);
|
||||||
boolean displayView(const uint8_t UID);
|
boolean displayView(const uint8_t UID);
|
||||||
@ -52,7 +54,6 @@ class ScreenManager
|
|||||||
void iterateThroughList();
|
void iterateThroughList();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ScreenManager(Adafruit_SSD1306 &display, SDCardManager *sdCardManager = NULL);
|
|
||||||
private:
|
private:
|
||||||
void *createEmptyList();
|
void *createEmptyList();
|
||||||
boolean addNewLinkAtTheEnd(ViewLinkedList *viewLinkedList, ViewLink viewLink);
|
boolean addNewLinkAtTheEnd(ViewLinkedList *viewLinkedList, ViewLink viewLink);
|
||||||
|
@ -59,7 +59,7 @@ bool TCPClient::operator==(TCPClient& Object)
|
|||||||
return this->_client == Object._client;
|
return this->_client == Object._client;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TCPClient::closeConnection()
|
void TCPClient::closeConnection()
|
||||||
{
|
{
|
||||||
_client.stop();
|
_client.stop();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class TCPClient
|
|||||||
TCPClient(const TCPClient &Object);
|
TCPClient(const TCPClient &Object);
|
||||||
virtual ~TCPClient();
|
virtual ~TCPClient();
|
||||||
bool operator==(TCPClient& Object);
|
bool operator==(TCPClient& Object);
|
||||||
bool closeConnection();
|
void closeConnection();
|
||||||
protected:
|
protected:
|
||||||
enum ClientState {NEW, HANDLED, DISCARDED} _clientState;
|
enum ClientState {NEW, HANDLED, DISCARDED} _clientState;
|
||||||
enum Error {OK = 0, MALLOC_ERR = 1} _error;
|
enum Error {OK = 0, MALLOC_ERR = 1} _error;
|
||||||
|
@ -13,7 +13,7 @@ template <typename T>
|
|||||||
class TCPServer
|
class TCPServer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TCPServer(uint16_t port = 80, uint8_t maxClient = MAX_CLIENT, uint16_t clientDataBufferSize = 255) : _wifiServer(port), _serverStarted(true), _maxClient(maxClient), _clientDataBufferSize(clientDataBufferSize), _currentClient(NULL)
|
TCPServer(uint16_t port = 80, uint8_t maxClient = MAX_CLIENT, uint16_t clientDataBufferSize = 255) : _serverStarted(true), _maxClient(maxClient), _clientDataBufferSize(clientDataBufferSize), _wifiServer(port), _currentClient(NULL)
|
||||||
{
|
{
|
||||||
_wifiServer.begin();
|
_wifiServer.begin();
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ class TCPServer
|
|||||||
if(wc && wc.connected())
|
if(wc && wc.connected())
|
||||||
{
|
{
|
||||||
T *clientPointer = createNewClient(wc);
|
T *clientPointer = createNewClient(wc);
|
||||||
Serial.printf("Addr : %lu\n", clientPointer);
|
//Serial.printf("Addr : %lu\n", clientPointer);
|
||||||
//We activate the TKA : (The check is internally done in the
|
//We activate the TKA : (The check is internally done in the
|
||||||
//ClientContext.h class : ie if one of the provided parameters is 0, then TKA is disabled)
|
//ClientContext.h class : ie if one of the provided parameters is 0, then TKA is disabled)
|
||||||
(clientPointer->_client).keepAlive(_TKAIdleSec, _TKAIntvSec, _TKACount);
|
(clientPointer->_client).keepAlive(_TKAIdleSec, _TKAIntvSec, _TKACount);
|
||||||
|
@ -159,22 +159,22 @@ boolean TaskSchedulerManager::removeTask(uint16_t id)
|
|||||||
return _taskDataDictio.remove(id);
|
return _taskDataDictio.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean TaskSchedulerManager::enableTask(const char *name)
|
void TaskSchedulerManager::enableTask(const char *name)
|
||||||
{
|
{
|
||||||
getTask(name)->setEnabled(true);
|
getTask(name)->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean TaskSchedulerManager::enableTask(uint16_t id)
|
void TaskSchedulerManager::enableTask(uint16_t id)
|
||||||
{
|
{
|
||||||
getTask(id)->setEnabled(true);
|
getTask(id)->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean TaskSchedulerManager::disableTask(const char *name)
|
void TaskSchedulerManager::disableTask(const char *name)
|
||||||
{
|
{
|
||||||
getTask(name)->setEnabled(false);
|
getTask(name)->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean TaskSchedulerManager::disableTask(uint16_t id)
|
void TaskSchedulerManager::disableTask(uint16_t id)
|
||||||
{
|
{
|
||||||
getTask(id)->setEnabled(false);
|
getTask(id)->setEnabled(false);
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ TaskSchedulerManagerHelper::Schedule *TaskSchedulerManager::getTask(uint16_t id)
|
|||||||
return &(_taskDataDictio(indiceToStr)->schedule);
|
return &(_taskDataDictio(indiceToStr)->schedule);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean TaskSchedulerManager::clearTask()
|
void TaskSchedulerManager::clearTask()
|
||||||
{
|
{
|
||||||
_taskDataDictio.clear();
|
_taskDataDictio.clear();
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ void TaskSchedulerManager::run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned int TaskSchedulerManager::taskCount()
|
unsigned int TaskSchedulerManager::taskCount()
|
||||||
{
|
{
|
||||||
return _taskDataDictio.count();
|
return _taskDataDictio.count();
|
||||||
}
|
}
|
||||||
|
@ -67,15 +67,15 @@ class TaskSchedulerManager
|
|||||||
boolean addTask(uint16_t id, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData = NULL);
|
boolean addTask(uint16_t id, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData = NULL);
|
||||||
boolean removeTask(const char *name);
|
boolean removeTask(const char *name);
|
||||||
boolean removeTask(uint16_t id);
|
boolean removeTask(uint16_t id);
|
||||||
boolean enableTask(const char *name);
|
void enableTask(const char *name);
|
||||||
boolean enableTask(uint16_t id);
|
void enableTask(uint16_t id);
|
||||||
boolean disableTask(const char *name);
|
void disableTask(const char *name);
|
||||||
boolean disableTask(uint16_t id);
|
void disableTask(uint16_t id);
|
||||||
boolean clearTask();
|
void clearTask();
|
||||||
TaskSchedulerManagerHelper::Schedule *getTask(const char *name);
|
TaskSchedulerManagerHelper::Schedule *getTask(const char *name);
|
||||||
TaskSchedulerManagerHelper::Schedule *getTask(uint16_t id);
|
TaskSchedulerManagerHelper::Schedule *getTask(uint16_t id);
|
||||||
void run();
|
void run();
|
||||||
const unsigned int taskCount();
|
unsigned int taskCount();
|
||||||
uint16_t findFreeTaskId();
|
uint16_t findFreeTaskId();
|
||||||
protected:
|
protected:
|
||||||
TaskSchedulerManager();
|
TaskSchedulerManager();
|
||||||
|
@ -48,7 +48,7 @@ class WEBServer : public TCPServer<T>, public HttpConstants
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Helper function used for the webApi
|
//Helper function used for the webApi
|
||||||
static void injectApiHeader(char *header, const char *contentType, char *content)
|
static void injectApiHeader(char *header, const char *contentType, const char *content)
|
||||||
{
|
{
|
||||||
char *buffer = (char *)malloc(sizeof(char) * strlen(content) + 1);
|
char *buffer = (char *)malloc(sizeof(char) * strlen(content) + 1);
|
||||||
if(buffer != NULL)
|
if(buffer != NULL)
|
||||||
@ -72,7 +72,7 @@ class WEBServer : public TCPServer<T>, public HttpConstants
|
|||||||
|
|
||||||
virtual void greetClient(T *client)
|
virtual void greetClient(T *client)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void processClientData(T *client)
|
virtual void processClientData(T *client)
|
||||||
@ -706,7 +706,7 @@ class WEBServer : public TCPServer<T>, public HttpConstants
|
|||||||
|
|
||||||
static void injectHeaderLayout(char *header, const char *contentType, size_t size)
|
static void injectHeaderLayout(char *header, const char *contentType, size_t size)
|
||||||
{
|
{
|
||||||
sprintf(header,"HTTP/1.1 200 OK\r\nContent-Type: %s\r\nContent-Length: %lu\r\nCache-Control: max-age=31536000\r\n\r\n",contentType,size);
|
sprintf(header,"HTTP/1.1 200 OK\r\nContent-Type: %s\r\nContent-Length: %u\r\nCache-Control: max-age=31536000\r\n\r\n",contentType,size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *getFileExtension(char *name)
|
static char *getFileExtension(char *name)
|
||||||
|
@ -24,7 +24,7 @@ void WEBServerManager::clearApiRoutine()
|
|||||||
|
|
||||||
boolean WEBServerManager::removeApiRoutine(const char *uri)
|
boolean WEBServerManager::removeApiRoutine(const char *uri)
|
||||||
{
|
{
|
||||||
_apiDictionary.remove(uri);
|
return _apiDictionary.remove(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean WEBServerManager::runServer()
|
boolean WEBServerManager::runServer()
|
||||||
|
@ -19,6 +19,7 @@ boolean task_batt_sensing(void *pData)
|
|||||||
|
|
||||||
boolean task_esp_reset_restart(void * pData)
|
boolean task_esp_reset_restart(void * pData)
|
||||||
{
|
{
|
||||||
|
(void)pData;
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -88,6 +88,7 @@ boolean staInfo(Adafruit_SSD1306 &display, void *pData)
|
|||||||
|
|
||||||
boolean memInfo(Adafruit_SSD1306 &display, void *pData)
|
boolean memInfo(Adafruit_SSD1306 &display, void *pData)
|
||||||
{
|
{
|
||||||
|
(void)pData;
|
||||||
char dispBuffer[300];
|
char dispBuffer[300];
|
||||||
uint32_t freeMem;
|
uint32_t freeMem;
|
||||||
uint16_t biggestContigMemBlock;
|
uint16_t biggestContigMemBlock;
|
||||||
@ -103,6 +104,8 @@ boolean memInfo(Adafruit_SSD1306 &display, void *pData)
|
|||||||
|
|
||||||
boolean dummy(Adafruit_SSD1306 &display, void *pData)
|
boolean dummy(Adafruit_SSD1306 &display, void *pData)
|
||||||
{
|
{
|
||||||
|
(void)display;
|
||||||
|
(void)pData;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,8 +146,6 @@ boolean sysErrorInfo(Adafruit_SSD1306 &display, void *pData)
|
|||||||
{
|
{
|
||||||
SAB *p = (SAB *)pData;
|
SAB *p = (SAB *)pData;
|
||||||
|
|
||||||
char error_str[300];
|
|
||||||
|
|
||||||
display.print(FPSTR("Rst reason : ")); display.println(ESP.getResetReason());
|
display.print(FPSTR("Rst reason : ")); display.println(ESP.getResetReason());
|
||||||
display.print(FPSTR("RTC : "));display.println((p->getError() & SAB::RTC_BEGIN_ERR) != 0 ? "ERROR":"OK");
|
display.print(FPSTR("RTC : "));display.println((p->getError() & SAB::RTC_BEGIN_ERR) != 0 ? "ERROR":"OK");
|
||||||
display.print(FPSTR("DISPLAY : "));display.println((p->getError() & SAB::DISP_BEGIN_ERR) != 0 ? "ERROR":"OK");
|
display.print(FPSTR("DISPLAY : "));display.println((p->getError() & SAB::DISP_BEGIN_ERR) != 0 ? "ERROR":"OK");
|
||||||
|
Loading…
Reference in New Issue
Block a user