🎨 Apply F() to some ExtUI functions

This commit is contained in:
Scott Lahteine
2021-09-25 22:11:48 -05:00
parent 7626d859a6
commit c3ae221a10
37 changed files with 277 additions and 278 deletions

View File

@ -83,46 +83,46 @@ void FileNavigator::getFiles(uint16_t index) {
#endif
if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder
nextion.SendtoTFT(PSTR("vis p0,1"));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"));
nextion.SendtoTFT(F("vis p0,1"));
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
SEND_VAL("tmpUP", "0");
files--;
}
else {
nextion.SendtoTFT(PSTR("vis p0,0"));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"));
nextion.SendtoTFT(F("vis p0,0"));
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
}
for (uint16_t seek = currentindex; seek < currentindex + files; seek++) {
if (filelist.seek(seek)) {
nextion.SendtoTFT(PSTR("s"));
nextion.SendtoTFT(F("s"));
LCD_SERIAL.print(fcnt);
nextion.SendtoTFT(PSTR(".txt=\""));
nextion.SendtoTFT(F(".txt=\""));
if (filelist.isDir()) {
LCD_SERIAL.print(filelist.shortFilename());
nextion.SendtoTFT(PSTR("/\""));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"));
nextion.SendtoTFT(F("/\""));
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
nextion.SendtoTFT(PSTR("l"));
nextion.SendtoTFT(F("l"));
LCD_SERIAL.print(fcnt);
nextion.SendtoTFT(PSTR(".txt=\""));
nextion.SendtoTFT(F(".txt=\""));
LCD_SERIAL.print(filelist.filename());
nextion.SendtoTFT(PSTR("\""));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"));
nextion.SendtoTFT(F("\""));
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
SEND_PCO2("l", fcnt, "1055");
}
else {
LCD_SERIAL.print(currentfoldername);
LCD_SERIAL.print(filelist.shortFilename());
nextion.SendtoTFT(PSTR("\""));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"));
nextion.SendtoTFT(F("\""));
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
nextion.SendtoTFT(PSTR("l"));
nextion.SendtoTFT(F("l"));
LCD_SERIAL.print(fcnt);
nextion.SendtoTFT(PSTR(".txt=\""));
nextion.SendtoTFT(F(".txt=\""));
LCD_SERIAL.print(filelist.longFilename());
nextion.SendtoTFT(PSTR("\""));
nextion.SendtoTFT(PSTR("\xFF\xFF\xFF"));
nextion.SendtoTFT(F("\""));
nextion.SendtoTFT(F("\xFF\xFF\xFF"));
}
fcnt++;
fseek = seek;

View File

@ -110,12 +110,12 @@ void NextionTFT::StatusChange(const char * const msg) {
SEND_VALasTXT("tmppage.M117", msg);
}
void NextionTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEM string to the panel
void NextionTFT::SendtoTFT(FSTR_P fstr) { // A helper to print PROGMEM string to the panel
#if NEXDEBUG(N_SOME)
DEBUG_ECHOPGM_P(str);
DEBUG_ECHOF(fstr);
#endif
while (const char c = pgm_read_byte(str++))
LCD_SERIAL.write(c);
PGM_P str = FTOP(fstr);
while (const char c = pgm_read_byte(str++)) LCD_SERIAL.write(c);
}
bool NextionTFT::ReadTFTCommand() {
@ -522,7 +522,7 @@ void NextionTFT::PanelAction(uint8_t req) {
case 66: // Refresh SD
if (!isPrinting()) {
injectCommands_P(PSTR("M21"));
injectCommands(F("M21"));
filenavigator.reset();
}
break;
@ -546,8 +546,8 @@ void NextionTFT::PanelAction(uint8_t req) {
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
if (canMove(getActiveTool())) {
switch (nextion_command[4]) {
case 'L': injectCommands_P(PSTR("M701")); break;
case 'U': injectCommands_P(PSTR("M702")); break;
case 'L': injectCommands(F("M701")); break;
case 'U': injectCommands(F("M702")); break;
}
}
else {

View File

@ -43,9 +43,9 @@ class NextionTFT {
static void Startup();
static void IdleLoop();
static void PrinterKilled(PGM_P, PGM_P);
static void ConfirmationRequest(const char * const );
static void StatusChange(const char * const );
static void SendtoTFT(PGM_P);
static void ConfirmationRequest(const char * const);
static void StatusChange(const char * const);
static void SendtoTFT(FSTR_P const);
static void UpdateOnChange();
static void PrintFinished();
static void PanelInfo(uint8_t);

View File

@ -54,10 +54,10 @@
// TFT panel commands
#define msg_welcome MACHINE_NAME " Ready."
#define SEND_TEMP(x,y,t,z) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(PSTR(t)), LCD_SERIAL.print(z), nextion.SendtoTFT(PSTR("\"\xFF\xFF\xFF")))
#define SEND_VAL(x,y) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".val=")), LCD_SERIAL.print(y), nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")))
#define SEND_TXT(x,y) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".txt=\"")), nextion.SendtoTFT(PSTR(y)), nextion.SendtoTFT(PSTR("\"\xFF\xFF\xFF")))
#define SEND_TXT_P(x,y) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".txt=\"")), nextion.SendtoTFT(y), nextion.SendtoTFT(PSTR("\"\xFF\xFF\xFF")))
#define SEND_VALasTXT(x,y) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(PSTR("\"\xFF\xFF\xFF")))
#define SEND_TXT_END(x) (nextion.SendtoTFT(PSTR(x)), nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")))
#define SEND_PCO2(x,y,z) (nextion.SendtoTFT(PSTR(x)), LCD_SERIAL.print(y), nextion.SendtoTFT(PSTR(".pco=")), nextion.SendtoTFT(PSTR(z)), nextion.SendtoTFT(PSTR("\xFF\xFF\xFF")))
#define SEND_TEMP(x,y,t,z) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F(t)), LCD_SERIAL.print(z), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
#define SEND_VAL(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".val=")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\xFF\xFF\xFF")))
#define SEND_TXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(F(y)), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
#define SEND_TXT_P(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
#define SEND_VALasTXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
#define SEND_TXT_END(x) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F("\xFF\xFF\xFF")))
#define SEND_PCO2(x,y,z) (nextion.SendtoTFT(F(x)), LCD_SERIAL.print(y), nextion.SendtoTFT(F(".pco=")), nextion.SendtoTFT(F(z)), nextion.SendtoTFT(F("\xFF\xFF\xFF")))