Now using a non blocking delay object :)

This commit is contained in:
anschrammh 2022-04-04 21:41:35 +02:00
parent 4f265e4c79
commit 7e58804af9

View File

@ -1,3 +1,10 @@
/**
* Author : Anatole SCHRAMM-HENRY
* Created on : 24/02/2019
* Licence : MIT
*
* Dead simple object implementing a non blocking delay using the Arduino framework.
*/
#include "definition.h" #include "definition.h"
#include "SAB.h" #include "SAB.h"
#include "views.h" #include "views.h"
@ -6,13 +13,15 @@
#include "CFGDictionary.h" #include "CFGDictionary.h"
#include "CFGParameterValue.h" #include "CFGParameterValue.h"
#include "EventHandler.h" #include "EventHandler.h"
#include "NonBlockingDelay.h"
#define DEBUG #define DEBUG
SAB sab; SAB sab;
EventHandler evHan; EventHandler evHan;
EventHandler::Event evt; EventHandler::Event evt;
unsigned long currentMs = 0; NonBlockingDelay dataRefreshNBD(1000);
volatile boolean ioStateChange(false); volatile boolean ioStateChange(false);
View1Packet v1p = {sab.getRtcManager().getDateTime(), sab.getSdCardManager().getSize(GBYTE), sab.getPowerManager().getPowerInfo(),0, sab.getSoftVersion(), &sab}; View1Packet v1p = {sab.getRtcManager().getDateTime(), sab.getSdCardManager().getSize(GBYTE), sab.getPowerManager().getPowerInfo(),0, sab.getSoftVersion(), &sab};
ViewAPPacket vap = {sab.getConnectivityManager().softAPmacAddress(), sab.getConnectivityManager().softAPSSID(), sab.getConnectivityManager().softAPIP(), sab.getConnectivityManager().softAPgetStationNum(), sab.getConnectivityManager().isAPEnabled()}; ViewAPPacket vap = {sab.getConnectivityManager().softAPmacAddress(), sab.getConnectivityManager().softAPSSID(), sab.getConnectivityManager().softAPIP(), sab.getConnectivityManager().softAPgetStationNum(), sab.getConnectivityManager().isAPEnabled()};
@ -96,9 +105,8 @@ void setup()
void loop() void loop()
{ {
if(millis() - currentMs >= 1000 || ioStateChange) if(dataRefreshNBD || ioStateChange)
{ {
currentMs = millis();
v1p.dateTime = sab.getRtcManager().getDateTime(); v1p.dateTime = sab.getRtcManager().getDateTime();
v1p.nbViews = sab.getScreenManager().getViewCount(); v1p.nbViews = sab.getScreenManager().getViewCount();
vap.ipAddr = sab.getConnectivityManager().softAPIP(); vap.ipAddr = sab.getConnectivityManager().softAPIP();