BleuLlama / TinyBasicPlus

A C implementation of Tiny Basic, with a focus on support for Arduino
406 stars 118 forks source link

certain things cause it to send gibberish to the serial terminal #7

Open baconwaifu opened 10 years ago

baconwaifu commented 10 years ago

files returns gibberish for the filenames, even 8.3 short filenames and sometimes the thing just starts spitting out gibberish to the terminal, try loading a file from SD card to see what I mean (just imagine seeing HHHHHHH repeating indefinitely until you hit the reset button on the card)

AndreNeedham commented 8 years ago

The gibberish is because the function to output a string was changed to assume the string was in PROGMEM (program memory) but the filename strings coming off the SD card aren't PROGMEM. I fixed the issue for myself by making a version of printmsgNoNL that just outputs a string normally instead of doing pgm_read_byte. Something like:

void printFileNameNoNL(const unsigned char msg) { while( msg != 0 ) { outchar( *msg ); msg++; }; }

Then change the one line (2118?) in cmd_Files from: printmsgNoNL( (const unsigned char )entry.name() ); to: printFileNameNoNL( (const unsigned char )entry.name() );

I didn't see any other instance where a string was being printed that wasn't from PROGMEM.