diff Discovery/Src/externLogbookFlash.c @ 459:7ac0e76dbd6a minor_improvments

Activated reset of sample information within header data at time of sector erasing: After sample information have been erased the header are pointing to empty storage locations. To redefine the headers the sample addresses will be set to zero incating that no data is available. In that case the dummy functionality implemented by the last commits will be applied
author ideenmodellierer
date Sun, 29 Mar 2020 21:39:57 +0200
parents b90ddf57f7f1
children 2effe85f1a9b
line wrap: on
line diff
--- a/Discovery/Src/externLogbookFlash.c	Sat Mar 28 21:41:47 2020 +0100
+++ b/Discovery/Src/externLogbookFlash.c	Sun Mar 29 21:39:57 2020 +0200
@@ -787,6 +787,7 @@
 				actualAddress = SAMPLESTART;
 			}
 			preparedPageAddress = actualAddress;
+			ext_flash_invalidate_sample_index(preparedPageAddress);
 			ext_flash_erase64kB();
 			actualAddress = actualAdressBackup;
 		}
@@ -1795,7 +1796,12 @@
 		actualAddress = ringStart;
 
 	if(do_not_erase == 0)
-		ext_flash_erase_if_on_page_start();
+	{
+		if((ext_flash_erase_if_on_page_start()) && (type == EF_SAMPLE))		/* invalidate header sample information if needed */
+		{
+			ext_flash_invalidate_sample_index(actualAddress);
+		}
+	}
 	
 	while( i<length)
 	{
@@ -2316,22 +2322,10 @@
 				  actualPointerHeader = actualAddress;
 				  ef_write_block(emptySamples,9,EF_HEADER,1);			/* clear start, stop and length data */
 				  actualPointerHeader = HeaderAddrBackup;
-			  }
-#if 0
-			  else														/* no sample part within erased sector => stop search */
-			  {
-				  break;
-			  }
-#endif
-		  }
-#if 0
-		  else															/* ID not in use => stop search */
-		  {
-			  break;
-		  }
-#endif
-		  diveidx++;
-	  }
+			}
+	   }
+	   diveidx++;
+	}
 }