Mercurial > public > ostc4
diff Discovery/Src/tComm.c @ 461:b3f684cea9c0
Merged in Ideenmodellierer/ostc4/minor_improvments (pull request #41)
Minor improvments
author | heinrichsweikamp <bitbucket@heinrichsweikamp.com> |
---|---|
date | Mon, 30 Mar 2020 13:16:11 +0000 |
parents | 5dd996ed8611 |
children | dddfe7917131 |
line wrap: on
line diff
--- a/Discovery/Src/tComm.c Sun Mar 01 10:06:45 2020 +0100 +++ b/Discovery/Src/tComm.c Mon Mar 30 13:16:11 2020 +0000 @@ -583,7 +583,6 @@ #else uint8_t dummyForBootloader[256] = {0}; #endif - uint8_t count; uint8_t aTxBuffer[128]; uint8_t aRxBuffer[68]; @@ -1182,21 +1181,45 @@ plogbookHeaderOSTC3 = logbook_build_ostc3header(&logbookHeader); if(HAL_UART_Transmit(&UartHandle, (uint8_t*)plogbookHeaderOSTC3, 256,5000)!= HAL_OK) return 0; - ext_flash_open_read_sample(255 - aRxBuffer[0], &sampleTotalLength); - while(sampleTotalLength >= 128) + + if((logbookHeader.pBeginProfileData[0]==0) /* no sample information */ + && (logbookHeader.pBeginProfileData[1]==0) + && (logbookHeader.pBeginProfileData[2]==0)) { - ext_flash_read_next_sample_part(aTxBuffer,128); - sampleTotalLength -= 128; - if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK) - return 0; + sampleTotalLength = logbook_fillDummySampleBuffer(&logbookHeader); + while(sampleTotalLength >= 128) + { + logbook_readDummySamples(aTxBuffer,128); + sampleTotalLength -= 128; + if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK) + return 0; + } + if(sampleTotalLength) + { + logbook_readDummySamples(aTxBuffer,sampleTotalLength); + if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK) + return 0; + } + } - if(sampleTotalLength) + else { - ext_flash_read_next_sample_part(aTxBuffer,sampleTotalLength); - if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK) - return 0; + ext_flash_open_read_sample(255 - aRxBuffer[0], &sampleTotalLength); + while(sampleTotalLength >= 128) + { + ext_flash_read_next_sample_part(aTxBuffer,128); + sampleTotalLength -= 128; + if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK) + return 0; + } + if(sampleTotalLength) + { + ext_flash_read_next_sample_part(aTxBuffer,sampleTotalLength); + if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK) + return 0; + } } - aTxBuffer[count++] = prompt4D4C(receiveStartByteUart); + aTxBuffer[count++] = prompt4D4C(receiveStartByteUart); break; // read min,default,max setting