Fix verifyFlash()

This commit is contained in:
sanni 2024-06-27 10:55:54 +02:00
parent fefd959e84
commit ce4e26c686
2 changed files with 29 additions and 12 deletions

View File

@ -1793,17 +1793,26 @@ void blankcheck_Flash() {
}
void verifyFlash() {
verifyFlash(0, 0);
verifyFlash(0);
}
void verifyFlash(unsigned long verifyStart, unsigned long verifyEnd) {
void verifyFlash(byte romChips) {
if (openVerifyFlashFile()) {
blank = 0;
if (verifyStart != 0)
myFile.seekCur(verifyStart);
if (verifyEnd != 0)
fileSize = verifyEnd;
if (romChips == 1) {
myFile.seekCur(0);
// Truncate file to size of 1st flash chip
if (fileSize > flashSize / 2) {
fileSize = flashSize / 2;
}
} else if (romChips == 2) {
if (fileSize > flashSize / 2) {
myFile.seekCur(flashSize / 2);
fileSize = fileSize - (flashSize / 2);
} else
fileSize = 0;
}
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
//fill sdBuffer
@ -2608,17 +2617,25 @@ void writeCFI_Flash(byte romChips) {
// If we have two ROM chips only write half the ROM file here and skip to second half of file on second write
if (romChips == 0) {
println_Msg(F(""));
} else if (romChips == 1) {
}
else if (romChips == 1) {
println_Msg(F(" 1/2"));
myFile.seekCur(0);
// Truncate file to size of 1st flash chip
if (fileSize > flashSize / 2) {
fileSize = flashSize / 2;
}
} else if (romChips == 2) {
}
else if (romChips == 2) {
println_Msg(F(" 2/2"));
if (fileSize > flashSize / 2) {
myFile.seekCur(flashSize / 2);
fileSize = fileSize - flashSize / 2;
fileSize = fileSize - (flashSize / 2);
} else {
fileSize = 0;
}
}
display_Update();

View File

@ -107,7 +107,7 @@ void reproCFIMenu() {
flashSize = 4194304;
// Write first rom chip
writeCFI_Flash(1);
verifyFlash(0, 2097152);
verifyFlash(1);
delay(300);
// Switch to second ROM chip, see flash.ino low level functions line 811
@ -121,7 +121,7 @@ void reproCFIMenu() {
// Write second rom chip
display_Clear();
writeCFI_Flash(2);
verifyFlash(2097152, 2097152);
verifyFlash(2);
break;
case 2: