Compare commits

..

No commits in common. "05f7794679efa7df63d815bbe16be43dd68e98cc" and "47f289f3fe77cef19fd0b5e1f8940506428e69fc" have entirely different histories.

30 changed files with 125 additions and 176 deletions

42
.vscode/tasks.json vendored
View File

@ -1,42 +0,0 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "arduino-cli compile -v --warnings all -b esp8266:esp8266:nodemcuv2:xtal=80,vt=flash,exception=disabled,stacksmash=enabled,ssl=basic,mmu=3232,non32xfer=fast,eesz=4M,led=2,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600 ((pwd).path + '/src/app')",
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": true
}
},
{
"label": "Flash",
"type": "shell",
"command": "arduino-cli upload -v -b esp8266:esp8266:nodemcuv2:xtal=80,vt=flash,exception=disabled,stacksmash=enabled,ssl=basic,mmu=3232,non32xfer=fast,eesz=4M,led=2,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600 ((pwd).path + '/src/app') -p COM27",
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": true
}
},
{
"label": "Build & Flash",
"type": "shell",
"group": "build",
"dependsOrder": "sequence",
"dependsOn":["Build", "Flash"]
}
]
}

View File

@ -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_miso(SPI_miso == DEFAULT_PIN ? GPIO_12_MISO : SPI_miso),
_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_IOExpanderAddress(I2C_IOExpanderAddress),
_I2C_RTCFlashAddress(_I2C_RTCFlashAddress),

View File

@ -22,7 +22,7 @@ class BoardConfig
const Pin SPI_mosi = GPIO_13_MOSI,
const Pin SPI_miso = GPIO_12_MISO,
const Pin SPI_clk = GPIO_14_CLK,
const uint32_t spiSpeed = 0//SPI_FULL_SPEED
const uint32_t spiSpeed = SPI_FULL_SPEED
);
Pin getI2C_sda() const;

View File

@ -142,8 +142,6 @@ void *CFGFileParser::parseFile()
parsedParameter = NULL;
return NULL;
break;
default:
break;
}
}
@ -196,8 +194,6 @@ boolean CFGFileParser::save(void *data)
_state = COMMENT_SECTION;
else if(readChar == '\n') _state = DONE;
break;
default:
break;
}
}
@ -208,7 +204,7 @@ boolean CFGFileParser::save(void *data)
}
//Let's write the settings
for(unsigned int i = 0; i < ref->count(); i++)
for(int i = 0; i < ref->count(); i++)
{
CFGParameterValue *cfgPV = ref->getAt(i);

View File

@ -27,8 +27,8 @@ public:
return strcmp(_value,"true") == 0 || strcmp(_value,"TRUE") == 0 ? true : false;
}
const char *getParameter() const{return _parameter == NULL ? "" : _parameter;}
bool isQuotedParameter()const{return _quotedParameter;}
bool isQuotedValue()const{return _quotedValue;}
const bool isQuotedParameter()const{return _quotedParameter;}
const bool isQuotedValue()const{return _quotedValue;}
virtual const char *toString()
{
return _value;

View File

@ -11,7 +11,7 @@ protected:
}
DictionaryInterface(const DictionaryInterface &Object)
{
(void)Object;
}
virtual ~DictionaryInterface(){}
virtual const char *toString() = 0;

View File

@ -1,6 +1,21 @@
#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)
{
}

View File

@ -23,22 +23,22 @@ class FTPClient : public TCPClient
void startTimeout();
void closeDataConnection();
char _ftpCommand[5] = {'\0'};
Dictionary<DictionaryHelper::StringEntity> *_cmdParameters = NULL;
boolean _loggedIn = false;
char *_username = NULL;
char *_currentDirectory = NULL;
char *_currentFile = NULL;
uint64_t _fileSentBytes = 0;
uint64_t _fileRecvBytes = 0;
boolean _waitingForDataConnection = false;
boolean _fileIsBeeingReceived = false;
uint64_t _actionTimeout = 0;
boolean _dataClientConnected = false;
char _ftpCommand[5];
Dictionary<DictionaryHelper::StringEntity> *_cmdParameters;
boolean _loggedIn;
char *_username;
char *_currentDirectory;
char *_currentFile;
uint64_t _fileSentBytes;
uint64_t _fileRecvBytes;
boolean _waitingForDataConnection;
boolean _fileIsBeeingReceived;
uint64_t _actionTimeout;
boolean _dataClientConnected;
FTPServer<FTPClient>::FTPClientState _ftpClientState = FTPServer<FTPClient>::FTPClientState::INIT;
FTPServer<FTPClient>::BinaryFlag _binaryFlag = FTPServer<FTPClient>::BinaryFlag::OFF;
FTPServer<FTPClient>::FTPClientDataTransfer _dataTransferPending = FTPServer<FTPClient>::FTPClientDataTransfer::NONE;
FTPServer<FTPClient>::FTPClientState _ftpClientState;
FTPServer<FTPClient>::BinaryFlag _binaryFlag;
FTPServer<FTPClient>::FTPClientDataTransfer _dataTransferPending;
WiFiClient _dataClient; //data socket
};

View File

@ -83,7 +83,7 @@ class FTPServer : public TCPServer<T>
client->_clientState = TCPClient::HANDLED;
}
IRAM_ATTR virtual void processClientData(T *client)
ICACHE_RAM_ATTR virtual void processClientData(T *client)
{
/*if (client->_waitingForDataConnection)
{
@ -263,8 +263,6 @@ class FTPServer : public TCPServer<T>
client->_fileRecvBytes = 0;
}
break;
default:
break;
}
#ifdef DEBUG_FTPS
@ -792,7 +790,7 @@ class FTPServer : public TCPServer<T>
}
//Here we write the received file to the sd card
IRAM_ATTR inline boolean writeToSdCard(T *client, FileTransferStatus *fts, boolean append = false)
ICACHE_RAM_ATTR inline boolean writeToSdCard(T *client, FileTransferStatus *fts, boolean append = false)
{
if (client->_currentFile != NULL)
{
@ -830,7 +828,7 @@ class FTPServer : public TCPServer<T>
}
//Here we send the fs tree to the ftp client
IRAM_ATTR inline boolean sendFSTree(T *client)
ICACHE_RAM_ATTR inline boolean sendFSTree(T *client)
{
if (client->_currentDirectory != NULL)
{
@ -888,7 +886,7 @@ class FTPServer : public TCPServer<T>
}
//The binary flag needs to be taken into consideration
IRAM_ATTR inline boolean sendFile(T *client, FileTransferStatus *fts)
ICACHE_RAM_ATTR inline boolean sendFile(T *client, FileTransferStatus *fts)
{
if (client->_currentFile != NULL)
{
@ -994,8 +992,6 @@ class FTPServer : public TCPServer<T>
case _550:
client->_client.printf_P(PSTR("550 Requested action not taken. %s\r\n"), msg);
break;
default:
client->_client.printf_P(PSTR("XXX Unhandled error code. %s\r\n"), msg);
}
}

View File

@ -178,6 +178,7 @@ public:
T* removeLastRef()
{
unsigned int position(0);
if(_head->_next == NULL) return NULL;
List *cursor = _head, *toRemove(NULL);
@ -210,7 +211,7 @@ public:
int contains(T *value)
{
unsigned int position(-1);
if(_head->_next == NULL) return 0;
if(_head->_next == NULL) return NULL;
List *cursor = _head;

View File

@ -48,7 +48,7 @@ void SAB::initCommonConfig()
initGPIO();
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
Serial.println();
delay(1000);
delay(200);
//We initialize the pins for the I2C communication
Wire.begin(_boardConfig.getI2C_sda(), _boardConfig.getI2C_scl());

View File

@ -50,14 +50,15 @@ class SAB
void initGPIO();
static time_t myTimeCallback();
void initCommonConfig();
const BoardConfig _boardConfig;
SDCardManager _sdCardManager;
Adafruit_SSD1306 _display;
ScreenManager _screenManager;
RTC_DS3231 _rtc;
RtcManager _rtcManager;
static RtcManager *_rtcManagerP;
SDCardManager _sdCardManager;
ConnectivityManager *_connectivityManager;
//WEBServerManager _webServerManager;
WEBServer<WEBClient> _webServer;
@ -67,6 +68,7 @@ class SAB
IOManager _ioManager;
TaskSchedulerManager _taskSchedulerManager;
PowerManager _powerManager;
DateTime _powerUpTime;
uint8_t _error;
};

View File

@ -5,35 +5,35 @@ SDCardManager::SDCardManager(const Pin csPin, uint32_t cfg) : _csPin(csPin), _sp
}
float SDCardManager::getSize(const SizeUnit sizeUnit)
double SDCardManager::getSize(const SizeUnit sizeUnit)
{
uint64_t numberOf512BytesChunks = blocksPerCluster() * totalClusters();//cardSize();
float result = 0;
double result = 0;
if(!isMounted()) return 0.0;
switch(sizeUnit)
{
case KBIT:
result = (float)numberOf512BytesChunks/2.0*8;
result = (double)numberOf512BytesChunks/2.0*8;
break;
case KBYTE:
result = (float)numberOf512BytesChunks/2.0;
result = (double)numberOf512BytesChunks/2.0;
break;
case MBIT:
result = (float)numberOf512BytesChunks/2.0/1024.0*8;
result = (double)numberOf512BytesChunks/2.0/1024.0*8;
break;
case MBYTE:
result = (float)numberOf512BytesChunks/2.0/1024.0;
result = (double)numberOf512BytesChunks/2.0/1024.0;
break;
case GBIT:
result = (float)numberOf512BytesChunks/2.0/1024.0/1024.0*8;
result = (double)numberOf512BytesChunks/2.0/1024.0/1024.0*8;
break;
case GBYTE:
result = (float)numberOf512BytesChunks/2.0/1024.0/1024.0;
result = (double)numberOf512BytesChunks/2.0/1024.0/1024.0;
break;
default:
result = (float)numberOf512BytesChunks/2.0/1024.0/1024.0;
result = (double)numberOf512BytesChunks/2.0/1024.0/1024.0;
}
return result;
}

View File

@ -11,7 +11,7 @@ class SDCardManager : public SDClass
friend class SAB;
public:
SDCardManager(const Pin csPin, uint32_t cfg);
float getSize(const SizeUnit sizeUnit = GBYTE);
double getSize(const SizeUnit sizeUnit = GBYTE);
boolean mountSD();
void unMountSD();
boolean isMounted();

View File

@ -18,7 +18,7 @@ ScreenManager::ScreenManager(Adafruit_SSD1306 &display, SDCardManager *sdCardMan
boolean ScreenManager::init()
{
return applyCfgFromSD();
applyCfgFromSD();
}
boolean ScreenManager::applyCfgFromSD()
@ -60,7 +60,7 @@ boolean ScreenManager::applyCfgFromSD()
else //Default value applied
{
setDefault();
return true;
return false;
}
}

View File

@ -21,8 +21,6 @@ class ScreenManager
struct viewLink *next, *previous;
} ViewLink, *ViewLinkedList;
ScreenManager(Adafruit_SSD1306 &display, SDCardManager *sdCardManager = NULL);
boolean addView(boolean (*viewLogicFunction)(Adafruit_SSD1306&, void*), void *pData, const unsigned char UID);
boolean removeView(const unsigned char UID);
boolean displayView(const uint8_t UID);
@ -54,6 +52,7 @@ class ScreenManager
void iterateThroughList();
protected:
ScreenManager(Adafruit_SSD1306 &display, SDCardManager *sdCardManager = NULL);
private:
void *createEmptyList();
boolean addNewLinkAtTheEnd(ViewLinkedList *viewLinkedList, ViewLink viewLink);

View File

@ -59,7 +59,7 @@ bool TCPClient::operator==(TCPClient& Object)
return this->_client == Object._client;
}
void TCPClient::closeConnection()
bool TCPClient::closeConnection()
{
_client.stop();
}

View File

@ -15,7 +15,7 @@ class TCPClient
TCPClient(const TCPClient &Object);
virtual ~TCPClient();
bool operator==(TCPClient& Object);
void closeConnection();
bool closeConnection();
protected:
enum ClientState {NEW, HANDLED, DISCARDED} _clientState;
enum Error {OK = 0, MALLOC_ERR = 1} _error;

View File

@ -13,7 +13,7 @@ template <typename T>
class TCPServer
{
public:
TCPServer(uint16_t port = 80, uint8_t maxClient = MAX_CLIENT, uint16_t clientDataBufferSize = 255) : _serverStarted(true), _maxClient(maxClient), _clientDataBufferSize(clientDataBufferSize), _wifiServer(port), _currentClient(NULL)
TCPServer(uint16_t port = 80, uint8_t maxClient = MAX_CLIENT, uint16_t clientDataBufferSize = 255) : _wifiServer(port), _serverStarted(true), _maxClient(maxClient), _clientDataBufferSize(clientDataBufferSize), _currentClient(NULL)
{
_wifiServer.begin();
}
@ -92,7 +92,7 @@ class TCPServer
if(wc && wc.connected())
{
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
//ClientContext.h class : ie if one of the provided parameters is 0, then TKA is disabled)
(clientPointer->_client).keepAlive(_TKAIdleSec, _TKAIntvSec, _TKACount);

View File

@ -159,22 +159,22 @@ boolean TaskSchedulerManager::removeTask(uint16_t id)
return _taskDataDictio.remove(id);
}
void TaskSchedulerManager::enableTask(const char *name)
boolean TaskSchedulerManager::enableTask(const char *name)
{
getTask(name)->setEnabled(true);
}
void TaskSchedulerManager::enableTask(uint16_t id)
boolean TaskSchedulerManager::enableTask(uint16_t id)
{
getTask(id)->setEnabled(true);
}
void TaskSchedulerManager::disableTask(const char *name)
boolean TaskSchedulerManager::disableTask(const char *name)
{
getTask(name)->setEnabled(false);
}
void TaskSchedulerManager::disableTask(uint16_t id)
boolean TaskSchedulerManager::disableTask(uint16_t id)
{
getTask(id)->setEnabled(false);
}
@ -191,7 +191,7 @@ TaskSchedulerManagerHelper::Schedule *TaskSchedulerManager::getTask(uint16_t id)
return &(_taskDataDictio(indiceToStr)->schedule);
}
void TaskSchedulerManager::clearTask()
boolean TaskSchedulerManager::clearTask()
{
_taskDataDictio.clear();
}
@ -239,7 +239,7 @@ void TaskSchedulerManager::run()
}
}
unsigned int TaskSchedulerManager::taskCount()
const unsigned int TaskSchedulerManager::taskCount()
{
return _taskDataDictio.count();
}

View File

@ -67,15 +67,15 @@ class TaskSchedulerManager
boolean addTask(uint16_t id, TaskSchedulerManagerHelper::Schedule *schedule, boolean (*taskRoutine)(void*), void *pData = NULL);
boolean removeTask(const char *name);
boolean removeTask(uint16_t id);
void enableTask(const char *name);
void enableTask(uint16_t id);
void disableTask(const char *name);
void disableTask(uint16_t id);
void clearTask();
boolean enableTask(const char *name);
boolean enableTask(uint16_t id);
boolean disableTask(const char *name);
boolean disableTask(uint16_t id);
boolean clearTask();
TaskSchedulerManagerHelper::Schedule *getTask(const char *name);
TaskSchedulerManagerHelper::Schedule *getTask(uint16_t id);
void run();
unsigned int taskCount();
const unsigned int taskCount();
uint16_t findFreeTaskId();
protected:
TaskSchedulerManager();

View File

@ -48,7 +48,7 @@ class WEBServer : public TCPServer<T>, public HttpConstants
}
//Helper function used for the webApi
static void injectApiHeader(char *header, const char *contentType, const char *content)
static void injectApiHeader(char *header, const char *contentType, char *content)
{
char *buffer = (char *)malloc(sizeof(char) * strlen(content) + 1);
if(buffer != NULL)
@ -72,7 +72,7 @@ class WEBServer : public TCPServer<T>, public HttpConstants
virtual void greetClient(T *client)
{
(void)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)
{
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);
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);
}
static char *getFileExtension(char *name)

View File

@ -24,7 +24,7 @@ void WEBServerManager::clearApiRoutine()
boolean WEBServerManager::removeApiRoutine(const char *uri)
{
return _apiDictionary.remove(uri);
_apiDictionary.remove(uri);
}
boolean WEBServerManager::runServer()

View File

@ -34,13 +34,11 @@ void setup()
Serial.print("AP PASSWORD : ");if((*cfgDictionary)("PASSWORD") != NULL)Serial.println((*cfgDictionary)("PASSWORD")->stringValue());
}
#if 0
CFGFileParser cfgFileParsert1(sab.getSdCardManager(), "/CONFIG/TEST1.CFG");
/*CFGFileParser cfgFileParsert1(sab.getSdCardManager(), "/CONFIG/TEST1.CFG");
CFGFileParser cfgFileParsert2(sab.getSdCardManager(), "/CONFIG/TEST2.CFG");
Serial.print("TEST1 : ");Serial.println(cfgFileParsert1.save(cfgDictionary));
Serial.print("TEST2 : ");Serial.println(cfgFileParsert2.save(cfgDictionary));
#endif
Serial.print("TEST2 : ");Serial.println(cfgFileParsert2.save(cfgDictionary));*/
delete cfgDictionary;
@ -134,8 +132,6 @@ void loop()
Serial.printf("Changing view\nSelected view is : %d\n",sab.getScreenManager().getCurrentViewUID());
#endif
break;
default: //NO_EVENT
break;
}
//Run the different services
@ -143,7 +139,7 @@ void loop()
evHan.run();
}
IRAM_ATTR void ioISR()
ICACHE_RAM_ATTR void ioISR()
{
ioStateChange = true;
}

View File

@ -19,7 +19,6 @@ boolean task_batt_sensing(void *pData)
boolean task_esp_reset_restart(void * pData)
{
(void)pData;
ESP.restart();
return true;

View File

@ -7,37 +7,36 @@
* Versioning scheme MAJOR.MINOR.PATCH
*/
//#define SOFT_VERSION "1.0.0" //First version tracking
//#define SOFT_VERSION "1.1.0" //Added trailing zeros to the date and time
//#define SOFT_VERSION "1.1.1" //Added delayed esp restart/reset api call
//#define SOFT_VERSION "1.1.2" //Fixed a big memory leak :( shame on me...
//#define SOFT_VERSION "1.1.3" //TaskSchedulerManager added millis rollover
//#define SOFT_VERSION "1.1.4" //Cleaned AP and STA wifi start
//#define SOFT_VERSION "1.2.0" //Added new PowerManager class
//#define SOFT_VERSION "1.2.1" //Corrected a bug in the TaskSchedulerManager class
//#define SOFT_VERSION "1.3.0" //Implemented multi-client non blocking webserver
//#define SOFT_VERSION "1.3.1" //Fixed sdCardUnmount api call
//#define SOFT_VERSION "1.3.2" //Modified TCPServer and WEBServer core logic
//#define SOFT_VERSION "1.4.0" //Added the new FTPServer
//#define SOFT_VERSION "1.4.1" //Updated FTP server to use the new SD library for the ESP8266
//#define SOFT_VERSION "1.4.2" //Added new functionalities to the FTP server as well as login check
//#define SOFT_VERSION "1.4.3" //Added ICACHE_RAM_ATTR because of a strange performance hit
//#define SOFT_VERSION "1.5.0" //Added new rtcInfo view + DS3231 internal temperature
//#define SOFT_VERSION "1.5.1" //Corrected a mistake in the sendPageToClientFromSdCard method (WEBServer class)
//#define SOFT_VERSION "1.5.2" //Started to put every string in the flash memory instead of the ram
//#define SOFT_VERSION "1.5.3" //Minor changes and fixes to the ConnectivityManager class
//#define SOFT_VERSION "1.5.4" //Updated TCPClient (using memmove instead of strcpy)
//#define SOFT_VERSION "1.5.5" //WEBServer now parsing form parameters in the post data section
//#define SOFT_VERSION "1.5.6" //Added new SAB method to set te cpu frequency at run time
//#define SOFT_VERSION "1.6.0" //Added the new HttpClient class along with tests in a new task
//#define SOFT_VERSION "1.6.1" //Reworked the ScreenManager in order to display previous views and did some code optimization
//#define SOFT_VERSION "1.6.2" //Added a run method to the screen manager and reworked the error system
//#define SOFT_VERSION "1.6.3" //Added a new api call to get nearby wifi access points
//#define SOFT_VERSION "1.6.4" //Added the forceRefresh() method to the ScreenManager Object
//#define SOFT_VERSION "1.6.5" //Removed the sd card mount and unmount api calls, replaced with the sdCardAction api call which takes a parameter (does the same thing)
//#define SOFT_VERSION "1.6.6" //Removed useless INIT state that was like the LINE_BREAK state and added '-' as an allowed PARAM and VALUE character
//#define SOFT_VERSION "1.6.7" //Changed the way we store and return the 3 letter month abbreviation
//#define SOFT_VERSION "1.6.8" //Finally fixed the random crash issue concerning the servers :)
#define SOFT_VERSION "1.6.9" //Updated the whole app the work with the esp8266 core 3.0.2 version, removed a bunch of warnings, corrected an array index overflow in apiTesterApi function
#define SOFT_VERSION "1.0.0" //First version tracking
#define SOFT_VERSION "1.1.0" //Added trailing zeros to the date and time
#define SOFT_VERSION "1.1.1" //Added delayed esp restart/reset api call
#define SOFT_VERSION "1.1.2" //Fixed a big memory leak :( shame on me...
#define SOFT_VERSION "1.1.3" //TaskSchedulerManager added millis rollover
#define SOFT_VERSION "1.1.4" //Cleaned AP and STA wifi start
#define SOFT_VERSION "1.2.0" //Added new PowerManager class
#define SOFT_VERSION "1.2.1" //Corrected a bug in the TaskSchedulerManager class
#define SOFT_VERSION "1.3.0" //Implemented multi-client non blocking webserver
#define SOFT_VERSION "1.3.1" //Fixed sdCardUnmount api call
#define SOFT_VERSION "1.3.2" //Modified TCPServer and WEBServer core logic
#define SOFT_VERSION "1.4.0" //Added the new FTPServer
#define SOFT_VERSION "1.4.1" //Updated FTP server to use the new SD library for the ESP8266
#define SOFT_VERSION "1.4.2" //Added new functionalities to the FTP server as well as login check
#define SOFT_VERSION "1.4.3" //Added ICACHE_RAM_ATTR because of a strange performance hit
#define SOFT_VERSION "1.5.0" //Added new rtcInfo view + DS3231 internal temperature
#define SOFT_VERSION "1.5.1" //Corrected a mistake in the sendPageToClientFromSdCard method (WEBServer class)
#define SOFT_VERSION "1.5.2" //Started to put every string in the flash memory instead of the ram
#define SOFT_VERSION "1.5.3" //Minor changes and fixes to the ConnectivityManager class
#define SOFT_VERSION "1.5.4" //Updated TCPClient (using memmove instead of strcpy)
#define SOFT_VERSION "1.5.5" //WEBServer now parsing form parameters in the post data section
#define SOFT_VERSION "1.5.6" //Added new SAB method to set te cpu frequency at run time
#define SOFT_VERSION "1.6.0" //Added the new HttpClient class along with tests in a new task
#define SOFT_VERSION "1.6.1" //Reworked the ScreenManager in order to display previous views and did some code optimization
#define SOFT_VERSION "1.6.2" //Added a run method to the screen manager and reworked the error system
#define SOFT_VERSION "1.6.3" //Added a new api call to get nearby wifi access points
#define SOFT_VERSION "1.6.4" //Added the forceRefresh() method to the ScreenManager Object
#define SOFT_VERSION "1.6.5" //Removed the sd card mount and unmount api calls, replaced with the sdCardAction api call which takes a parameter (does the same thing)
#define SOFT_VERSION "1.6.6" //Removed useless INIT state that was like the LINE_BREAK state and added '-' as an allowed PARAM and VALUE character
#define SOFT_VERSION "1.6.7" //Changed the way we store and return the 3 letter month abbreviation
#define SOFT_VERSION "1.6.8" //Finally fixed the random crash issue concerning the servers :)
#endif //VERSIONS_H

View File

@ -88,7 +88,6 @@ boolean staInfo(Adafruit_SSD1306 &display, void *pData)
boolean memInfo(Adafruit_SSD1306 &display, void *pData)
{
(void)pData;
char dispBuffer[300];
uint32_t freeMem;
uint16_t biggestContigMemBlock;
@ -104,8 +103,6 @@ boolean memInfo(Adafruit_SSD1306 &display, void *pData)
boolean dummy(Adafruit_SSD1306 &display, void *pData)
{
(void)display;
(void)pData;
return false;
}
@ -146,6 +143,8 @@ boolean sysErrorInfo(Adafruit_SSD1306 &display, void *pData)
{
SAB *p = (SAB *)pData;
char error_str[300];
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("DISPLAY : "));display.println((p->getError() & SAB::DISP_BEGIN_ERR) != 0 ? "ERROR":"OK");

View File

@ -4,9 +4,7 @@
boolean apiTesterApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient* wc, void* pData)
{
(void)HRD;
(void)pData;
char buffer[200];
char buffer[100];
WEBServer<WEBClient>::injectApiHeader(buffer, "application/json", "{\"status\":\"ok\",\"API\":\"available\"}");
wc->print(buffer);
@ -38,13 +36,12 @@ boolean viewByUIDApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc,
boolean nextViewApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
{
(void)HRD;
SAB *p = (SAB *)pData;
char buffer[200];
p->getScreenManager().displayNextView();
if(p->getScreenManager().getError() == ScreenManager::OK)
if(p->getScreenManager().getError() == OK)
sprintf(buffer, "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\"status\":\"ok\",\"ViewUID\":\"%d\"}", p->getScreenManager().getCurrentViewUID());
else
sprintf(buffer, "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\"status\":\"failed\",\"message\":\"%s\"}", p->getScreenManager().getErrorMessage());
@ -54,7 +51,6 @@ boolean nextViewApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc,
boolean reloadViewApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
{
(void)HRD;
SAB *p = (SAB *)pData;
char buffer[200];
@ -69,7 +65,6 @@ boolean reloadViewApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc
boolean rtcGetTimeApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
{
(void)HRD;
SAB *p = (SAB *)pData;
char buffer[200];
DateTime d = p->getRtcManager().getDateTime();
@ -200,7 +195,6 @@ boolean espResetApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc,
boolean sdCardSizeApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
{
(void)HRD;
SAB *p = (SAB *)pData;
char buffer[200];
double size = p->getSdCardManager().getSize(GBYTE);
@ -215,7 +209,6 @@ boolean sdCardSizeApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc
boolean staWifiInfoApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
{
(void)HRD;
SAB *p = (SAB *)pData;
char buffer[300];
IPAddress IP = p->getConnectivityManager().localIP();
@ -243,8 +236,6 @@ boolean staWifiInfoApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *w
boolean apScannerApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
{
(void)HRD;
(void)pData;
uint8_t number = WiFi.scanNetworks();
wc->print("HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n[");
@ -259,7 +250,6 @@ boolean apScannerApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc,
boolean systemInfoApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
{
(void)HRD;
SAB *p = (SAB *)pData;
char buffer[300];
uint32_t freeMem;
@ -277,7 +267,6 @@ boolean systemInfoApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc
boolean powerInfoApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
{
(void)HRD;
SAB *p = (SAB *)pData;
char buffer[300];
PowerManager::PowerInfo pi = p->getPowerManager().getPowerInfo();

View File

@ -90,7 +90,7 @@ void PCF8574::digitalReadAll(boolean array[8])
boolean PCF8574::getPinMode(Pin pin)
{
return (_pddr & pin) == 0 ? INPUT : OUTPUT;
return _pddr & pin == 0 ? INPUT : OUTPUT;
}
void PCF8574::getPinModeAll(boolean array[8])