@ -242,7 +242,9 @@ class Communication : public CommQueue<> {
break ;
break ;
case States : : CHECK_PACKAGE :
case States : : CHECK_PACKAGE :
# if AHOY_HMS_DIAGNOSTICS
printFrameMap ( q , F ( " check " ) ) ;
printFrameMap ( q , F ( " check " ) ) ;
# endif
uint8_t framnr = 0 ;
uint8_t framnr = 0 ;
if ( 0 = = mMaxFrameId ) {
if ( 0 = = mMaxFrameId ) {
uint8_t i = 0 ;
uint8_t i = 0 ;
@ -297,7 +299,9 @@ class Communication : public CommQueue<> {
q - > setAttempt ( ) ;
q - > setAttempt ( ) ;
if ( * mSerialDebug ) {
if ( * mSerialDebug ) {
# if AHOY_HMS_DIAGNOSTICS
printFrameMap ( q , F ( " before retransmit " ) ) ;
printFrameMap ( q , F ( " before retransmit " ) ) ;
# endif
DPRINT_IVID ( DBG_WARN , q - > iv - > id ) ;
DPRINT_IVID ( DBG_WARN , q - > iv - > id ) ;
DBGPRINT ( F ( " frame " ) ) ;
DBGPRINT ( F ( " frame " ) ) ;
DBGPRINT ( String ( framnr ) ) ;
DBGPRINT ( String ( framnr ) ) ;
@ -422,6 +426,7 @@ class Communication : public CommQueue<> {
return ( ah : : crc8 ( buf , len - 1 ) = = buf [ len - 1 ] ) ;
return ( ah : : crc8 ( buf , len - 1 ) = = buf [ len - 1 ] ) ;
}
}
# if AHOY_HMS_DIAGNOSTICS
inline void printFrameMap ( QueueElement * q , const char * stage ) {
inline void printFrameMap ( QueueElement * q , const char * stage ) {
if ( ! * mSerialDebug )
if ( ! * mSerialDebug )
return ;
return ;
@ -457,6 +462,7 @@ class Communication : public CommQueue<> {
DBGPRINT ( F ( " retransmit= " ) ) ;
DBGPRINT ( F ( " retransmit= " ) ) ;
DBGPRINTLN ( mIsRetransmit ? F ( " yes " ) : F ( " no " ) ) ;
DBGPRINTLN ( mIsRetransmit ? F ( " yes " ) : F ( " no " ) ) ;
}
}
# endif
inline bool parseFrame ( QueueElement * q , packet_t * p ) {
inline bool parseFrame ( QueueElement * q , packet_t * p ) {
uint8_t * frameId = & p - > packet [ 9 ] ;
uint8_t * frameId = & p - > packet [ 9 ] ;
@ -485,6 +491,7 @@ class Communication : public CommQueue<> {
f - > len = p - > len - 11 ;
f - > len = p - > len - 11 ;
f - > rssi = p - > rssi ;
f - > rssi = p - > rssi ;
# if AHOY_HMS_DIAGNOSTICS
if ( * mSerialDebug ) {
if ( * mSerialDebug ) {
DPRINT_IVID ( DBG_INFO , q - > iv - > id ) ;
DPRINT_IVID ( DBG_INFO , q - > iv - > id ) ;
DBGPRINT ( F ( " stored frame " ) ) ;
DBGPRINT ( F ( " stored frame " ) ) ;
@ -497,6 +504,7 @@ class Communication : public CommQueue<> {
DBGPRINTLN ( String ( mMaxFrameId ) ) ;
DBGPRINTLN ( String ( mMaxFrameId ) ) ;
printFrameMap ( q , F ( " after RX " ) ) ;
printFrameMap ( q , F ( " after RX " ) ) ;
}
}
# endif
return true ;
return true ;
}
}
@ -664,6 +672,7 @@ class Communication : public CommQueue<> {
}
}
void sendRetransmit ( QueueElement * q , uint8_t i ) {
void sendRetransmit ( QueueElement * q , uint8_t i ) {
# if AHOY_HMS_DIAGNOSTICS
if ( * mSerialDebug ) {
if ( * mSerialDebug ) {
DPRINT_IVID ( DBG_INFO , q - > iv - > id ) ;
DPRINT_IVID ( DBG_INFO , q - > iv - > id ) ;
DBGPRINT ( F ( " send retransmit request: frame= " ) ) ;
DBGPRINT ( F ( " send retransmit request: frame= " ) ) ;
@ -671,6 +680,7 @@ class Communication : public CommQueue<> {
DBGPRINT ( F ( " cmd=0x " ) ) ;
DBGPRINT ( F ( " cmd=0x " ) ) ;
DBGHEXLN ( SINGLE_FRAME + i ) ;
DBGHEXLN ( SINGLE_FRAME + i ) ;
}
}
# endif
mFramesExpected = 1 ;
mFramesExpected = 1 ;
q - > iv - > radio - > setExpectedFrames ( mFramesExpected ) ;
q - > iv - > radio - > setExpectedFrames ( mFramesExpected ) ;
q - > iv - > radio - > sendCmdPacket ( q - > iv , TX_REQ_INFO , ( SINGLE_FRAME + i ) , true ) ;
q - > iv - > radio - > sendCmdPacket ( q - > iv , TX_REQ_INFO , ( SINGLE_FRAME + i ) , true ) ;