dns_sd/fader.cpp : Check for the protocol state before sending heart beat in fader::tick()

This commit is contained in:
kpl 2020-03-04 14:08:41 -05:00
parent e0c69bfd25
commit 20f1008665

View File

@ -53,6 +53,8 @@ fader::rc_t fader::receive( const void* buf, unsigned bufByteN )
const uint8_t* b = (const uint8_t*)buf; // current msg ptr const uint8_t* b = (const uint8_t*)buf; // current msg ptr
const uint8_t* bend = b + bufByteN; // end of buffer ptr const uint8_t* bend = b + bufByteN; // end of buffer ptr
printf("RECV:%i\n",bufByteN);
while(b<bend) while(b<bend)
{ {
// if this is the start of a new msg // if this is the start of a new msg
@ -146,6 +148,7 @@ fader::rc_t fader::tick()
if( _tickN == _ticksPerHeartBeat ) if( _tickN == _ticksPerHeartBeat )
{ {
_tickN = 0; _tickN = 0;
if( _protoState == kWaitForHeartBeat_Id )
_send_heartbeat(); _send_heartbeat();
} }