mirror of
https://github.com/sanni/cartreader.git
synced 2024-12-25 20:41:52 +01:00
Fix wrong block address
This commit is contained in:
parent
3f0fc3b577
commit
025ca2461c
@ -1425,6 +1425,7 @@ void writeFlashE28FXXXJ3A() {
|
||||
}
|
||||
|
||||
uint32_t block_addr;
|
||||
uint32_t block_addr_mask = ~(sectorSize - 1);
|
||||
|
||||
// Fill sdBuffer
|
||||
for (uint32_t currByte = 0; currByte < fileSize; currByte += 512) {
|
||||
@ -1434,7 +1435,7 @@ void writeFlashE28FXXXJ3A() {
|
||||
if (currByte % 2048 == 0)
|
||||
PORTB ^= (1 << 4);
|
||||
|
||||
block_addr = currByte / sectorSize;
|
||||
block_addr = currByte & block_addr_mask;
|
||||
|
||||
for (uint32_t c = 0; c < 512; c += bufferSize) {
|
||||
// write to buffer start
|
||||
|
Loading…
Reference in New Issue
Block a user