When I added a SD card reader to my printer, I found that the Arduino
1.0 Print class implicitly promotes literal character and Uint8_t
parameters to integers. What this means is that a call to
Serial.print('g') for example, prints the decimal value "71" instead
of the letter 'g'.
To prevent the integer promotion, you can explicitly cast the
parameter as a char.
Another (sub-optimal) way is to change a literal character to a string
(change 'g' to "g"). Sprinter already does this in several places.
SdFatUtil.h
- for (uint8_t c; (c = pgm_read_byte(str)); str++) Serial.print(c);
+ for (uint8_t c; (c = pgm_read_byte(str)); str++)
Serial.print(char(c));
SdFile.cpp
- for (int8_t i = 0; i < indent; i++) Serial.print(' ');
+ for (int8_t i = 0; i < indent; i++) Serial.print(char(' '));
- Serial.print(' ');
+ Serial.print(char(' '));
- Serial.print(' ');
+ Serial.print(char(' '));
- Serial.print('.');
+ Serial.print(char('.'));
- Serial.print(
dir.name[i]);
+ Serial.print(char(
dir.name[i]));
- Serial.print('/');
+ Serial.print(char('/'));
- Serial.print(' ');
+ Serial.print(char(' '));
- Serial.print('-');
+ Serial.print(char('-'));
- Serial.print('-');
+ Serial.print(char('-'));
- Serial.print(':');
+ Serial.print(char(':'));
- Serial.print(':');
+ Serial.print(char(':'));
> > is the new default file extension.- Hide quoted text -
>
> - Show quoted text -