First working version
This commit is contained in:
parent
26135ea227
commit
1c61f2f29c
10 changed files with 199 additions and 71 deletions
|
@ -257,17 +257,17 @@
|
|||
#define SD_SORT_ALPHA 1
|
||||
#define SD_SORT_NONE 2
|
||||
|
||||
#define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256).
|
||||
#define FOLDER_SORTING - 1 // -1=above 0=none 1=below
|
||||
#define SDSORT_LIMIT 100 // Maximum number of sorted items (10-256).
|
||||
#define FOLDER_SORTING -1 // -1=above 0=none 1=below
|
||||
#define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code.
|
||||
#define SDSORT_USES_RAM true // Pre-allocate a static array for faster pre-sorting.
|
||||
#define SDSORT_USES_STACK true // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.)
|
||||
#define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting.
|
||||
#define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.)
|
||||
#define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option.
|
||||
#define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use!
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD_SORT_ALPHA)
|
||||
#define HAS_FOLDER_SORTING(FOLDER_SORTING || SDSORT_GCODE)
|
||||
#define HAS_FOLDER_SORTING (FOLDER_SORTING || SDSORT_GCODE)
|
||||
#endif
|
||||
|
||||
// Show a progress bar on the LCD when printing from SD?
|
||||
|
|
|
@ -117,13 +117,15 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
|||
createFilename(filename, p);
|
||||
SERIAL_PROTOCOL(prepend);
|
||||
SERIAL_PROTOCOL(filename);
|
||||
//SERIAL_PROTOCOLCHAR(' ');
|
||||
MYSERIAL.write(' ');
|
||||
SERIAL_PROTOCOLLN(p.fileSize);
|
||||
break;
|
||||
|
||||
case LS_GetFilename:
|
||||
//SERIAL_ECHOPGM("File: ");
|
||||
createFilename(filename, p);
|
||||
cluster = parent.curCluster();
|
||||
position = parent.curPosition();
|
||||
/*MYSERIAL.println(filename);
|
||||
SERIAL_ECHOPGM("Write date: ");
|
||||
writeDate = p.lastWriteDate;
|
||||
|
@ -239,7 +241,7 @@ void CardReader::startFileprint()
|
|||
{
|
||||
sdprinting = true;
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
flush_presort();
|
||||
//flush_presort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -636,6 +638,15 @@ void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/)
|
|||
|
||||
}
|
||||
|
||||
void CardReader::getfilename_simple(uint32_t position, const char * const match/*=NULL*/)
|
||||
{
|
||||
curDir = &workDir;
|
||||
lsAction = LS_GetFilename;
|
||||
nrFiles = 0;
|
||||
curDir->seekSet(position);
|
||||
lsDive("", *curDir, match);
|
||||
}
|
||||
|
||||
uint16_t CardReader::getnrfilenames()
|
||||
{
|
||||
curDir=&workDir;
|
||||
|
@ -669,6 +680,9 @@ void CardReader::chdir(const char * relpath)
|
|||
workDirParents[0]=*parent;
|
||||
}
|
||||
workDir=newfile;
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
presort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -681,6 +695,9 @@ void CardReader::updir()
|
|||
int d;
|
||||
for (int d = 0; d < workDirDepth; d++)
|
||||
workDirParents[d] = workDirParents[d+1];
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
presort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -707,19 +724,15 @@ void CardReader::getfilename_sorted(const uint16_t nr) {
|
|||
* - Most RAM: Buffer the directory and return filenames from RAM
|
||||
*/
|
||||
void CardReader::presort() {
|
||||
|
||||
if (farm_mode || IS_SD_INSERTED == false) return; //sorting is not used in farm mode
|
||||
uint8_t sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT);
|
||||
|
||||
if (sdSort == SD_SORT_NONE) return; //sd sort is turned off
|
||||
#if !SDSORT_USES_RAM
|
||||
lcd_set_progress();
|
||||
#endif
|
||||
lcd_implementation_clear();
|
||||
lcd_print_at_PGM(0, 1, MSG_SORTING);
|
||||
|
||||
#if SDSORT_GCODE
|
||||
if (!sort_alpha) return;
|
||||
#endif
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
|
||||
// Throw away old sort index
|
||||
flush_presort();
|
||||
|
@ -730,7 +743,15 @@ void CardReader::presort() {
|
|||
|
||||
// Never sort more than the max allowed
|
||||
// If you use folders to organize, 20 may be enough
|
||||
if (fileCnt > SDSORT_LIMIT) fileCnt = SDSORT_LIMIT;
|
||||
if (fileCnt > SDSORT_LIMIT) {
|
||||
lcd_show_fullscreen_message_and_wait_P(MSG_FILE_CNT);
|
||||
fileCnt = SDSORT_LIMIT;
|
||||
}
|
||||
lcd_implementation_clear();
|
||||
#if !SDSORT_USES_RAM
|
||||
lcd_set_progress();
|
||||
#endif
|
||||
lcd_print_at_PGM(0, 1, MSG_SORTING);
|
||||
|
||||
// Sort order is always needed. May be static or dynamic.
|
||||
#if SDSORT_DYNAMIC_RAM
|
||||
|
@ -749,8 +770,8 @@ void CardReader::presort() {
|
|||
#endif
|
||||
#elif SDSORT_USES_STACK
|
||||
char sortnames[fileCnt][LONG_FILENAME_LENGTH];
|
||||
uint16_t creation_time[SDSORT_LIMIT];
|
||||
uint16_t creation_date[SDSORT_LIMIT];
|
||||
uint16_t creation_time[fileCnt];
|
||||
uint16_t creation_date[fileCnt];
|
||||
#endif
|
||||
|
||||
// Folder sorting needs 1 bit per entry for flags.
|
||||
|
@ -764,6 +785,8 @@ void CardReader::presort() {
|
|||
|
||||
#else // !SDSORT_USES_RAM
|
||||
|
||||
uint32_t positions[fileCnt];
|
||||
|
||||
// By default re-read the names from SD for every compare
|
||||
// retaining only two filenames at a time. This is very
|
||||
// slow but is safest and uses minimal RAM.
|
||||
|
@ -772,11 +795,15 @@ void CardReader::presort() {
|
|||
uint16_t creation_date_bckp;
|
||||
|
||||
#endif
|
||||
|
||||
position = 0;
|
||||
if (fileCnt > 1) {
|
||||
// Init sort order.
|
||||
for (uint16_t i = 0; i < fileCnt; i++) {
|
||||
if (!IS_SD_INSERTED) return;
|
||||
manage_heater();
|
||||
sort_order[i] = i;
|
||||
positions[i] = position;
|
||||
getfilename(i);
|
||||
// If using RAM then read all filenames now.
|
||||
#if SDSORT_USES_RAM
|
||||
getfilename(i);
|
||||
|
@ -807,13 +834,50 @@ void CardReader::presort() {
|
|||
#endif
|
||||
#endif
|
||||
}
|
||||
// Bubble Sort
|
||||
uint16_t counter = 0;
|
||||
|
||||
#ifdef QUICKSORT
|
||||
quicksort(0, fileCnt - 1);
|
||||
#else //Qicksort not defined, use Bubble Sort
|
||||
uint32_t counter = 0;
|
||||
uint16_t total = 0.5*(fileCnt - 1)*(fileCnt);
|
||||
|
||||
// Compare names from the array or just the two buffered names
|
||||
#if SDSORT_USES_RAM
|
||||
#define _SORT_CMP_NODIR() (strcasecmp(sortnames[o1], sortnames[o2]) > 0)
|
||||
#define _SORT_CMP_TIME_NODIR() (((creation_date[o1] == creation_date[o2]) && (creation_time[o1] < creation_time[o2])) || \
|
||||
(creation_date[o1] < creation_date [o2]))
|
||||
#else
|
||||
#define _SORT_CMP_NODIR() (strcasecmp(name1, name2) > 0) //true if lowercase(name1) > lowercase(name2)
|
||||
#define _SORT_CMP_TIME_NODIR() (((creation_date_bckp == creationDate) && (creation_time_bckp > creationTime)) || \
|
||||
(creation_date_bckp > creationDate))
|
||||
|
||||
#endif
|
||||
|
||||
#if HAS_FOLDER_SORTING
|
||||
#if SDSORT_USES_RAM
|
||||
// Folder sorting needs an index and bit to test for folder-ness.
|
||||
const uint8_t ind1 = o1 >> 3, bit1 = o1 & 0x07,
|
||||
ind2 = o2 >> 3, bit2 = o2 & 0x07;
|
||||
#define _SORT_CMP_DIR(fs) \
|
||||
(((isDir[ind1] & _BV(bit1)) != 0) == ((isDir[ind2] & _BV(bit2)) != 0) \
|
||||
? _SORT_CMP_NODIR() \
|
||||
: (isDir[fs > 0 ? ind1 : ind2] & (fs > 0 ? _BV(bit1) : _BV(bit2))) != 0)
|
||||
#define _SORT_CMP_TIME_DIR(fs) \
|
||||
(((isDir[ind1] & _BV(bit1)) != 0) == ((isDir[ind2] & _BV(bit2)) != 0) \
|
||||
? _SORT_CMP_TIME_NODIR() \
|
||||
: (isDir[fs > 0 ? ind1 : ind2] & (fs > 0 ? _BV(bit1) : _BV(bit2))) != 0)
|
||||
#else
|
||||
#define _SORT_CMP_DIR(fs) ((dir1 == filenameIsDir) ? _SORT_CMP_NODIR() : (fs > 0 ? dir1 : !dir1))
|
||||
#define _SORT_CMP_TIME_DIR(fs) ((dir1 == filenameIsDir) ? _SORT_CMP_TIME_NODIR() : (fs < 0 ? dir1 : !dir1))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (uint16_t i = fileCnt; --i;) {
|
||||
if (!IS_SD_INSERTED) return;
|
||||
bool didSwap = false;
|
||||
|
||||
#if !SDSORT_USES_RAM //show progresss bar only if slow sorting method is used
|
||||
int8_t percent = ((counter * 100) / (fileCnt - 1));
|
||||
int8_t percent = (counter * 100) / total;//((counter * 100) / pow((fileCnt-1),2));
|
||||
for (int column = 0; column < 20; column++) {
|
||||
if (column < (percent / 5)) lcd_implementation_print_at(column, 2, "\x01"); //simple progress bar
|
||||
}
|
||||
|
@ -822,49 +886,22 @@ void CardReader::presort() {
|
|||
|
||||
//MYSERIAL.println(int(i));
|
||||
for (uint16_t j = 0; j < i; ++j) {
|
||||
if (!IS_SD_INSERTED) return;
|
||||
manage_heater();
|
||||
const uint16_t o1 = sort_order[j], o2 = sort_order[j + 1];
|
||||
// Compare names from the array or just the two buffered names
|
||||
#if SDSORT_USES_RAM
|
||||
#define _SORT_CMP_NODIR() (strcasecmp(sortnames[o1], sortnames[o2]) > 0)
|
||||
#define _SORT_CMP_TIME_NODIR() (((creation_date[o1] == creation_date[o2]) && (creation_time[o1] < creation_time[o2])) || \
|
||||
(creation_date[o1] < creation_date [o2]))
|
||||
#else
|
||||
#define _SORT_CMP_NODIR() (strcasecmp(name1, name2) > 0) //true if lowercase(name1) > lowercase(name2)
|
||||
#define _SORT_CMP_TIME_NODIR() (((creation_date_bckp == creationDate) && (creation_time_bckp < creationTime)) || \
|
||||
(creation_date_bckp < creationDate))
|
||||
#endif
|
||||
|
||||
#if HAS_FOLDER_SORTING
|
||||
#if SDSORT_USES_RAM
|
||||
// Folder sorting needs an index and bit to test for folder-ness.
|
||||
const uint8_t ind1 = o1 >> 3, bit1 = o1 & 0x07,
|
||||
ind2 = o2 >> 3, bit2 = o2 & 0x07;
|
||||
#define _SORT_CMP_DIR(fs) \
|
||||
(((isDir[ind1] & _BV(bit1)) != 0) == ((isDir[ind2] & _BV(bit2)) != 0) \
|
||||
? _SORT_CMP_NODIR() \
|
||||
: (isDir[fs > 0 ? ind1 : ind2] & (fs > 0 ? _BV(bit1) : _BV(bit2))) != 0)
|
||||
#define _SORT_CMP_TIME_DIR(fs) \
|
||||
(((isDir[ind1] & _BV(bit1)) != 0) == ((isDir[ind2] & _BV(bit2)) != 0) \
|
||||
? _SORT_CMP_TIME_NODIR() \
|
||||
: (isDir[fs > 0 ? ind1 : ind2] & (fs > 0 ? _BV(bit1) : _BV(bit2))) != 0)
|
||||
#else
|
||||
#define _SORT_CMP_DIR(fs) ((dir1 == filenameIsDir) ? _SORT_CMP_NODIR() : (fs > 0 ? dir1 : !dir1))
|
||||
#define _SORT_CMP_TIME_DIR(fs) ((dir1 == filenameIsDir) ? _SORT_CMP_TIME_NODIR() : (fs > 0 ? dir1 : !dir1))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// The most economical method reads names as-needed
|
||||
// throughout the loop. Slow if there are many.
|
||||
#if !SDSORT_USES_RAM
|
||||
|
||||
getfilename(o1);
|
||||
counter++;
|
||||
getfilename_simple(positions[o1]);
|
||||
strcpy(name1, LONGEST_FILENAME); // save (or getfilename below will trounce it)
|
||||
creation_date_bckp = creationDate;
|
||||
creation_time_bckp = creationTime;
|
||||
#if HAS_FOLDER_SORTING
|
||||
bool dir1 = filenameIsDir;
|
||||
#endif
|
||||
getfilename(o2);
|
||||
getfilename_simple(positions[o2]);
|
||||
char *name2 = LONGEST_FILENAME; // use the string in-place
|
||||
|
||||
#endif // !SDSORT_USES_RAM
|
||||
|
@ -881,12 +918,11 @@ void CardReader::presort() {
|
|||
sort_order[j] = o2;
|
||||
sort_order[j + 1] = o1;
|
||||
didSwap = true;
|
||||
//SERIAL_ECHOLNPGM("did swap");
|
||||
}
|
||||
}
|
||||
if (!didSwap) break;
|
||||
} //end of bubble sort loop
|
||||
|
||||
#endif
|
||||
// Using RAM but not keeping names around
|
||||
#if (SDSORT_USES_RAM && !SDSORT_CACHE_NAMES)
|
||||
#if SDSORT_DYNAMIC_RAM
|
||||
|
@ -919,10 +955,14 @@ void CardReader::presort() {
|
|||
}
|
||||
#if !SDSORT_USES_RAM //show progresss bar only if slow sorting method is used
|
||||
for (int column = 0; column <= 19; column++) lcd_implementation_print_at(column, 2, "\x01"); //simple progress bar
|
||||
delay(500);
|
||||
lcd_set_arrows();
|
||||
delay(300);
|
||||
lcd_set_degree();
|
||||
lcd_implementation_clear();
|
||||
lcd_update(2);
|
||||
#endif
|
||||
lcd_update(2);
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
|
||||
}
|
||||
|
||||
void CardReader::flush_presort() {
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
void printingHasFinished();
|
||||
|
||||
void getfilename(uint16_t nr, const char* const match=NULL);
|
||||
void getfilename_simple(uint32_t position, const char * const match = NULL);
|
||||
uint16_t getnrfilenames();
|
||||
|
||||
void getAbsFilename(char *t);
|
||||
|
@ -45,6 +46,10 @@ public:
|
|||
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
void presort();
|
||||
#ifdef SDSORT_QUICKSORT
|
||||
void swap(uint8_t left, uint8_t right);
|
||||
void quicksort(uint8_t left, uint8_t right);
|
||||
#endif //SDSORT_QUICKSORT
|
||||
void getfilename_sorted(const uint16_t nr);
|
||||
#if SDSORT_GCODE
|
||||
FORCE_INLINE void setSortOn(bool b) { sort_alpha = b; presort(); }
|
||||
|
@ -72,6 +77,7 @@ public:
|
|||
bool cardOK ;
|
||||
char filename[13];
|
||||
uint16_t creationTime, creationDate;
|
||||
uint32_t cluster, position;
|
||||
char longFilename[LONG_FILENAME_LENGTH];
|
||||
bool filenameIsDir;
|
||||
int lastnr; //last number of the autostart;
|
||||
|
@ -143,6 +149,9 @@ private:
|
|||
int16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
|
||||
char* diveDirName;
|
||||
void lsDive(const char *prepend, SdFile parent, const char * const match=NULL);
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
void flush_presort();
|
||||
#endif
|
||||
};
|
||||
extern CardReader card;
|
||||
#define IS_SD_PRINTING (card.sdprinting)
|
||||
|
|
|
@ -422,6 +422,11 @@ const char * const MSG_DATE_LANG_TABLE[LANG_NUM] PROGMEM = {
|
|||
MSG_DATE_CZ
|
||||
};
|
||||
|
||||
const char MSG_DEFAULT_SETTINGS_LOADED_EN[] PROGMEM = "Default settings loaded";
|
||||
const char * const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[1] PROGMEM = {
|
||||
MSG_DEFAULT_SETTINGS_LOADED_EN
|
||||
};
|
||||
|
||||
const char MSG_DISABLE_STEPPERS_EN[] PROGMEM = "Disable steppers";
|
||||
const char MSG_DISABLE_STEPPERS_CZ[] PROGMEM = "Vypnout motory";
|
||||
const char * const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||
|
@ -621,6 +626,13 @@ const char * const MSG_FILAMENT_LOADING_T3_LANG_TABLE[LANG_NUM] PROGMEM = {
|
|||
MSG_FILAMENT_LOADING_T3_CZ
|
||||
};
|
||||
|
||||
const char MSG_FILE_CNT_EN[] PROGMEM = "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100.";
|
||||
const char MSG_FILE_CNT_CZ[] PROGMEM = "Nektere soubory nebudou setrideny. Maximalni pocet souboru pro setrideni je 100.";
|
||||
const char * const MSG_FILE_CNT_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||
MSG_FILE_CNT_EN,
|
||||
MSG_FILE_CNT_CZ
|
||||
};
|
||||
|
||||
const char MSG_FILE_INCOMPLETE_EN[] PROGMEM = "File incomplete. Continue anyway?";
|
||||
const char MSG_FILE_INCOMPLETE_CZ[] PROGMEM = "Soubor nekompletni. Pokracovat?";
|
||||
const char * const MSG_FILE_INCOMPLETE_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||
|
@ -1750,6 +1762,32 @@ const char * const MSG_SOFTWARE_RESET_LANG_TABLE[1] PROGMEM = {
|
|||
MSG_SOFTWARE_RESET_EN
|
||||
};
|
||||
|
||||
const char MSG_SORTING_EN[] PROGMEM = "Sorting files";
|
||||
const char * const MSG_SORTING_LANG_TABLE[1] PROGMEM = {
|
||||
MSG_SORTING_EN
|
||||
};
|
||||
|
||||
const char MSG_SORT_ALPHA_EN[] PROGMEM = "Sort: [Alphabet]";
|
||||
const char MSG_SORT_ALPHA_CZ[] PROGMEM = "Trideni [Abeceda]";
|
||||
const char * const MSG_SORT_ALPHA_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||
MSG_SORT_ALPHA_EN,
|
||||
MSG_SORT_ALPHA_CZ
|
||||
};
|
||||
|
||||
const char MSG_SORT_NONE_EN[] PROGMEM = "Sort: [None]";
|
||||
const char MSG_SORT_NONE_CZ[] PROGMEM = "Trideni [Zadne]";
|
||||
const char * const MSG_SORT_NONE_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||
MSG_SORT_NONE_EN,
|
||||
MSG_SORT_NONE_CZ
|
||||
};
|
||||
|
||||
const char MSG_SORT_TIME_EN[] PROGMEM = "Sort: [Time]";
|
||||
const char MSG_SORT_TIME_CZ[] PROGMEM = "Trideni [Cas]";
|
||||
const char * const MSG_SORT_TIME_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||
MSG_SORT_TIME_EN,
|
||||
MSG_SORT_TIME_CZ
|
||||
};
|
||||
|
||||
const char MSG_SPEED_EN[] PROGMEM = "Speed";
|
||||
const char MSG_SPEED_CZ[] PROGMEM = "Rychlost";
|
||||
const char * const MSG_SPEED_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||
|
|
|
@ -152,6 +152,8 @@ extern const char* const MSG_CURRENT_LANG_TABLE[LANG_NUM];
|
|||
#define MSG_CURRENT LANG_TABLE_SELECT(MSG_CURRENT_LANG_TABLE)
|
||||
extern const char* const MSG_DATE_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_DATE LANG_TABLE_SELECT(MSG_DATE_LANG_TABLE)
|
||||
extern const char* const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[1];
|
||||
#define MSG_DEFAULT_SETTINGS_LOADED LANG_TABLE_SELECT_EXPLICIT(MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE, 0)
|
||||
extern const char* const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE)
|
||||
extern const char* const MSG_DWELL_LANG_TABLE[1];
|
||||
|
@ -222,6 +224,8 @@ extern const char* const MSG_FILAMENT_LOADING_T2_LANG_TABLE[LANG_NUM];
|
|||
#define MSG_FILAMENT_LOADING_T2 LANG_TABLE_SELECT(MSG_FILAMENT_LOADING_T2_LANG_TABLE)
|
||||
extern const char* const MSG_FILAMENT_LOADING_T3_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_FILAMENT_LOADING_T3 LANG_TABLE_SELECT(MSG_FILAMENT_LOADING_T3_LANG_TABLE)
|
||||
extern const char* const MSG_FILE_CNT_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_FILE_CNT LANG_TABLE_SELECT(MSG_FILE_CNT_LANG_TABLE)
|
||||
extern const char* const MSG_FILE_INCOMPLETE_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_FILE_INCOMPLETE LANG_TABLE_SELECT(MSG_FILE_INCOMPLETE_LANG_TABLE)
|
||||
extern const char* const MSG_FILE_PRINTED_LANG_TABLE[1];
|
||||
|
@ -590,6 +594,14 @@ extern const char* const MSG_SLIGHT_SKEW_LANG_TABLE[LANG_NUM];
|
|||
#define MSG_SLIGHT_SKEW LANG_TABLE_SELECT(MSG_SLIGHT_SKEW_LANG_TABLE)
|
||||
extern const char* const MSG_SOFTWARE_RESET_LANG_TABLE[1];
|
||||
#define MSG_SOFTWARE_RESET LANG_TABLE_SELECT_EXPLICIT(MSG_SOFTWARE_RESET_LANG_TABLE, 0)
|
||||
extern const char* const MSG_SORTING_LANG_TABLE[1];
|
||||
#define MSG_SORTING LANG_TABLE_SELECT_EXPLICIT(MSG_SORTING_LANG_TABLE, 0)
|
||||
extern const char* const MSG_SORT_ALPHA_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_SORT_ALPHA LANG_TABLE_SELECT(MSG_SORT_ALPHA_LANG_TABLE)
|
||||
extern const char* const MSG_SORT_NONE_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_SORT_NONE LANG_TABLE_SELECT(MSG_SORT_NONE_LANG_TABLE)
|
||||
extern const char* const MSG_SORT_TIME_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_SORT_TIME LANG_TABLE_SELECT(MSG_SORT_TIME_LANG_TABLE)
|
||||
extern const char* const MSG_SPEED_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_SPEED LANG_TABLE_SELECT(MSG_SPEED_LANG_TABLE)
|
||||
extern const char* const MSG_STACK_ERROR_LANG_TABLE[1];
|
||||
|
|
|
@ -352,4 +352,8 @@
|
|||
#define MSG_RECOVER_PRINT "Detekovan vypadek proudu.Obnovit tisk?"
|
||||
#define MSG_PRESS_TO_UNLOAD "Pro vysunuti filamentu stisknete prosim tlacitko"
|
||||
#define MSG_UNLOAD_SUCCESSFULL "Opakovat vysunuti filamentu?"
|
||||
#define MSG_FILE_INCOMPLETE "Soubor nekompletni. Pokracovat?"
|
||||
#define MSG_FILE_INCOMPLETE "Soubor nekompletni. Pokracovat?"
|
||||
#define MSG_FILE_CNT "Nektere soubory nebudou setrideny. Maximalni pocet souboru pro setrideni je 100."
|
||||
#define MSG_SORT_TIME "Trideni [Cas]"
|
||||
#define MSG_SORT_ALPHA "Trideni [Abeceda]"
|
||||
#define MSG_SORT_NONE "Trideni [Zadne]"
|
|
@ -374,4 +374,5 @@
|
|||
#define(length=17, lines=1) MSG_SORT_TIME "Sort: [Time]"
|
||||
#define(length=17, lines=1) MSG_SORT_ALPHA "Sort: [Alphabet]"
|
||||
#define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]"
|
||||
#define(length=20, lines=1) MSG_SORTING "Sorting files"
|
||||
#define(length=20, lines=1) MSG_SORTING "Sorting files"
|
||||
#define(length=20, lines=4) MSG_FILE_CNT "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100."
|
|
@ -121,6 +121,10 @@ extern void crashdet_disable();
|
|||
uint8_t snmm_extruder = 0;
|
||||
#endif
|
||||
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
bool presort_flag = false;
|
||||
#endif
|
||||
|
||||
int lcd_commands_type=LCD_COMMAND_IDLE;
|
||||
int lcd_commands_step=0;
|
||||
bool isPrintPaused = false;
|
||||
|
@ -3233,7 +3237,8 @@ static void lcd_sort_type_set() {
|
|||
default: sdSort = SD_SORT_TIME;
|
||||
}
|
||||
eeprom_update_byte((unsigned char *)EEPROM_SD_SORT, sdSort);
|
||||
lcd_goto_menu(lcd_sdcard_menu, 1);
|
||||
presort_flag = true;
|
||||
lcd_goto_menu(lcd_settings_menu, 8);
|
||||
//lcd_update(2);
|
||||
//delay(1000);
|
||||
card.presort();
|
||||
|
@ -3296,8 +3301,8 @@ static void lcd_fsensor_state_set()
|
|||
}
|
||||
|
||||
#if !SDSORT_USES_RAM
|
||||
void lcd_set_arrows() {
|
||||
void lcd_set_custom_characters_arrows();
|
||||
void lcd_set_degree() {
|
||||
lcd_set_custom_characters_degree();
|
||||
}
|
||||
|
||||
void lcd_set_progress() {
|
||||
|
@ -3732,6 +3737,18 @@ static void lcd_settings_menu()
|
|||
} else {
|
||||
MENU_ITEM(function, MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF, lcd_toshiba_flash_air_compatibility_toggle);
|
||||
}
|
||||
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
if (!farm_mode) {
|
||||
uint8_t sdSort;
|
||||
EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));
|
||||
switch (sdSort) {
|
||||
case SD_SORT_TIME: MENU_ITEM(function, MSG_SORT_TIME, lcd_sort_type_set); break;
|
||||
case SD_SORT_ALPHA: MENU_ITEM(function, MSG_SORT_ALPHA, lcd_sort_type_set); break;
|
||||
default: MENU_ITEM(function, MSG_SORT_NONE, lcd_sort_type_set);
|
||||
}
|
||||
}
|
||||
#endif // SDCARD_SORT_ALPHA
|
||||
|
||||
if (farm_mode)
|
||||
{
|
||||
|
@ -5205,7 +5222,12 @@ void getFileDescription(char *name, char *description) {
|
|||
|
||||
void lcd_sdcard_menu()
|
||||
{
|
||||
uint8_t sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT);
|
||||
int tempScrool = 0;
|
||||
if (presort_flag == true) {
|
||||
presort_flag = false;
|
||||
card.presort();
|
||||
}
|
||||
if (lcdDrawUpdate == 0 && LCD_CLICKED == 0)
|
||||
//delay(100);
|
||||
return; // nothing to do (so don't thrash the SD card)
|
||||
|
@ -5227,7 +5249,7 @@ void lcd_sdcard_menu()
|
|||
{
|
||||
if (_menuItemNr == _lineNr)
|
||||
{
|
||||
const uint16_t nr = (sdSort == SD_SORT_NONE) ? (fileCnt - 1 - i) : i;
|
||||
const uint16_t nr = ((sdSort == SD_SORT_NONE) || farm_mode || (sdSort == SD_SORT_TIME)) ? (fileCnt - 1 - i) : i;
|
||||
/*#ifdef SDCARD_RATHERRECENTFIRST
|
||||
#ifndef SDCARD_SORT_ALPHA
|
||||
fileCnt - 1 -
|
||||
|
@ -6471,6 +6493,7 @@ void lcd_update(uint8_t lcdDrawUpdateOverride)
|
|||
(*currentMenu)();
|
||||
menuExiting = false;
|
||||
}
|
||||
lcd_implementation_clear();
|
||||
lcd_return_to_status();
|
||||
lcdDrawUpdate = 2;
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ void display_loading();
|
|||
void lcd_service_mode_show_result();
|
||||
|
||||
#if !SDSORT_USES_RAM
|
||||
void lcd_set_arrows();
|
||||
void lcd_set_degree();
|
||||
void lcd_set_progress();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -862,17 +862,18 @@ if (print_sd_status)
|
|||
// If heating in progress, set flag
|
||||
if (heating_status != 0) { custom_message = true; }
|
||||
|
||||
if (IS_SD_PRINTING) {
|
||||
if (strcmp(longFilenameOLD, card.longFilename) != 0)
|
||||
{
|
||||
memset(longFilenameOLD, '\0', strlen(longFilenameOLD));
|
||||
sprintf_P(longFilenameOLD, PSTR("%s"), card.longFilename);
|
||||
scrollstuff = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// If printing from SD, show what we are printing
|
||||
if ((IS_SD_PRINTING) && !custom_message)
|
||||
{
|
||||
|
||||
if(strcmp(longFilenameOLD, card.longFilename) != 0)
|
||||
{
|
||||
memset(longFilenameOLD,'\0',strlen(longFilenameOLD));
|
||||
sprintf_P(longFilenameOLD, PSTR("%s"), card.longFilename);
|
||||
scrollstuff = 0;
|
||||
}
|
||||
|
||||
if(strlen(card.longFilename) > LCD_WIDTH)
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in a new issue