Beautify DGUS2 Clone file display. Might need some refactoring.
This commit is contained in:
@@ -970,18 +970,6 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
SERIAL_ECHOLN(currentFileList.filename());
|
SERIAL_ECHOLN(currentFileList.filename());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
if (currentFileList.isDir()) {
|
|
||||||
SEND_PGM("/");
|
|
||||||
SENDLINE(currentFileList.shortFilename());
|
|
||||||
SEND_PGM("/");
|
|
||||||
SENDLINE(currentFileList.filename());
|
|
||||||
} else {
|
|
||||||
SENDLINE(currentFileList.shortFilename());
|
|
||||||
SENDLINE(currentFileList.filename());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// The longname may not be filed, so we use the built-in fallback here.
|
// The longname may not be filed, so we use the built-in fallback here.
|
||||||
const char* fileName = currentFileList.filename();
|
const char* fileName = currentFileList.filename();
|
||||||
int fileNameLen = strlen(fileName);
|
int fileNameLen = strlen(fileName);
|
||||||
@@ -994,10 +982,11 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
fileNameWasCut = true;
|
fileNameWasCut = true;
|
||||||
fileNameLen = MAX_PRINTABLE_FILENAME_LEN;
|
fileNameLen = MAX_PRINTABLE_FILENAME_LEN;
|
||||||
}
|
}
|
||||||
|
char outputString[MAX_PRINTABLE_FILENAME_LEN];
|
||||||
|
#else
|
||||||
|
char outputString[fileNameLen];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char outputString[fileNameLen];
|
|
||||||
|
|
||||||
// Bugfix for non-printable special characters
|
// Bugfix for non-printable special characters
|
||||||
// which are now replaced by underscores.
|
// which are now replaced by underscores.
|
||||||
for (unsigned char i = 0; i <= fileNameLen; i++) {
|
for (unsigned char i = 0; i <= fileNameLen; i++) {
|
||||||
@@ -1012,17 +1001,31 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// I know, it's ugly, but it's faster than a string lib
|
// I know, it's ugly, but it's faster than a string lib
|
||||||
if (fileNameWasCut) {
|
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
||||||
outputString[fileNameLen - 7] = '~';
|
if (fileNameWasCut) {
|
||||||
outputString[fileNameLen - 6] = '.';
|
outputString[MAX_PRINTABLE_FILENAME_LEN - 7] = '~';
|
||||||
outputString[fileNameLen - 5] = 'g';
|
outputString[MAX_PRINTABLE_FILENAME_LEN - 6] = '.';
|
||||||
outputString[fileNameLen - 4] = 'c';
|
outputString[MAX_PRINTABLE_FILENAME_LEN - 5] = 'g';
|
||||||
outputString[fileNameLen - 3] = 'o';
|
outputString[MAX_PRINTABLE_FILENAME_LEN - 4] = 'c';
|
||||||
outputString[fileNameLen - 2] = 'd';
|
outputString[MAX_PRINTABLE_FILENAME_LEN - 3] = 'o';
|
||||||
outputString[fileNameLen - 1] = 'e';
|
outputString[MAX_PRINTABLE_FILENAME_LEN - 2] = 'd';
|
||||||
}
|
outputString[MAX_PRINTABLE_FILENAME_LEN - 1] = 'e';
|
||||||
|
outputString[MAX_PRINTABLE_FILENAME_LEN] = '\0';
|
||||||
|
} else if (currentFileList.isDir()) {
|
||||||
|
for (unsigned char i = fileNameLen; i < MAX_PRINTABLE_FILENAME_LEN - 7; i++) {
|
||||||
|
outputString[i] = ' ';
|
||||||
|
}
|
||||||
|
outputString[MAX_PRINTABLE_FILENAME_LEN - 7] = '\0';
|
||||||
|
} else {
|
||||||
|
for (unsigned char i = fileNameLen; i < MAX_PRINTABLE_FILENAME_LEN; i++) {
|
||||||
|
outputString[i] = ' ';
|
||||||
|
}
|
||||||
|
outputString[MAX_PRINTABLE_FILENAME_LEN] = '\0';
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
outputString[fileNameLen] = '\0';
|
||||||
|
#endif
|
||||||
|
|
||||||
outputString[fileNameLen] = '\0';
|
|
||||||
|
|
||||||
if (currentFileList.isDir()) {
|
if (currentFileList.isDir()) {
|
||||||
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
||||||
|
@@ -150,7 +150,7 @@ enum AnycubicMediaPauseState {
|
|||||||
#endif // !KNUTWURST_DGUS2_TFT
|
#endif // !KNUTWURST_DGUS2_TFT
|
||||||
|
|
||||||
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
||||||
#define SM_DIR_UP_L "<<< BACK <<< .gcode"
|
#define SM_DIR_UP_L "/.. .gcode"
|
||||||
#define SM_DIR_UP_S "DIR_UP~1.GCO"
|
#define SM_DIR_UP_S "DIR_UP~1.GCO"
|
||||||
#define SM_SPECIAL_MENU_L "<Special Menu> .gcode"
|
#define SM_SPECIAL_MENU_L "<Special Menu> .gcode"
|
||||||
#define SM_SPECIAL_MENU_S "<SPECI~1.GCO"
|
#define SM_SPECIAL_MENU_S "<SPECI~1.GCO"
|
||||||
|
Reference in New Issue
Block a user