From ccf4f34e928afd88ee3dd34e8248ce04d48dad63 Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Mon, 26 Oct 2015 17:55:41 -0700 Subject: [PATCH 1/3] Write whole debug cli command to history Previously the command was being modified in place in order to find the command name. This was happening before saving to the history. Fixes #70 --- Debug/cli/cli.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Debug/cli/cli.c b/Debug/cli/cli.c index 149d12d..5c83ee6 100644 --- a/Debug/cli/cli.c +++ b/Debug/cli/cli.c @@ -159,15 +159,12 @@ void CLI_process() } else { - // Only do command-related stuff if there was actually a command - // Avoids clogging command history with blanks + // Add the command to the history + CLI_saveHistory( CLILineBuffer ); // Process the current line buffer CLI_commandLookup(); - // Add the command to the history - CLI_saveHistory( CLILineBuffer ); - // Keep the array circular, discarding the older entries if ( CLIHistoryTail < CLIHistoryHead ) CLIHistoryHead = ( CLIHistoryHead + 1 ) % CLIMaxHistorySize; @@ -425,6 +422,11 @@ inline void CLI_saveHistory( char *buff ) return; } + // Don't write empty lines to the history + const char *cursor = buff; + while (*cursor == ' ') { cursor++; } // advance past the leading whitespace + if (*cursor == '\0') { return ; } + // Copy the line to the history int i; for (i = 0; i < CLILineBufferCurrent; i++) From 11a44f0ea1964cd8f0ec9c99ad7b18460402cfc3 Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Sun, 1 Nov 2015 17:19:09 -0800 Subject: [PATCH 2/3] Adding comment about using Pillow instead of PIL --- Scan/STLcd/bitmap2Struct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scan/STLcd/bitmap2Struct.py b/Scan/STLcd/bitmap2Struct.py index dcf30c6..f0790a2 100755 --- a/Scan/STLcd/bitmap2Struct.py +++ b/Scan/STLcd/bitmap2Struct.py @@ -19,7 +19,7 @@ import sys from array import * -from PIL import Image +from PIL import Image # Use pillow instead of PIL, it works with Python 3 # Convenience class to deal with converting images to a C array From cd01bfe0ed0406225e4b39a5ab249aca0870c6e1 Mon Sep 17 00:00:00 2001 From: Joshua Flanagan Date: Tue, 10 Nov 2015 10:32:06 -0600 Subject: [PATCH 3/3] Stop requiring editing of example scripts The example scripts include hardcoded values that do not work for everyone. Instead of requiring the files to be edited (and dirtying the git tree), allow them to take command-line arguments. Also adds better guidance for Mac OSX virtual serial ports. --- Scan/ISSILed/exampleAPI.bash | 10 ++++++++-- Scan/STLcd/bitmap2Struct.py | 5 ++++- Scan/STLcd/exampleAPI.bash | 10 ++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Scan/ISSILed/exampleAPI.bash b/Scan/ISSILed/exampleAPI.bash index 5d66c37..91eeebf 100755 --- a/Scan/ISSILed/exampleAPI.bash +++ b/Scan/ISSILed/exampleAPI.bash @@ -3,9 +3,15 @@ # Virtual Serial Port API Example # Jacob Alexander 2015 +if [ $# -eq 0 ]; then + echo "You must specify your virtual serialport. (/dev/ttyACM0 on linux, /dev/cu.usbmodemXXXX on OSX)" + echo " ex: $0 /dev/ttyACM0" + exit 1 +fi # XXX Set this to match your virtual serialport -# TODO Show examples for Mac OSX and Cygwin/Windows -SERIALPORT=/dev/ttyACM0 +# TODO Show examples for Cygwin/Windows +# For Mac OSX it will be something like /dev/cu.usbmodem1413 (number may differ) +SERIALPORT=$1 # NOTE: Make sure you don't write too quickly to the serial port, it can get overwhelmed by a modern computer # Generally this just means commands will get ignored diff --git a/Scan/STLcd/bitmap2Struct.py b/Scan/STLcd/bitmap2Struct.py index dcf30c6..4e682ca 100755 --- a/Scan/STLcd/bitmap2Struct.py +++ b/Scan/STLcd/bitmap2Struct.py @@ -110,7 +110,10 @@ class STLcdGraphic: return display -filename = "ic_logo_lcd.bmp" +filename = sys.argv[1] +if filename is None: + print( "You must specify a bitmap filename. Try './bitmap2Struct.py ic_logo_lcd.bmp'" ) + sys.exit( 1 ) max_height = 32 max_width = 128 x_offset = 0 diff --git a/Scan/STLcd/exampleAPI.bash b/Scan/STLcd/exampleAPI.bash index 8c2dda5..dfce9d1 100755 --- a/Scan/STLcd/exampleAPI.bash +++ b/Scan/STLcd/exampleAPI.bash @@ -3,9 +3,15 @@ # Virtual Serial Port API Example # Jacob Alexander 2015 +if [ $# -eq 0 ]; then + echo "You must specify your virtual serialport. (/dev/ttyACM0 on linux, /dev/cu.usbmodemXXXX on OSX)" + echo " ex: $0 /dev/ttyACM0" + exit 1 +fi # XXX Set this to match your virtual serialport -# TODO Show examples for Mac OSX and Cygwin/Windows -SERIALPORT=/dev/ttyACM0 +# TODO Show example for Cygwin/Windows +# For Mac OSX it will be something like /dev/cu.usbmodem1413 (number may differ) +SERIALPORT=$1 # NOTE: Make sure you don't write too quickly to the serial port, it can get overwhelmed by a modern computer # Generally this just means commands will get ignored