From 709abf489a07e3367cd1b00e88087a03617cf72b Mon Sep 17 00:00:00 2001 From: Ercan Ersoy Date: Mon, 25 Jun 2018 21:07:22 +0300 Subject: [PATCH 1/4] Fix bug of FILES command Add outstring function, print filenames with outstring. --- TinyBasicPlus/TinyBasicPlus.ino | 36 ++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/TinyBasicPlus/TinyBasicPlus.ino b/TinyBasicPlus/TinyBasicPlus.ino index cc34578..a8aa590 100644 --- a/TinyBasicPlus/TinyBasicPlus.ino +++ b/TinyBasicPlus/TinyBasicPlus.ino @@ -148,7 +148,7 @@ char eliminateCompileErrors = 1; // fix to suppress arduino build errors // This enables LOAD, SAVE, FILES commands through the Arduino SD Library // it adds 9k of usage as well. -//#define ENABLE_FILEIO 1 +//#define ENABLE_FILEIO #undef ENABLE_FILEIO // this turns on "autorun". if there's FileIO, and a file "autorun.bas", @@ -167,7 +167,7 @@ char eliminateCompileErrors = 1; // fix to suppress arduino build errors // element on the specified pin. Wire the red/positive/piezo to the kPiezoPin, // and the black/negative/metal disc to ground. // it adds 1.5k of usage as well. -//#define ENABLE_TONES 1 +//#define ENABLE_TONES 0 #undef ENABLE_TONES #define kPiezoPin 5 @@ -2201,6 +2201,36 @@ static void outchar(unsigned char c) #endif } +/***********************************************************/ +static void outstring(unsigned char *c) +{ + if( inhibitOutput ) return; + +#ifdef ARDUINO + #ifdef ENABLE_FILEIO + if( outStream == kStreamFile ) { + // output to a file + fp.print( (char *) c ); + } + else + #endif + #ifdef ARDUINO + #ifdef ENABLE_EEPROM + if( outStream == kStreamEEProm ) { + for(int i = 0; i < strlen(c); i++) { + EEPROM.write( eepos++, c[i] ); + } + } + else + #endif /* ENABLE_EEPROM */ + #endif /* ARDUINO */ + Serial.print((char *)c); + +#else + putchar(c); +#endif +} + /***********************************************************/ /* SD Card helpers */ @@ -2250,7 +2280,7 @@ void cmd_Files( void ) // common header printmsgNoNL( indentmsg ); - printmsgNoNL( (const unsigned char *)entry.name() ); + outstring( (unsigned char *)entry.name() ); if( entry.isDirectory() ) { printmsgNoNL( slashmsg ); } From 0b16ef1d2b44a1fdd794d0e336c906e9da96bc05 Mon Sep 17 00:00:00 2001 From: Ercan Ersoy Date: Mon, 25 Jun 2018 21:11:03 +0300 Subject: [PATCH 2/4] Oops! Oops for two #deifne preprocessors. --- TinyBasicPlus/TinyBasicPlus.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TinyBasicPlus/TinyBasicPlus.ino b/TinyBasicPlus/TinyBasicPlus.ino index a8aa590..79ad51d 100644 --- a/TinyBasicPlus/TinyBasicPlus.ino +++ b/TinyBasicPlus/TinyBasicPlus.ino @@ -148,12 +148,12 @@ char eliminateCompileErrors = 1; // fix to suppress arduino build errors // This enables LOAD, SAVE, FILES commands through the Arduino SD Library // it adds 9k of usage as well. -//#define ENABLE_FILEIO +//#define ENABLE_FILEIO 1 #undef ENABLE_FILEIO // this turns on "autorun". if there's FileIO, and a file "autorun.bas", // then it will load it and run it when starting up -//#define ENABLE_AUTORUN 1 +//#define ENABLE_AUTORUN 0 #undef ENABLE_AUTORUN // and this is the file that gets run #define kAutorunFilename "autorun.bas" @@ -167,7 +167,7 @@ char eliminateCompileErrors = 1; // fix to suppress arduino build errors // element on the specified pin. Wire the red/positive/piezo to the kPiezoPin, // and the black/negative/metal disc to ground. // it adds 1.5k of usage as well. -//#define ENABLE_TONES 0 +//#define ENABLE_TONES 1 #undef ENABLE_TONES #define kPiezoPin 5 From e1233a29bdc7e97c2b7ec13dd6ec949777c8b48c Mon Sep 17 00:00:00 2001 From: Ercan Ersoy Date: Mon, 25 Jun 2018 21:12:53 +0300 Subject: [PATCH 3/4] Oops! Oops for ENABLE_AUTORUN. --- TinyBasicPlus/TinyBasicPlus.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TinyBasicPlus/TinyBasicPlus.ino b/TinyBasicPlus/TinyBasicPlus.ino index 79ad51d..8aa4a18 100644 --- a/TinyBasicPlus/TinyBasicPlus.ino +++ b/TinyBasicPlus/TinyBasicPlus.ino @@ -153,7 +153,7 @@ char eliminateCompileErrors = 1; // fix to suppress arduino build errors // this turns on "autorun". if there's FileIO, and a file "autorun.bas", // then it will load it and run it when starting up -//#define ENABLE_AUTORUN 0 +//#define ENABLE_AUTORUN 1 #undef ENABLE_AUTORUN // and this is the file that gets run #define kAutorunFilename "autorun.bas" From 396ad64a45a968e1efaf2849496e5e473c2fb174 Mon Sep 17 00:00:00 2001 From: Ercan Ersoy Date: Tue, 26 Jun 2018 06:26:57 +0300 Subject: [PATCH 4/4] Revert some changes Delete outstring function, FILES command use Serial.print(). --- TinyBasicPlus/TinyBasicPlus.ino | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/TinyBasicPlus/TinyBasicPlus.ino b/TinyBasicPlus/TinyBasicPlus.ino index 8aa4a18..bc1bc11 100644 --- a/TinyBasicPlus/TinyBasicPlus.ino +++ b/TinyBasicPlus/TinyBasicPlus.ino @@ -2201,36 +2201,6 @@ static void outchar(unsigned char c) #endif } -/***********************************************************/ -static void outstring(unsigned char *c) -{ - if( inhibitOutput ) return; - -#ifdef ARDUINO - #ifdef ENABLE_FILEIO - if( outStream == kStreamFile ) { - // output to a file - fp.print( (char *) c ); - } - else - #endif - #ifdef ARDUINO - #ifdef ENABLE_EEPROM - if( outStream == kStreamEEProm ) { - for(int i = 0; i < strlen(c); i++) { - EEPROM.write( eepos++, c[i] ); - } - } - else - #endif /* ENABLE_EEPROM */ - #endif /* ARDUINO */ - Serial.print((char *)c); - -#else - putchar(c); -#endif -} - /***********************************************************/ /* SD Card helpers */ @@ -2280,7 +2250,7 @@ void cmd_Files( void ) // common header printmsgNoNL( indentmsg ); - outstring( (unsigned char *)entry.name() ); + Serial.print( entry.name() ); if( entry.isDirectory() ) { printmsgNoNL( slashmsg ); }