Mercurial > public > ostc4
comparison Discovery/Src/tComm.c @ 467:5387e684d797 Improve_Logtansfer
Cmd Get profile: transmit dummy profile if necessary
In previous version a invalid profile was identified by a deleted profile information in the header. This was now replaced by checking the modified OSTC header for usage of dummy profile data
author | ideenmodellierer |
---|---|
date | Tue, 14 Apr 2020 19:29:23 +0200 |
parents | 05c5c3d10902 |
children | 0ad0b26ec56b |
comparison
equal
deleted
inserted
replaced
466:538eb1c976e9 | 467:5387e684d797 |
---|---|
588 uint8_t count; | 588 uint8_t count; |
589 uint8_t aTxBuffer[128]; | 589 uint8_t aTxBuffer[128]; |
590 uint8_t aRxBuffer[68]; | 590 uint8_t aRxBuffer[68]; |
591 uint8_t answer; | 591 uint8_t answer; |
592 uint16_t index; | 592 uint16_t index; |
593 uint32_t header_profileLength, OSTC3_profileLength; | |
593 aTxBuffer[0] = type; | 594 aTxBuffer[0] = type; |
594 aTxBuffer[1] = prompt4D4C(receiveStartByteUart); | 595 aTxBuffer[1] = prompt4D4C(receiveStartByteUart); |
595 uint8_t tempHigh, tempLow; | 596 uint8_t tempHigh, tempLow; |
596 count = 0; | 597 count = 0; |
597 | 598 |
1229 logbook_getHeader(255 - aRxBuffer[0], &logbookHeader); | 1230 logbook_getHeader(255 - aRxBuffer[0], &logbookHeader); |
1230 plogbookHeaderOSTC3 = logbook_build_ostc3header(&logbookHeader); | 1231 plogbookHeaderOSTC3 = logbook_build_ostc3header(&logbookHeader); |
1231 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)plogbookHeaderOSTC3, 256,5000)!= HAL_OK) | 1232 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)plogbookHeaderOSTC3, 256,5000)!= HAL_OK) |
1232 return 0; | 1233 return 0; |
1233 | 1234 |
1234 if((logbookHeader.pBeginProfileData[0]==0) /* no sample information */ | 1235 OSTC3_profileLength = (plogbookHeaderOSTC3->profileLength[2] << 16) + (plogbookHeaderOSTC3->profileLength[1] << 8) |
1235 && (logbookHeader.pBeginProfileData[1]==0) | 1236 + plogbookHeaderOSTC3->profileLength[0] -3; |
1236 && (logbookHeader.pBeginProfileData[2]==0)) | 1237 header_profileLength = (logbookHeader.profileLength[2] << 16) + (logbookHeader.profileLength[1] << 8) + logbookHeader.profileLength[0]; |
1238 | |
1239 if(OSTC3_profileLength != header_profileLength) /* has headerdata been changed to dummy data? */ | |
1237 { | 1240 { |
1238 sampleTotalLength = logbook_fillDummySampleBuffer(&logbookHeader); | 1241 sampleTotalLength = logbook_fillDummySampleBuffer(&logbookHeader); |
1239 while(sampleTotalLength >= 128) | 1242 while(sampleTotalLength >= 128) |
1240 { | 1243 { |
1241 logbook_readDummySamples(aTxBuffer,128); | 1244 logbook_readDummySamples(aTxBuffer,128); |
1247 { | 1250 { |
1248 logbook_readDummySamples(aTxBuffer,sampleTotalLength); | 1251 logbook_readDummySamples(aTxBuffer,sampleTotalLength); |
1249 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK) | 1252 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK) |
1250 return 0; | 1253 return 0; |
1251 } | 1254 } |
1252 | |
1253 } | 1255 } |
1254 else | 1256 else |
1255 { | 1257 { |
1256 ext_flash_open_read_sample(255 - aRxBuffer[0], &sampleTotalLength); | 1258 ext_flash_open_read_sample(255 - aRxBuffer[0], &sampleTotalLength); |
1257 while(sampleTotalLength >= 128) | 1259 while(sampleTotalLength >= 128) |