Fix long filenames

This commit is contained in:
Knutwurst
2020-07-25 12:27:34 +02:00
parent cedcbc01a0
commit 3c2d6f7965
2 changed files with 111 additions and 133 deletions

View File

@@ -54,9 +54,6 @@ int Temp_Buf_Bed_Temperature = 0;
unsigned char ResumingFlag = 0; unsigned char ResumingFlag = 0;
#endif #endif
//#define MAX_PRINTABLE_FILENAME_LEN 21
#define MAX_PRINTABLE_FILENAME_LEN 30
void setup_OutageTestPin() void setup_OutageTestPin()
{ {
#ifdef POWER_OUTAGE_TEST #ifdef POWER_OUTAGE_TEST
@@ -441,92 +438,92 @@ void AnycubicTouchscreenClass::HandleSpecialMenu()
SERIAL_ECHOPAIR(" DEBUG: Special Menu Selection: ", currentTouchscreenSelection); SERIAL_ECHOPAIR(" DEBUG: Special Menu Selection: ", currentTouchscreenSelection);
SERIAL_EOL(); SERIAL_EOL();
#endif #endif
if ((strcasestr(currentTouchscreenSelection, "Special Menu") != NULL) if ((strcasestr(currentTouchscreenSelection, SM_SPECIAL_MENU_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_SPECI~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_SPECIAL_MENU_S) != NULL))
{ {
SpecialMenu = true; SpecialMenu = true;
} }
else if ((strcasestr(currentTouchscreenSelection, "PID Tune Hotend") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_PID_HOTEND_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_PIDTU~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_PID_HOTEND_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: PID Tune Hotend"); SERIAL_ECHOLNPGM("Special Menu: PID Tune Hotend");
queue.inject_P(PSTR("M106 S204\nM303 E0 S210 C15 U1")); queue.inject_P(PSTR("M106 S204\nM303 E0 S210 C15 U1"));
} }
else if ((strcasestr(currentTouchscreenSelection, "PID Tune Ultrabase") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_PID_BED_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_PIDTU~2.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_PID_BED_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: PID Tune Ultrabase"); SERIAL_ECHOLNPGM("Special Menu: PID Tune Ultrabase");
queue.inject_P(PSTR("M303 E-1 S60 C6 U1")); queue.inject_P(PSTR("M303 E-1 S60 C6 U1"));
} }
else if ((strcasestr(currentTouchscreenSelection, "Save EEPROM") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_SAVE_EEPROM_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_SAVEE~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_SAVE_EEPROM_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
queue.inject_P(PSTR("M500")); queue.inject_P(PSTR("M500"));
buzzer.tone(105, 1108); buzzer.tone(105, 1108);
buzzer.tone(210, 1661); buzzer.tone(210, 1661);
} }
else if ((strcasestr(currentTouchscreenSelection, "Load FW Defaults") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_LOAD_DEFAULTS_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_LOADF~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_LOAD_DEFAULTS_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
queue.inject_P(PSTR("M502")); queue.inject_P(PSTR("M502"));
buzzer.tone(105, 1661); buzzer.tone(105, 1661);
buzzer.tone(210, 1108); buzzer.tone(210, 1108);
} }
else if ((strcasestr(currentTouchscreenSelection, "Preheat Ultrabase") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_PREHEAT_BED_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_PREHE~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_PREHEAT_BED_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Preheat Ultrabase"); SERIAL_ECHOLNPGM("Special Menu: Preheat Ultrabase");
queue.inject_P(PSTR("M140 S60")); queue.inject_P(PSTR("M140 S60"));
} }
#if DISABLED(KNUTWURST_BLTOUCH) #if DISABLED(KNUTWURST_BLTOUCH)
else if ((strcasestr(currentTouchscreenSelection, "Start Mesh Leveling") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_MESH_START_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_START~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_MESH_START_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling"); SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling");
queue.inject_P(PSTR("G29 S1")); queue.inject_P(PSTR("G29 S1"));
} }
else if ((strcasestr(currentTouchscreenSelection, "Next Mesh Point") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_MESH_NEXT_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_NEXTM~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_MESH_NEXT_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point"); SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point");
queue.inject_P(PSTR("G29 S2")); queue.inject_P(PSTR("G29 S2"));
} }
else if ((strcasestr(currentTouchscreenSelection, "Z Up 0.1") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_Z_UP_01_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_ZUP01~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_Z_UP_01_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1"); SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1");
queue.inject_P(PSTR("G91\nG1 Z+0.1\nG90")); queue.inject_P(PSTR("G91\nG1 Z+0.1\nG90"));
} }
else if ((strcasestr(currentTouchscreenSelection, "Z Down 0.1") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_Z_DN_01_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_ZDOWN~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_Z_DN_01_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1"); SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1");
queue.inject_P(PSTR("G91\nG1 Z-0.1\nG90")); queue.inject_P(PSTR("G91\nG1 Z-0.1\nG90"));
} }
else if ((strcasestr(currentTouchscreenSelection, "Z Up 0.02") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_Z_UP_002_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_ZUP00~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_Z_UP_002_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02"); SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02");
queue.inject_P(PSTR("G91\nG1 Z+0.02\nG90")); queue.inject_P(PSTR("G91\nG1 Z+0.02\nG90"));
} }
else if ((strcasestr(currentTouchscreenSelection, "Z Down 0.02") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_Z_DN_002_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_ZDOWN~2.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_Z_DN_002_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02"); SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02");
queue.inject_P(PSTR("G91\nG1 Z-0.02\nG90")); queue.inject_P(PSTR("G91\nG1 Z-0.02\nG90"));
} }
else if ((strcasestr(currentTouchscreenSelection, "Z Up 0.01") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_Z_UP_001_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_ZUP00~2.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_Z_UP_001_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.01"); SERIAL_ECHOLNPGM("Special Menu: Z Up 0.01");
queue.enqueue_now_P(PSTR("G91\nG1 Z+0.03\nG90")); queue.enqueue_now_P(PSTR("G91\nG1 Z+0.03\nG90"));
queue.enqueue_now_P(PSTR("G91\nG1 Z-0.02\nG90")); queue.enqueue_now_P(PSTR("G91\nG1 Z-0.02\nG90"));
} }
else if ((strcasestr(currentTouchscreenSelection, "Z Down 0.01") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_Z_DN_001_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_ZDOWN~3.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_Z_DN_001_L) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.01"); SERIAL_ECHOLNPGM("Special Menu: Z Down 0.01");
queue.enqueue_now_P(PSTR("G91\nG1 Z+0.02\nG90")); queue.enqueue_now_P(PSTR("G91\nG1 Z+0.02\nG90"));
@@ -535,27 +532,28 @@ void AnycubicTouchscreenClass::HandleSpecialMenu()
#endif #endif
#if ENABLED(KNUTWURST_BLTOUCH) #if ENABLED(KNUTWURST_BLTOUCH)
else if (strcasestr(currentTouchscreenSelection, "BLTouch Leveling") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_BLTOUCH_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, SM_BLTOUCH_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: BLTouch Leveling"); SERIAL_ECHOLNPGM("Special Menu: BLTouch Leveling");
queue.inject_P(PSTR("G28\nG29")); queue.inject_P(PSTR("G28\nG29"));
} }
#endif #endif
else if ((strcasestr(currentTouchscreenSelection, "Fil. Change Pause") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_PAUSE_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_FILCH~2.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_PAUSE_L) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Fil. Change Pause"); SERIAL_ECHOLNPGM("Special Menu: Fil. Change Pause");
FilamentChangePause(); FilamentChangePause();
} }
else if ((strcasestr(currentTouchscreenSelection, "Fil. Change Resume") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_RESUME_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_FILCH~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_RESUME_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Fil. Change Resume"); SERIAL_ECHOLNPGM("Special Menu: Fil. Change Resume");
FilamentChangeResume(); FilamentChangeResume();
} }
else if ((strcasestr(currentTouchscreenSelection, "Disable Fil. Sensor") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_DIS_FILSENS_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_DISAB~1") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_DIS_FILSENS_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Disable Filament Sensor"); SERIAL_ECHOLNPGM("Special Menu: Disable Filament Sensor");
FilamentSensorEnabled = false; FilamentSensorEnabled = false;
@@ -563,33 +561,21 @@ void AnycubicTouchscreenClass::HandleSpecialMenu()
buzzer.tone(105, 1108); buzzer.tone(105, 1108);
buzzer.tone(105, 1108); buzzer.tone(105, 1108);
} }
else if ((strcasestr(currentTouchscreenSelection, "Enable Fil. Sensor") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_EN_FILSENS_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_ENABL~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_EN_FILSENS_S) != NULL))
{ {
SERIAL_ECHOLNPGM("Special Menu: Enable Filament Sensor"); SERIAL_ECHOLNPGM("Special Menu: Enable Filament Sensor");
FilamentSensorEnabled = true; FilamentSensorEnabled = true;
buzzer.tone(105, 1108); buzzer.tone(105, 1108);
buzzer.tone(105, 1108); buzzer.tone(105, 1108);
} }
else if ((strcasestr(currentTouchscreenSelection, "Exit") != NULL) else if ((strcasestr(currentTouchscreenSelection, SM_EXIT_L) != NULL)
|| (strcasestr(currentTouchscreenSelection, "_EXIT_~1.GCO") != NULL)) || (strcasestr(currentTouchscreenSelection, SM_EXIT_S) != NULL))
{ {
SpecialMenu = false; SpecialMenu = false;
} }
} }
uint16_t AnycubicTouchscreenClass::MyGetFileNr()
{
if(card.isMounted)
{
MyFileNrCnt=0;
//ReadMyfileNrFlag=true;
delay(10);
//card.Myls();
MyFileNrCnt = card.countFilesInWorkDir();
}
return MyFileNrCnt;
}
void AnycubicTouchscreenClass::PrintList() void AnycubicTouchscreenClass::PrintList()
{ {
@@ -598,80 +584,80 @@ void AnycubicTouchscreenClass::PrintList()
switch (filenumber) switch (filenumber)
{ {
case 0: // Page 1 case 0: // Page 1
HARDWARE_SERIAL_PROTOCOLLNPGM("_EXIT_~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EXIT_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Exit].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EXIT_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_PREHE~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PREHEAT_BED_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Preheat Ultrabase].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PREHEAT_BED_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_FILCH~2.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PAUSE_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Fil. Change Pause].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PAUSE_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_FILCH~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_RESUME_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Fil. Change Resume].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_RESUME_L);
break; break;
#if DISABLED(KNUTWURST_BLTOUCH) #if DISABLED(KNUTWURST_BLTOUCH)
case 4: // Page 2 case 4: // Page 2
HARDWARE_SERIAL_PROTOCOLLNPGM("_START~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_MESH_START_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Start Mesh Leveling].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_MESH_START_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_NEXTM~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_MESH_NEXT_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Next Mesh Point].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_MESH_NEXT_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_ZUP01~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_UP_01_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Z Up 0.1].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_UP_01_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_ZDOWN~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_DN_01_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Z Down 0.1].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_DN_01_L);
break; break;
case 8: // Page 3 case 8: // Page 3
HARDWARE_SERIAL_PROTOCOLLNPGM("_ZUP00~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_UP_002_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Z Up 0.02].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_UP_002_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_ZDOWN~2.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_DN_002_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Z Down 0.02].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_DN_002_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_ZUP00~2.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_UP_001_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Z Up 0.01].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_UP_001_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_ZDOWN~3.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_DN_001_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Z Down 0.01].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_Z_DN_001_L);
break; break;
case 12: // Page 4 case 12: // Page 4
HARDWARE_SERIAL_PROTOCOLLNPGM("_PIDTU~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PID_HOTEND_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[PID Tune Hotend].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PID_HOTEND_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_PIDTU~2.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PID_BED_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[PID Tune Ultrabase].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PID_BED_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_SAVEE~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_SAVE_EEPROM_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Save EEPROM].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_SAVE_EEPROM_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_LOADF~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_LOAD_DEFAULTS_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Load FW Defaults].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_LOAD_DEFAULTS_L);
break; break;
case 16: // Page 5 case 16: // Page 5
HARDWARE_SERIAL_PROTOCOLLNPGM("_DISAB~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_DIS_FILSENS_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Disable Fil. Sensor].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_DIS_FILSENS_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_ENABL~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EN_FILSENS_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Enable Fil. Sensor].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EN_FILSENS_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_EXIT_~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EXIT_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Exit].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EXIT_L);
break; break;
#endif #endif
#if ENABLED(KNUTWURST_BLTOUCH) #if ENABLED(KNUTWURST_BLTOUCH)
case 4: // Page 2 case 4: // Page 2
HARDWARE_SERIAL_PROTOCOLLNPGM("_BLTOU~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_BLTOUCH_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[BLTouch Leveling].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_BLTOUCH_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_PIDTU~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PID_HOTEND_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[PID Tune Hotend].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PID_HOTEND_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_PIDTU~2.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PID_BED_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[PID Tune Ultrabase].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_PID_BED_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_DISAB~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_DIS_FILSENS_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Disable Fil. Sensor].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_DIS_FILSENS_L);
break; break;
case 8: // Page 3 case 8: // Page 3
HARDWARE_SERIAL_PROTOCOLLNPGM("_ENABL~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EN_FILSENS_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Enable Fil. Sensor].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EN_FILSENS_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_SAVEE~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_SAVE_EEPROM_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Save EEPROM].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_SAVE_EEPROM_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_LOADF~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_LOAD_DEFAULTS_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Load FW Defaults].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_LOAD_DEFAULTS_L);
HARDWARE_SERIAL_PROTOCOLLNPGM("_EXIT_~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EXIT_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Exit].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_EXIT_L);
break; break;
#endif #endif
@@ -684,7 +670,7 @@ void AnycubicTouchscreenClass::PrintList()
{ {
uint16_t count = filenumber; uint16_t count = filenumber;
uint16_t max_files; uint16_t max_files;
//uint16_t MyFileNrCnt = card.countFilesInWorkDir(); uint16_t MyFileNrCnt = card.countFilesInWorkDir();
// What is this shit? What if there are exactely 3 files+folders? // What is this shit? What if there are exactely 3 files+folders?
// TODO: find something better than this crap. // TODO: find something better than this crap.
@@ -710,24 +696,25 @@ void AnycubicTouchscreenClass::PrintList()
{ {
if (strcmp(card.getWorkDirName(), "/") == 0) if (strcmp(card.getWorkDirName(), "/") == 0)
{ {
HARDWARE_SERIAL_PROTOCOLLNPGM("_SPECI~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_SPECIAL_MENU_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("[Special Menu].gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_SPECIAL_MENU_L);
SERIAL_ECHO(count); SERIAL_ECHO(count);
SERIAL_ECHOLNPGM(": [Special Menu].gcode"); SERIAL_ECHO(": ");
SERIAL_ECHOLNPGM(SM_SPECIAL_MENU_L);
} }
else else
{ {
HARDWARE_SERIAL_PROTOCOLLNPGM("DIR_UP~1.GCO"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_DIR_UP_S);
HARDWARE_SERIAL_PROTOCOLLNPGM("DIR_UP.gcode"); HARDWARE_SERIAL_PROTOCOLLNPGM(SM_DIR_UP_L);
SERIAL_ECHO(count); SERIAL_ECHO(count);
SERIAL_ECHOLNPGM(": DIR_UP.gcode"); SERIAL_ECHO(": ");
SERIAL_ECHOLNPGM(SM_DIR_UP_L);
} }
} }
else else
{ {
card.selectFileByIndex(count - 1); card.selectFileByIndex(count - 1);
// Bugfix for non-printable special characters // Bugfix for non-printable special characters
// which are now replaced by underscores. // which are now replaced by underscores.
int fileNameLen = strlen(card.longFilename); int fileNameLen = strlen(card.longFilename);
@@ -762,18 +749,18 @@ void AnycubicTouchscreenClass::PrintList()
HARDWARE_SERIAL_PROTOCOL("/"); HARDWARE_SERIAL_PROTOCOL("/");
HARDWARE_SERIAL_PROTOCOLLN(card.filename); HARDWARE_SERIAL_PROTOCOLLN(card.filename);
HARDWARE_SERIAL_PROTOCOL("/"); HARDWARE_SERIAL_PROTOCOL("/");
HARDWARE_SERIAL_PROTOCOLLN(card.longFilename); HARDWARE_SERIAL_PROTOCOLLN(outputString);
SERIAL_ECHO(count); SERIAL_ECHO(count);
SERIAL_ECHOPGM(": /"); SERIAL_ECHOPGM(": /");
SERIAL_ECHOLN(card.longFilename); SERIAL_ECHOLN(outputString);
} }
else else
{ {
HARDWARE_SERIAL_PROTOCOLLN(card.filename); HARDWARE_SERIAL_PROTOCOLLN(card.filename);
HARDWARE_SERIAL_PROTOCOLLN(card.longFilename); HARDWARE_SERIAL_PROTOCOLLN(outputString);
SERIAL_ECHO(count); SERIAL_ECHO(count);
SERIAL_ECHOPGM(": "); SERIAL_ECHOPGM(": ");
SERIAL_ECHOLN(card.longFilename); SERIAL_ECHOLN(outputString);
} }
} }
} }
@@ -1213,12 +1200,9 @@ void AnycubicTouchscreenClass::GetCommandFromTFT()
} }
else else
{ {
MyGetFileNr();
if (CodeSeen('S')) if (CodeSeen('S'))
filenumber = CodeValue(); filenumber = CodeValue();
HARDWARE_SERIAL_PROTOCOLPGM("FN "); // Filelist start HARDWARE_SERIAL_PROTOCOLPGM("FN "); // Filelist start
HARDWARE_SERIAL_ENTER(); HARDWARE_SERIAL_ENTER();
PrintList(); PrintList();
@@ -1303,16 +1287,10 @@ void AnycubicTouchscreenClass::GetCommandFromTFT()
|| (TFTstrchr_pointer[4] == '_')) || (TFTstrchr_pointer[4] == '_'))
{ {
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 4); strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 4);
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPAIR(" TFT Serial Debug: currentTouchscreenSelection: ",currentTouchscreenSelection);
SERIAL_EOL();
#endif
} }
else else
{ {
currentTouchscreenSelection[0] = 0; //currentTouchscreenSelection[0] = 0;
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Normal file open path"); SERIAL_ECHOLNPGM("TFT Serial Debug: Normal file open path");

View File

@@ -34,6 +34,7 @@ char *ftostr32(const float &);
#define TFTBUFSIZE 4 #define TFTBUFSIZE 4
#define TFT_MAX_CMD_SIZE 96 #define TFT_MAX_CMD_SIZE 96
#define MSG_MY_VERSION "Knutwurst-1.0.7" #define MSG_MY_VERSION "Knutwurst-1.0.7"
#define MAX_PRINTABLE_FILENAME_LEN 64
#define ANYCUBIC_TFT_STATE_IDLE 0 #define ANYCUBIC_TFT_STATE_IDLE 0
#define ANYCUBIC_TFT_STATE_SDPRINT 1 #define ANYCUBIC_TFT_STATE_SDPRINT 1
@@ -158,10 +159,9 @@ private:
void FilamentChangeResume(); void FilamentChangeResume();
void ReheatNozzle(); void ReheatNozzle();
void ParkAfterStop(); void ParkAfterStop();
uint16_t MyGetFileNr();
char currentTouchscreenSelection[30]; char currentTouchscreenSelection[64];
char currentFileOrDirectory[30]; char currentFileOrDirectory[64];
uint16_t MyFileNrCnt = 0; uint16_t MyFileNrCnt = 0;
uint8_t SpecialMenu = false; uint8_t SpecialMenu = false;
uint8_t FilamentSensorEnabled = true; uint8_t FilamentSensorEnabled = true;