# HG changeset patch # User ideenmodellierer # Date 1585084456 -3600 # Node ID 5e38b09d2c4542dced031163b644bec95e05631f # Parent 928a145686893356c680510652f6b3dee5fdb674 Transfer a dummy profile in case of missing sample information: Changed the transmission of the hearers and the profiles to provide a dummy profile which is generated based on information stored in the header file. diff -r 928a14568689 -r 5e38b09d2c45 Discovery/Src/tComm.c --- a/Discovery/Src/tComm.c Tue Mar 24 22:12:08 2020 +0100 +++ b/Discovery/Src/tComm.c Tue Mar 24 22:14:16 2020 +0100 @@ -1182,21 +1182,43 @@ 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 */ { - 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.diveTimeMinutes, logbookHeader.diveTimeSeconds, logbookHeader.maxDepth, logbookHeader.lastDecostop_m, logbookHeader.minTemp); + 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