Skip to content

Commit

Permalink
Made a workaround by sending the exit/entering callbacks frames witho…
Browse files Browse the repository at this point in the history
…ut delay which prevents internet simple example hanging problem
  • Loading branch information
alieslam committed May 12, 2016
1 parent dfeda88 commit b43feb2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion OneSheeld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ OneSheeldClass::OneSheeldClass()
isAppConnectionCallBack = false;
isShieldFrameCallback = false;
isSerialDataCallback = false;
dontDelay = false;
}

//Library Starter
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -589,7 +593,9 @@ void OneSheeldClass::enteringACallback()
if(!isInACallback())
{
inACallback=true;
dontDelay = true;
sendShieldFrame(ONESHEELD_ID,0,CALLBACK_ENTERED,0);
dontDelay = false;
}
}

Expand All @@ -598,7 +604,9 @@ void OneSheeldClass::exitingACallback()
if(isInACallback())
{
inACallback=false;
dontDelay = true;
sendShieldFrame(ONESHEELD_ID,0,CALLBACK_EXITED,0);
dontDelay = false;
}
}

Expand Down
1 change: 1 addition & 0 deletions OneSheeld.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class OneSheeldClass
bool isAppConnectionCallBack;
bool isShieldFrameCallback;
bool isSerialDataCallback;
bool dontDelay;
static bool isFirstFrame;
bool framestart;
static bool inACallback;
Expand Down

0 comments on commit b43feb2

Please sign in to comment.