From b43feb27cab63d3aa275e1d6cac801f15fafe101 Mon Sep 17 00:00:00 2001 From: Eslam Ali Date: Thu, 12 May 2016 16:23:37 +0200 Subject: [PATCH] Made a workaround by sending the exit/entering callbacks frames without delay which prevents internet simple example hanging problem --- OneSheeld.cpp | 10 +++++++++- OneSheeld.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/OneSheeld.cpp b/OneSheeld.cpp index 593ce56..ca8df13 100644 --- a/OneSheeld.cpp +++ b/OneSheeld.cpp @@ -50,6 +50,7 @@ OneSheeldClass::OneSheeldClass() isAppConnectionCallBack = false; isShieldFrameCallback = false; isSerialDataCallback = false; + dontDelay = false; } //Library Starter @@ -145,7 +146,10 @@ void OneSheeldClass::setOnNewSerialData(void (*userFunction)(byte)) void OneSheeldClass::oneSheeldWrite(byte data) { OneSheeldSerial->write(data); - delay(2); + if(!dontDelay) + { + delay(2); + } } //Frame Sender for Output Shields @@ -589,7 +593,9 @@ void OneSheeldClass::enteringACallback() if(!isInACallback()) { inACallback=true; + dontDelay = true; sendShieldFrame(ONESHEELD_ID,0,CALLBACK_ENTERED,0); + dontDelay = false; } } @@ -598,7 +604,9 @@ void OneSheeldClass::exitingACallback() if(isInACallback()) { inACallback=false; + dontDelay = true; sendShieldFrame(ONESHEELD_ID,0,CALLBACK_EXITED,0); + dontDelay = false; } } diff --git a/OneSheeld.h b/OneSheeld.h index c821df7..fc4015c 100644 --- a/OneSheeld.h +++ b/OneSheeld.h @@ -157,6 +157,7 @@ class OneSheeldClass bool isAppConnectionCallBack; bool isShieldFrameCallback; bool isSerialDataCallback; + bool dontDelay; static bool isFirstFrame; bool framestart; static bool inACallback;