Mercurial > public > ostc4
diff Discovery/Src/tHome.c @ 209:2de856965c55
Merged in Ideenmodellierer/ostc4/ImprovmentSPI (pull request #9)
ImprovmentSPI
author | heinrichsweikamp <bitbucket@heinrichsweikamp.com> |
---|---|
date | Sun, 24 Mar 2019 22:09:37 +0000 |
parents | 9fc06e1e0f66 |
children | b2a9e9b02df0 |
line wrap: on
line diff
--- a/Discovery/Src/tHome.c Fri Mar 22 08:15:30 2019 +0000 +++ b/Discovery/Src/tHome.c Sun Mar 24 22:09:37 2019 +0000 @@ -425,12 +425,15 @@ uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn) { + static uint8_t LastKnowRTEState = SPI_RX_STATE_INVALID; + if(!SPI_MIN_ERROR_SHOW) return 0; if(DataEX_lost_connection_count()>=SPI_MIN_ERROR_SHOW && SPI_SHOW_SYNC_STATS){ char text[64]; SDataExchangeSlaveToMaster* dataIn=get_dataInPointer(); + SDataReceiveFromMaster* pDataOut = dataOutGetPointer(); snprintf(text,32,"spi err:\002 %i/%i",DataEX_lost_connection_count(),get_num_SPI_CALLBACKS()); Gfx_write_label_var(ScreenToWriteOn, 100,300, 0,&FontT24,CLUT_ButtonSymbols,text); @@ -438,7 +441,18 @@ // snprintf(text,32,"header:\002%X%X%X%X",dataIn->header.checkCode[0],dataIn->header.checkCode[1],dataIn->header.checkCode[2],dataIn->header.checkCode[3]); // Gfx_write_label_var(ScreenToWriteOn, 350,550, 0,&FontT24,CLUT_ButtonSymbols,text); - snprintf(text,32,"footer:\002%X%X%X%X",dataIn->footer.checkCode[0],dataIn->footer.checkCode[1],dataIn->footer.checkCode[2],dataIn->footer.checkCode[3]); + //snprintf(text,32,"footer:\002%X%X%X%X",dataIn->footer.checkCode[0],dataIn->footer.checkCode[1],dataIn->footer.checkCode[2],dataIn->footer.checkCode[3]); + + /* data shifted => ignore received data */ + if((pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE] == SPI_RX_STATE_SHIFTED) || (pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE] == SPI_RX_STATE_OFFLINE)) + { + dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] = LastKnowRTEState; + } + else + { + LastKnowRTEState =dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE]; + } + snprintf(text,32,"RX State M|R:\002%X|%X",pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE], dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] ); Gfx_write_label_var(ScreenToWriteOn, 600,800, 0,&FontT24,CLUT_ButtonSymbols,text); }