diff OtherSources/data_central_mini.c @ 1048:493a5903ec20 GasConsumption

Merge with 9d9d506a82d3162b6b2323819cc08652887d7dd4 (Bootloader)
author Ideenmodellierer
date Sat, 15 Nov 2025 19:29:44 +0100
parents 7801c5d8a562
children
line wrap: on
line diff
--- a/OtherSources/data_central_mini.c	Sat Nov 15 15:16:14 2025 +0100
+++ b/OtherSources/data_central_mini.c	Sat Nov 15 19:29:44 2025 +0100
@@ -111,10 +111,12 @@
 
 uint32_t	CRC_CalcBlockCRC_moreThan768000(uint32_t *buffer1, uint32_t *buffer2, uint32_t words)
 {
- cm_t        crc_model;
- uint32_t      word_to_do;
- uint8_t       byte_to_do;
- int         i;
+	 cm_t        crc_model;
+	 uint32_t      word_to_do;
+	 uint8_t       byte_to_do;
+	 int         i;
+
+	 uint32_t wordCnt = 0;
  
      // Values for the STM32F generator.
  
@@ -127,10 +129,10 @@
  
      cm_ini(&crc_model);
  
-     while (words--)
+     do
      {
          // The STM32F10x hardware does 32-bit words at a time!!!
-				if(words > (768000/4))
+				if(wordCnt >= (768000/4))
 					word_to_do = *buffer2++;
 				else
 					word_to_do = *buffer1++;
@@ -159,7 +161,8 @@
  
              cm_nxt(&crc_model, byte_to_do);
          }
-     }
+         wordCnt++;
+     } while (wordCnt != words);
  
      // Return the final result.