W433DataReciver robustness changes
This commit is contained in:
@ -64,8 +64,12 @@ bool W433DataReciver::reciveSync(const uint16_t elapsedTime)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(syncCount > 5) error(ERR_SYNC_FAIL);
|
||||
syncCount = 0;
|
||||
if(syncCount > 4 && syncFailCount < 3) ++syncFailCount;
|
||||
else
|
||||
{
|
||||
syncCount = 0;
|
||||
syncFailCount = 0;
|
||||
}
|
||||
}
|
||||
if(syncCount > 10) return true;
|
||||
else return false;
|
||||
@ -105,6 +109,8 @@ void W433DataReciver::setState(const uint8_t stateIn)
|
||||
state = stateIn;
|
||||
timesBufferIndex = 0;
|
||||
packetIndex = 0;
|
||||
syncCount = 0;
|
||||
syncFailCount = 0;
|
||||
}
|
||||
|
||||
void W433DataReciver::interrupt()
|
||||
@ -130,9 +136,9 @@ void W433DataReciver::interrupt()
|
||||
}
|
||||
else if(state == LOOKING_FOR_SYNC_END)
|
||||
{
|
||||
if(elapsedTime > SYNC_TIME + 50)
|
||||
if(elapsedTime > SYNC_TIME + SYNC_TIME_TOLERANCE)
|
||||
{
|
||||
if(elapsedTime < LARGE_TIME + 50)
|
||||
if(elapsedTime < LARGE_TIME - LARGE_TIME_TOLERANCE)
|
||||
{
|
||||
setState(LOOKING_FOR_SYNC);
|
||||
error(ERR_NO_SYNC_END);
|
||||
|
Reference in New Issue
Block a user