diff 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
line wrap: on
line diff
--- a/Discovery/Src/tComm.c	Tue Apr 14 19:27:04 2020 +0200
+++ b/Discovery/Src/tComm.c	Tue Apr 14 19:29:23 2020 +0200
@@ -590,6 +590,7 @@
     uint8_t aRxBuffer[68];
     uint8_t answer;
     uint16_t index;
+    uint32_t header_profileLength, OSTC3_profileLength;
     aTxBuffer[0] = type;
     aTxBuffer[1] = prompt4D4C(receiveStartByteUart);
     uint8_t tempHigh, tempLow;
@@ -1231,9 +1232,11 @@
         if(HAL_UART_Transmit(&UartHandle, (uint8_t*)plogbookHeaderOSTC3, 256,5000)!= HAL_OK)
             return 0;
 
-        if((logbookHeader.pBeginProfileData[0]==0)	/* no sample information */
-        	&& (logbookHeader.pBeginProfileData[1]==0)
-			&& (logbookHeader.pBeginProfileData[2]==0))
+        OSTC3_profileLength = (plogbookHeaderOSTC3->profileLength[2] << 16) + (plogbookHeaderOSTC3->profileLength[1] << 8)
+                								    + plogbookHeaderOSTC3->profileLength[0] -3;
+        header_profileLength = (logbookHeader.profileLength[2] << 16) + (logbookHeader.profileLength[1] << 8) + logbookHeader.profileLength[0];
+       
+        if(OSTC3_profileLength != header_profileLength)			/* has headerdata been changed to dummy data? */
         {
         	sampleTotalLength = logbook_fillDummySampleBuffer(&logbookHeader);
 			while(sampleTotalLength >= 128)
@@ -1249,7 +1252,6 @@
 				if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK)
 					return 0;
 			}
-
         }
         else
         {