Skip to content

Commit

Permalink
remove custom code to print 0 prefixes in sprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
smesgr9000 committed May 20, 2024
1 parent 4d00041 commit 1aaa90a
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions Cart_Reader/FLASH.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1779,10 +1779,7 @@ void printFlash(int numBytes) {

for (int currByte = 0; currByte < numBytes; currByte += 10) {
for (int c = 0; c < 10; c++) {
itoa(readByte_Flash(currByte + c), myBuffer, 16);
for (size_t i = 0; i < 2 - strlen(myBuffer); i++) {
print_Msg(F("0"));
}
sprintf(myBuffer, "%.2x", readByte_Flash(currByte + c));
// Now print the significant bits
print_Msg(myBuffer);
}
Expand Down Expand Up @@ -2067,17 +2064,11 @@ void printFlash16(int numBytes) {
byte right_byte = (currWord >> 8) & 0xFF;


sprintf(buf, "%x", left_byte);
for (size_t i = 0; i < 2 - strlen(buf); i++) {
print_Msg(F("0"));
}
sprintf(buf, "%.2x", left_byte);
// Now print the significant bits
print_Msg(buf);

sprintf(buf, "%x", right_byte);
for (size_t i = 0; i < 2 - strlen(buf); i++) {
print_Msg(F("0"));
}
sprintf(buf, "%.2x", right_byte);
// Now print the significant bits
print_Msg(buf);
}
Expand Down Expand Up @@ -2421,17 +2412,11 @@ void print_Eprom(int numBytes) {
byte right_byte = (currWord >> 8) & 0xFF;


sprintf(buf, "%x", left_byte);
for (size_t i = 0; i < 2 - strlen(buf); i++) {
print_Msg(F("0"));
}
sprintf(buf, "%.2x", left_byte);
// Now print the significant bits
print_Msg(buf);

sprintf(buf, "%x", right_byte);
for (size_t i = 0; i < 2 - strlen(buf); i++) {
print_Msg(F("0"));
}
sprintf(buf, "%.2x", right_byte);
// Now print the significant bits
print_Msg(buf);
}
Expand Down

0 comments on commit 1aaa90a

Please sign in to comment.