aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorsanni <[email protected]>2024-06-30 11:36:33 +0200
committersanni <[email protected]>2024-06-30 11:36:33 +0200
commitfd2c332ea9a2249795786766d216199b5b4f235e (patch)
tree662ca77e15f8b1ab88d732742db5fb317faa7d71
parentf798336aaa0648bac0af8beb49d43af4e094c53d (diff)
downloadcartreader-fd2c332ea9a2249795786766d216199b5b4f235e.tar.gz
cartreader-fd2c332ea9a2249795786766d216199b5b4f235e.zip
Add progressbar to flashrom programmer
Only tested with 29F032 and 29LV640 but should still work for all since it was just copy&paste.
-rw-r--r--Cart_Reader/Cart_Reader.ino4
-rw-r--r--Cart_Reader/FLASH.ino65
-rw-r--r--Cart_Reader/OSCR.cpp2
3 files changed, 68 insertions, 3 deletions
diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino
index 2d7d7ad..e614618 100644
--- a/Cart_Reader/Cart_Reader.ino
+++ b/Cart_Reader/Cart_Reader.ino
@@ -4,8 +4,8 @@
This project represents a community-driven effort to provide
an easy to build and easy to modify cartridge dumper.
- Date: 2024-06-26
- Version: 13.3
+ Date: 2024-06-30
+ Version: 13.4
SD lib: https://github.com/greiman/SdFat
LCD lib: https://github.com/olikraus/u8g2
diff --git a/Cart_Reader/FLASH.ino b/Cart_Reader/FLASH.ino
index a983469..48568df 100644
--- a/Cart_Reader/FLASH.ino
+++ b/Cart_Reader/FLASH.ino
@@ -1266,6 +1266,12 @@ void writeFlash29F032() {
// Retry writing, for when /RESET is not connected (floating)
int dq5failcnt = 0;
int noread = 0;
+
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
// Fill sdBuffer
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
// if (currByte >= 0) {
@@ -1314,6 +1320,9 @@ void writeFlash29F032() {
} else {
noread = 0;
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Set data pins to input again
dataIn8();
@@ -1384,6 +1393,11 @@ void writeFlash29F1610() {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
for (unsigned long currByte = 0; currByte < fileSize; currByte += 128) {
// Fill sdBuffer with 1 page at a time then write it repeat until all bytes are written
myFile.read(sdBuffer, 128);
@@ -1403,6 +1417,9 @@ void writeFlash29F1610() {
for (byte c = 0; c < 128; c++) {
writeByte_Flash(currByte + c, sdBuffer[c]);
}
+ // update progress bar
+ processedProgressBar += 128;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Check if write is complete
@@ -1422,6 +1439,11 @@ void writeFlash29F1601() {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
for (unsigned long currByte = 0; currByte < fileSize; currByte += 128) {
// Fill sdBuffer with 1 page at a time then write it repeat until all bytes are written
myFile.read(sdBuffer, 128);
@@ -1446,6 +1468,9 @@ void writeFlash29F1601() {
writeByte_Flash(currByte + c, sdBuffer[c]);
}
}
+ // update progress bar
+ processedProgressBar += 128;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Check if write is complete
@@ -1542,6 +1567,11 @@ void writeFlash29LV640() {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
// Fill sdBuffer
myFile.read(sdBuffer, 512);
@@ -1558,6 +1588,9 @@ void writeFlash29LV640() {
// Check if write is complete
busyCheck29LV640(currByte + c, sdBuffer[c]);
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Set data pins to input again
dataIn8();
@@ -1574,6 +1607,11 @@ void writeFlash29GL(unsigned long sectorSize, byte bufferSize) {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
for (unsigned long currSector = 0; currSector < fileSize; currSector += sectorSize) {
// Blink led
blinkLED();
@@ -1610,6 +1648,9 @@ void writeFlash29GL(unsigned long sectorSize, byte bufferSize) {
dataOut();
}
}
+ // update progress bar
+ processedProgressBar += sectorSize;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Set data pins to input again
dataIn8();
@@ -1626,6 +1667,11 @@ void writeFlash29F800() {
// Set data pins to output
dataOut();
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
// Fill sdBuffer
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
myFile.read(sdBuffer, 512);
@@ -1640,6 +1686,9 @@ void writeFlash29F800() {
writeByte_Flash(currByte + c, sdBuffer[c]);
busyCheck29F032(currByte + c, sdBuffer[c]);
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
// Set data pins to input again
@@ -1713,6 +1762,11 @@ void writeFlashE28FXXXJ3A() {
uint32_t block_addr;
uint32_t block_addr_mask = ~(sectorSize - 1);
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
// Fill sdBuffer
for (uint32_t currByte = 0; currByte < fileSize; currByte += 512) {
myFile.read(sdBuffer, 512);
@@ -1749,6 +1803,9 @@ void writeFlashE28FXXXJ3A() {
while ((readByte_Flash(block_addr) & 0x80) == 0x00)
;
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
dataIn8();
@@ -1756,6 +1813,11 @@ void writeFlashE28FXXXJ3A() {
void writeFlashLH28F0XX() {
+ //Initialize progress bar
+ uint32_t processedProgressBar = 0;
+ uint32_t totalProgressBar = (uint32_t)fileSize;
+ draw_progressbar(0, totalProgressBar);
+
// Fill sdBuffer
for (uint32_t currByte = 0; currByte < fileSize; currByte += 512) {
myFile.read(sdBuffer, 512);
@@ -1783,6 +1845,9 @@ void writeFlashLH28F0XX() {
while ((readByte_Flash(currByte + c) & 0x80) == 0x00)
;
}
+ // update progress bar
+ processedProgressBar += 512;
+ draw_progressbar(processedProgressBar, totalProgressBar);
}
dataIn8();
diff --git a/Cart_Reader/OSCR.cpp b/Cart_Reader/OSCR.cpp
index 8bfc882..bb697d2 100644
--- a/Cart_Reader/OSCR.cpp
+++ b/Cart_Reader/OSCR.cpp
@@ -49,7 +49,7 @@
* String Constants
**/
// Firmware Version
-constexpr char PROGMEM FSTRING_VERSION[] = "V13.3";
+constexpr char PROGMEM FSTRING_VERSION[] = "V13.4";
// Universal
constexpr char PROGMEM FSTRING_RESET[] = "Reset";