DSM RX: end bind and increased retry

This commit is contained in:
Pascal Langer
2020-06-18 10:53:03 +02:00
parent 2aa96dd129
commit c95e576ef3
4 changed files with 34 additions and 16 deletions

View File

@@ -215,15 +215,20 @@ uint16_t DSM_Rx_callback()
switch (phase)
{
case DSM_RX_BIND1:
if(IS_BIND_DONE) // Abort bind
{
phase = DSM_RX_DATA_PREP;
break;
}
if(packet_count==0)
read_retry=0;
//Check received data
rx_status = CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
if((rx_status & 0x03) == 0x02) // RXC=1, RXE=0 then 2nd check is required (debouncing)
if((rx_status & 0x03) == 0x02) // RXC=1, RXE=0 then 2nd check is required (debouncing)
rx_status |= CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
if((rx_status & 0x07) == 0x02)
{ // data received with no errors
CYRF_WriteRegister(CYRF_07_RX_IRQ_STATUS, 0x80); // Need to set RXOW before data read
CYRF_WriteRegister(CYRF_07_RX_IRQ_STATUS, 0x80); // Need to set RXOW before data read
len=CYRF_ReadRegister(CYRF_09_RX_COUNT);
debugln("RX:%d, CH:%d",len,hopping_frequency_no);
if(len==16)
@@ -284,7 +289,7 @@ uint16_t DSM_Rx_callback()
}
DSM_abort_channel_rx(0); // Abort RX operation and receive
if(read_retry==0)
read_retry=4;
read_retry=8;
}
else
if(rx_status & 0x02) // RX error