Skip to content

Commit

Permalink
Update FLASH.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
sanni committed Aug 9, 2024
1 parent 3c04277 commit c96c27c
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions Cart_Reader/FLASH.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2868,8 +2868,11 @@ void adjustFileSizeOffset(byte currChip, byte totalChips, boolean reversed) {
// 2*2MB or 2*4MB
else if ((currChip == 1) && (totalChips == 2)) {
if (reversed) {
fileSize = fileSize - flashSize / 2;
myFile.seekSet(4194304);
if (fileSize > 4194304) {
fileSize = fileSize - flashSize / 2;
myFile.seekSet(4194304);
} else
fileSize = 0;
} else if (fileSize > flashSize / 2)
fileSize = flashSize / 2;

Expand All @@ -2885,9 +2888,13 @@ void adjustFileSizeOffset(byte currChip, byte totalChips, boolean reversed) {

// 4*2MB
else if ((currChip == 1) && (totalChips == 4)) {
if (reversed)
myFile.seekSet(4194304);
if (fileSize > 2097152)
if (reversed) {
if (fileSize > 4194304) {
myFile.seekSet(4194304);
fileSize = 2097152;
} else
fileSize = 0;
} else if (fileSize > 2097152)
fileSize = 2097152;

} else if ((currChip == 2) && (totalChips == 4)) {
Expand Down Expand Up @@ -2919,8 +2926,11 @@ void adjustFileSizeOffset(byte currChip, byte totalChips, boolean reversed) {

} else if ((currChip == 4) && (totalChips == 4)) {
if (reversed) {
myFile.seekSet(2097152);
fileSize = 2097152;
if (fileSize > 2097152) {
myFile.seekSet(2097152);
fileSize = 2097152;
} else
fileSize = 0;
} else {
if (fileSize > 6291456) {
myFile.seekSet(6291456);
Expand Down

0 comments on commit c96c27c

Please sign in to comment.