comparison Discovery/Src/tComm.c @ 456:5e38b09d2c45 minor_improvments

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.
author ideenmodellierer
date Tue, 24 Mar 2020 22:14:16 +0100
parents f68f2c4d71c7
children 5dd996ed8611
comparison
equal deleted inserted replaced
455:928a14568689 456:5e38b09d2c45
1180 case 0x66: 1180 case 0x66:
1181 logbook_getHeader(255 - aRxBuffer[0], &logbookHeader); 1181 logbook_getHeader(255 - aRxBuffer[0], &logbookHeader);
1182 plogbookHeaderOSTC3 = logbook_build_ostc3header(&logbookHeader); 1182 plogbookHeaderOSTC3 = logbook_build_ostc3header(&logbookHeader);
1183 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)plogbookHeaderOSTC3, 256,5000)!= HAL_OK) 1183 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)plogbookHeaderOSTC3, 256,5000)!= HAL_OK)
1184 return 0; 1184 return 0;
1185 ext_flash_open_read_sample(255 - aRxBuffer[0], &sampleTotalLength); 1185
1186 while(sampleTotalLength >= 128) 1186 if(logbookHeader.pBeginProfileData[0]==0) /* no sample information */
1187 { 1187 {
1188 ext_flash_read_next_sample_part(aTxBuffer,128); 1188 sampleTotalLength = logbook_fillDummySampleBuffer(logbookHeader.diveTimeMinutes, logbookHeader.diveTimeSeconds, logbookHeader.maxDepth, logbookHeader.lastDecostop_m, logbookHeader.minTemp);
1189 sampleTotalLength -= 128; 1189 while(sampleTotalLength >= 128)
1190 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK) 1190 {
1191 return 0; 1191 logbook_readDummySamples(aTxBuffer,128);
1192 } 1192 sampleTotalLength -= 128;
1193 if(sampleTotalLength) 1193 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK)
1194 { 1194 return 0;
1195 ext_flash_read_next_sample_part(aTxBuffer,sampleTotalLength); 1195 }
1196 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK) 1196 if(sampleTotalLength)
1197 return 0; 1197 {
1198 } 1198 logbook_readDummySamples(aTxBuffer,sampleTotalLength);
1199 aTxBuffer[count++] = prompt4D4C(receiveStartByteUart); 1199 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK)
1200 return 0;
1201 }
1202
1203 }
1204 else
1205 {
1206 ext_flash_open_read_sample(255 - aRxBuffer[0], &sampleTotalLength);
1207 while(sampleTotalLength >= 128)
1208 {
1209 ext_flash_read_next_sample_part(aTxBuffer,128);
1210 sampleTotalLength -= 128;
1211 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK)
1212 return 0;
1213 }
1214 if(sampleTotalLength)
1215 {
1216 ext_flash_read_next_sample_part(aTxBuffer,sampleTotalLength);
1217 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK)
1218 return 0;
1219 }
1220 }
1221 aTxBuffer[count++] = prompt4D4C(receiveStartByteUart);
1200 break; 1222 break;
1201 1223
1202 // read min,default,max setting 1224 // read min,default,max setting
1203 case 0x70: 1225 case 0x70:
1204 count += readDataLimits__8and16BitValues_4and7BytesOutput(aRxBuffer[0],&aTxBuffer[count]); 1226 count += readDataLimits__8and16BitValues_4and7BytesOutput(aRxBuffer[0],&aTxBuffer[count]);