🧑‍💻 Misc. ExtUI LCD cleanup (#25872)

This commit is contained in:
Scott Lahteine
2023-05-24 01:05:55 -05:00
committed by GitHub
parent 9036cec562
commit 37d0f49a82
42 changed files with 3173 additions and 3200 deletions

View File

@@ -60,21 +60,21 @@ using namespace ExtUI;
namespace Anycubic {
FileNavigator filenavigator;
FileList FileNavigator::filelist; // Instance of the Marlin file API
FileList FileNavigator::filelist; // ExtUI file API
uint16_t FileNavigator::lastpanelindex;
uint16_t FileNavigator::currentindex; // override the panel request
uint8_t FileNavigator::folderdepth;
uint16_t FileNavigator::currentfolderindex[MAX_FOLDER_DEPTH]; // track folder pos for iteration
char FileNavigator::currentfoldername[MAX_PATH_LEN + 1]; // Current folder path
uint16_t FileNavigator::currentDirIndex[MAX_FOLDER_DEPTH]; // track folder pos for iteration
char FileNavigator::currentDirPath[MAX_PATH_LEN + 1]; // Current folder path
FileNavigator::FileNavigator() { reset(); }
void FileNavigator::reset() {
currentfoldername[0] = '\0';
currentDirPath[0] = '\0';
folderdepth = 0;
currentindex = 0;
lastpanelindex = 0;
ZERO(currentfolderindex);
ZERO(currentDirIndex);
// Start at root folder
while (!filelist.isAtRootDir()) filelist.upDir();
@@ -85,9 +85,9 @@ void FileNavigator::refresh() { filelist.refresh(); }
void FileNavigator::changeDIR(const char *folder) {
if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
currentfolderindex[folderdepth] = currentindex;
strcat(currentfoldername, folder);
strcat(currentfoldername, "/");
currentDirIndex[folderdepth] = currentindex;
strcat(currentDirPath, folder);
strcat(currentDirPath, "/");
filelist.changeDir(folder);
folderdepth++;
currentindex = 0;
@@ -97,15 +97,15 @@ void FileNavigator::upDIR() {
if (!filelist.isAtRootDir()) {
filelist.upDir();
folderdepth--;
currentindex = currentfolderindex[folderdepth]; // restore last position in the folder
currentindex = currentDirIndex[folderdepth]; // restore last position in the folder
filelist.seek(currentindex); // restore file information
}
// Remove the child folder from the stored path
if (folderdepth == 0)
currentfoldername[0] = '\0';
currentDirPath[0] = '\0';
else {
char * const pos = strchr(currentfoldername, '/');
char * const pos = strchr(currentDirPath, '/');
*(pos + 1) = '\0';
}
}
@@ -151,7 +151,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
// The new panel ignores entries that don't end in .GCO or .gcode so add and pad them.
if (paneltype <= AC_panel_new) {
TFTSer.println("<<.GCO");
Chiron.SendtoTFTLN(F(".. .gcode"));
chiron.tftSendLn(F(".. .gcode"));
}
else {
TFTSer.println("<<");
@@ -186,7 +186,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
}
else { // Not DIR
TFTSer.write('/');
if (folderdepth > 0) TFTSer.print(currentfoldername);
if (folderdepth > 0) TFTSer.print(currentDirPath);
TFTSer.println(filelist.shortFilename());
TFTSer.print(filelist.longFilename());
@@ -233,9 +233,9 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
void FileNavigator::sendFile(panel_type_t paneltype) {
TFTSer.write('/');
if (folderdepth > 0) TFTSer.print(currentfoldername);
if (folderdepth > 0) TFTSer.print(currentDirPath);
TFTSer.println(filelist.shortFilename());
if (folderdepth > 0) TFTSer.print(currentfoldername);
if (folderdepth > 0) TFTSer.print(currentDirPath);
TFTSer.println(filelist.longFilename());
}