comparison 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
comparison
equal deleted inserted replaced
441:9a9e4908ce2e 461:b3f684cea9c0
581 RTC_DateTypeDef sdatestructure; 581 RTC_DateTypeDef sdatestructure;
582 RTC_TimeTypeDef stimestructure; 582 RTC_TimeTypeDef stimestructure;
583 #else 583 #else
584 uint8_t dummyForBootloader[256] = {0}; 584 uint8_t dummyForBootloader[256] = {0};
585 #endif 585 #endif
586
587 uint8_t count; 586 uint8_t count;
588 uint8_t aTxBuffer[128]; 587 uint8_t aTxBuffer[128];
589 uint8_t aRxBuffer[68]; 588 uint8_t aRxBuffer[68];
590 uint8_t answer; 589 uint8_t answer;
591 aTxBuffer[0] = type; 590 aTxBuffer[0] = type;
1180 case 0x66: 1179 case 0x66:
1181 logbook_getHeader(255 - aRxBuffer[0], &logbookHeader); 1180 logbook_getHeader(255 - aRxBuffer[0], &logbookHeader);
1182 plogbookHeaderOSTC3 = logbook_build_ostc3header(&logbookHeader); 1181 plogbookHeaderOSTC3 = logbook_build_ostc3header(&logbookHeader);
1183 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)plogbookHeaderOSTC3, 256,5000)!= HAL_OK) 1182 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)plogbookHeaderOSTC3, 256,5000)!= HAL_OK)
1184 return 0; 1183 return 0;
1185 ext_flash_open_read_sample(255 - aRxBuffer[0], &sampleTotalLength); 1184
1186 while(sampleTotalLength >= 128) 1185 if((logbookHeader.pBeginProfileData[0]==0) /* no sample information */
1187 { 1186 && (logbookHeader.pBeginProfileData[1]==0)
1188 ext_flash_read_next_sample_part(aTxBuffer,128); 1187 && (logbookHeader.pBeginProfileData[2]==0))
1189 sampleTotalLength -= 128; 1188 {
1190 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK) 1189 sampleTotalLength = logbook_fillDummySampleBuffer(&logbookHeader);
1191 return 0; 1190 while(sampleTotalLength >= 128)
1192 } 1191 {
1193 if(sampleTotalLength) 1192 logbook_readDummySamples(aTxBuffer,128);
1194 { 1193 sampleTotalLength -= 128;
1195 ext_flash_read_next_sample_part(aTxBuffer,sampleTotalLength); 1194 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK)
1196 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK) 1195 return 0;
1197 return 0; 1196 }
1198 } 1197 if(sampleTotalLength)
1199 aTxBuffer[count++] = prompt4D4C(receiveStartByteUart); 1198 {
1199 logbook_readDummySamples(aTxBuffer,sampleTotalLength);
1200 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK)
1201 return 0;
1202 }
1203
1204 }
1205 else
1206 {
1207 ext_flash_open_read_sample(255 - aRxBuffer[0], &sampleTotalLength);
1208 while(sampleTotalLength >= 128)
1209 {
1210 ext_flash_read_next_sample_part(aTxBuffer,128);
1211 sampleTotalLength -= 128;
1212 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 128,5000)!= HAL_OK)
1213 return 0;
1214 }
1215 if(sampleTotalLength)
1216 {
1217 ext_flash_read_next_sample_part(aTxBuffer,sampleTotalLength);
1218 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sampleTotalLength,5000)!= HAL_OK)
1219 return 0;
1220 }
1221 }
1222 aTxBuffer[count++] = prompt4D4C(receiveStartByteUart);
1200 break; 1223 break;
1201 1224
1202 // read min,default,max setting 1225 // read min,default,max setting
1203 case 0x70: 1226 case 0x70:
1204 count += readDataLimits__8and16BitValues_4and7BytesOutput(aRxBuffer[0],&aTxBuffer[count]); 1227 count += readDataLimits__8and16BitValues_4and7BytesOutput(aRxBuffer[0],&aTxBuffer[count]);