diff options
author | sanni <[email protected]> | 2024-08-09 13:44:20 +0200 |
---|---|---|
committer | sanni <[email protected]> | 2024-08-09 13:44:20 +0200 |
commit | c96c27c52141e2c3c1d02ffeca95141012fd6e55 (patch) | |
tree | f87db19b5776737324d933fbc5c70ed49503fc34 /Cart_Reader | |
parent | 3c04277d98405509e745d7c8bb36452b66633e92 (diff) | |
download | cartreader-c96c27c52141e2c3c1d02ffeca95141012fd6e55.tar.gz cartreader-c96c27c52141e2c3c1d02ffeca95141012fd6e55.zip |
Update FLASH.ino
Diffstat (limited to 'Cart_Reader')
-rw-r--r-- | Cart_Reader/FLASH.ino | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Cart_Reader/FLASH.ino b/Cart_Reader/FLASH.ino index 08c0d27..81d90e8 100644 --- a/Cart_Reader/FLASH.ino +++ b/Cart_Reader/FLASH.ino @@ -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;
@@ -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)) {
@@ -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);
|