Because of the Re-ARM card's pinout there is only one SPI connected to
the RepRap Discount Full Graphic LCD display. The LCD responds to ANY
SCK transitions no matter if it's enable is inactive. The result is
garbage (usually bars) on the LCD display whenever there is SD card
activity.
This code minimizes this by only accessing the SD card when changing
directory levels if :
SDCARD_SORT_ALPHA is enabled
SDSORT_USES_RAM is true
SDSORT_CACHE_NAMES is true
The code changes result in file names being pulled from the ALPHA SORT
memory array rather than the SD card.
The code also gives the file count and file index functions their own
variables. When they shared a common variable the index function
sometimes resulted in the file count being short by 1.
=======================================================================
cardreader.cpp & pins_RAMPS_RE_ARM.h changes
Added another condition to cardreader.cpp to enable getting file names
only from RAM.
pins_RAMPS_RE_ARM.h :
Added comments about the SD card accesses and the LCD display
Combined all versions into this one.
- `SD_DETECT_PIN` replaces `SDCARDDETECT`
- `SD_DETECT_INVERTED` replaces `SDCARDDETECTINVERTED`
- Revise the description of `SD_DETECT_INVERTED`
- Add a note about the override of `SD_DETECT_INVERTED` in
`Conditionals.h`
For the MORE_RAM option we need to buffer both the short and long
names, even though long names are sometimes redundant. Worst case, all
the names are max length. We can save some RAM by not storing these. We
could save more RAM by only storing the visible part of the long name.
If a print is stopped, it would be nice in the future to write a file with the printer state, the filename of the print, and the position within the print.
this file could be read, to continue a previously stopped print.
not finished yet.
by overloading M32 it is now possible to execute gcode files from other gcode files, with a fixed recursion level.
This can be used e.g. for having a real start.g and end.g somewhere on the sd card, which are then called from the normal print file.
Another usecase would be to have macro-files for nozzle-change and layerchange.
I have not tested the speedwise performance. The testing was done with pronterface.
syntax:
normal call from sd card will open the new file and continue executing there.
M32 !/path/filename#
this however will call the new file and return to the caller file.
M32 P !/path/filename#
with the optional "S<position>" the file starting position can be set.
this is for continuing prints from a previous location.
One array was too short. This had nothing to do with long filenames, other than if they were 12 characters exactly, which could only happen if the extension and the text before were filled completely