🎨 Apply F() to kill / sendinfoscreen
This commit is contained in:
		@@ -1852,7 +1852,7 @@ void DWIN_LoadSettings(const char *buff) {
 | 
			
		||||
  feedrate_percentage = 100;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MarlinUI::kill_screen(PGM_P lcd_error, PGM_P lcd_component) {
 | 
			
		||||
void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) {
 | 
			
		||||
  DWIN_Draw_Popup(ICON_BLTouch, lcd_error, lcd_component);
 | 
			
		||||
  DWIN_UpdateLCD();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -949,7 +949,7 @@ void CrealityDWINClass::Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MarlinUI::kill_screen(PGM_P const error, PGM_P const component) {
 | 
			
		||||
void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const) {
 | 
			
		||||
  CrealityDWIN.Draw_Popup(F("Printer Kill Reason:"), error, F("Restart Required"), Wait, ICON_BLTouch);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -41,8 +41,8 @@ namespace ExtUI {
 | 
			
		||||
 | 
			
		||||
  void onIdle() { Chiron.IdleLoop(); }
 | 
			
		||||
 | 
			
		||||
  void onPrinterKilled(PGM_P const error, PGM_P const component) {
 | 
			
		||||
    Chiron.PrinterKilled(error,component);
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
 | 
			
		||||
    Chiron.PrinterKilled(error, component);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void onMediaInserted() { Chiron.MediaEvent(AC_media_inserted); }
 | 
			
		||||
 
 | 
			
		||||
@@ -126,7 +126,7 @@ void ChironTFT::IdleLoop()  {
 | 
			
		||||
  CheckHeaters();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ChironTFT::PrinterKilled(PGM_P error,PGM_P component)  {
 | 
			
		||||
void ChironTFT::PrinterKilled(FSTR_P const error, FSTR_P const component)  {
 | 
			
		||||
  SendtoTFTLN(AC_msg_kill_lcd);
 | 
			
		||||
  #if ACDEBUG(AC_MARLIN)
 | 
			
		||||
    SERIAL_ECHOLNPGM("PrinterKilled()\nerror: ", error , "\ncomponent: ", component);
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ class ChironTFT {
 | 
			
		||||
  public:
 | 
			
		||||
    static void Startup();
 | 
			
		||||
    static void IdleLoop();
 | 
			
		||||
    static void PrinterKilled(PGM_P, PGM_P);
 | 
			
		||||
    static void PrinterKilled(FSTR_P, FSTR_P);
 | 
			
		||||
    static void MediaEvent(media_event_t);
 | 
			
		||||
    static void TimerEvent(timer_event_t);
 | 
			
		||||
    static void FilamentRunout();
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ namespace ExtUI {
 | 
			
		||||
 | 
			
		||||
  void onStartup()        { AnycubicTFT.OnSetup(); }
 | 
			
		||||
  void onIdle()           { AnycubicTFT.OnCommandScan(); }
 | 
			
		||||
  void onPrinterKilled(PGM_P const error, PGM_P const component) { AnycubicTFT.OnKillTFT(); }
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const component) { AnycubicTFT.OnKillTFT(); }
 | 
			
		||||
  void onMediaInserted()  { AnycubicTFT.OnSDCardStateChange(true); }
 | 
			
		||||
  void onMediaError()     { AnycubicTFT.OnSDCardError(); }
 | 
			
		||||
  void onMediaRemoved()   { AnycubicTFT.OnSDCardStateChange(false); }
 | 
			
		||||
 
 | 
			
		||||
@@ -654,7 +654,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
          case 12: // A12 kill
 | 
			
		||||
            kill(PSTR(STR_ERR_KILLED));
 | 
			
		||||
            kill(F(STR_ERR_KILLED));
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
          case 13: // A13 SELECTION FILE
 | 
			
		||||
 
 | 
			
		||||
@@ -340,7 +340,7 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
 | 
			
		||||
 | 
			
		||||
  void DGUSScreenHandler::SDCardError() {
 | 
			
		||||
    DGUSScreenHandler::SDCardRemoved();
 | 
			
		||||
    sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("SD card error"), nullptr, true, true, true, true);
 | 
			
		||||
    sendinfoscreen(F("NOTICE"), nullptr, F("SD card error"), nullptr, true, true, true, true);
 | 
			
		||||
    SetupConfirmAction(nullptr);
 | 
			
		||||
    GotoScreen(DGUSLCD_SCREEN_POPUP);
 | 
			
		||||
  }
 | 
			
		||||
@@ -567,7 +567,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
 | 
			
		||||
    if (buf[0]) queue.enqueue_one_now(buf);
 | 
			
		||||
 | 
			
		||||
    #if ENABLED(DGUS_UI_WAITING)
 | 
			
		||||
      sendinfoscreen(PSTR("PID is autotuning"), PSTR("please wait"), NUL_STR, NUL_STR, true, true, true, true);
 | 
			
		||||
      sendinfoscreen(F("PID is autotuning"), F("please wait"), NUL_STR, NUL_STR, true, true, true, true);
 | 
			
		||||
      GotoScreen(DGUSLCD_SCREEN_WAITING);
 | 
			
		||||
    #endif
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -42,8 +42,8 @@ namespace ExtUI {
 | 
			
		||||
 | 
			
		||||
  void onIdle() { ScreenHandler.loop(); }
 | 
			
		||||
 | 
			
		||||
  void onPrinterKilled(PGM_P const error, PGM_P const component) {
 | 
			
		||||
    ScreenHandler.sendinfoscreen(GET_TEXT(MSG_HALTED), error, NUL_STR, GET_TEXT(MSG_PLEASE_RESET), true, true, true, true);
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const) {
 | 
			
		||||
    ScreenHandler.sendinfoscreen(GET_TEXT_F(MSG_HALTED), error, FPSTR(NUL_STR), GET_TEXT_F(MSG_PLEASE_RESET), true, true, true, true);
 | 
			
		||||
    ScreenHandler.GotoScreen(DGUSLCD_SCREEN_KILL);
 | 
			
		||||
    while (!ScreenHandler.loop());  // Wait while anything is left to be sent
 | 
			
		||||
  }
 | 
			
		||||
@@ -60,7 +60,7 @@ namespace ExtUI {
 | 
			
		||||
 | 
			
		||||
  void onUserConfirmRequired(const char * const msg) {
 | 
			
		||||
    if (msg) {
 | 
			
		||||
      ScreenHandler.sendinfoscreen(PSTR("Please confirm."), nullptr, msg, nullptr, true, true, false, true);
 | 
			
		||||
      ScreenHandler.sendinfoscreen(F("Please confirm."), nullptr, msg, nullptr, true, true, false, true);
 | 
			
		||||
      ScreenHandler.SetupConfirmAction(setUserConfirmed);
 | 
			
		||||
      ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,12 @@ public:
 | 
			
		||||
  // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
 | 
			
		||||
  // The bools specifying whether the strings are in RAM or FLASH.
 | 
			
		||||
  static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
 | 
			
		||||
  static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
 | 
			
		||||
    sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
 | 
			
		||||
  }
 | 
			
		||||
  static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
 | 
			
		||||
    sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,12 @@ public:
 | 
			
		||||
  // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
 | 
			
		||||
  // The bools specifying whether the strings are in RAM or FLASH.
 | 
			
		||||
  static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
 | 
			
		||||
  static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
 | 
			
		||||
    sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
 | 
			
		||||
  }
 | 
			
		||||
  static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
 | 
			
		||||
    sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1233,7 +1233,7 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_
 | 
			
		||||
  #if BOTH(HAS_HOTEND, PREVENT_COLD_EXTRUSION)
 | 
			
		||||
    if (hotend_too_cold) {
 | 
			
		||||
      if (thermalManager.targetTooColdToExtrude(hotend_too_cold - 1)) thermalManager.setTargetHotend(thermalManager.extrude_min_temp, hotend_too_cold - 1);
 | 
			
		||||
      sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
 | 
			
		||||
      sendinfoscreen(F("NOTICE"), nullptr, F("Please wait."), F("Nozzle heating!"), true, true, true, true);
 | 
			
		||||
      SetupConfirmAction(nullptr);
 | 
			
		||||
      GotoScreen(DGUSLCD_SCREEN_POPUP);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1489,7 +1489,7 @@ void DGUSScreenHandler::DGUS_Runout_Idle(void) {
 | 
			
		||||
        queue.inject(F("M25"));
 | 
			
		||||
        GotoScreen(MKSLCD_SCREEN_PAUSE);
 | 
			
		||||
 | 
			
		||||
        sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please change filament!"), nullptr, true, true, true, true);
 | 
			
		||||
        sendinfoscreen(F("NOTICE"), nullptr, F("Please change filament!"), nullptr, true, true, true, true);
 | 
			
		||||
        //SetupConfirmAction(nullptr);
 | 
			
		||||
        GotoScreen(DGUSLCD_SCREEN_POPUP);
 | 
			
		||||
        break;
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,12 @@ public:
 | 
			
		||||
  // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
 | 
			
		||||
  // The bools specifying whether the strings are in RAM or FLASH.
 | 
			
		||||
  static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
 | 
			
		||||
  static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
 | 
			
		||||
    sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
 | 
			
		||||
  }
 | 
			
		||||
  static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
 | 
			
		||||
    sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,12 @@ public:
 | 
			
		||||
  // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
 | 
			
		||||
  // The bools specifying whether the strings are in RAM or FLASH.
 | 
			
		||||
  static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
 | 
			
		||||
  static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
 | 
			
		||||
    sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
 | 
			
		||||
  }
 | 
			
		||||
  static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
 | 
			
		||||
    sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -159,9 +159,9 @@ void DGUSScreenHandler::Loop() {
 | 
			
		||||
  dgus_display.Loop();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DGUSScreenHandler::PrinterKilled(PGM_P error, PGM_P component) {
 | 
			
		||||
  SetMessageLinePGM(error, 1);
 | 
			
		||||
  SetMessageLinePGM(component, 2);
 | 
			
		||||
void DGUSScreenHandler::PrinterKilled(FSTR_P const error, FSTR_P const component) {
 | 
			
		||||
  SetMessageLinePGM(FTOP(error), 1);
 | 
			
		||||
  SetMessageLinePGM(FTOP(component), 2);
 | 
			
		||||
  SetMessageLinePGM(NUL_STR, 3);
 | 
			
		||||
  SetMessageLinePGM(GET_TEXT(MSG_PLEASE_RESET), 4);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ public:
 | 
			
		||||
  static void Ready();
 | 
			
		||||
  static void Loop();
 | 
			
		||||
 | 
			
		||||
  static void PrinterKilled(PGM_P error, PGM_P component);
 | 
			
		||||
  static void PrinterKilled(FSTR_P const error, FSTR_P const component);
 | 
			
		||||
  static void UserConfirmRequired(const char * const msg);
 | 
			
		||||
  static void SettingsReset();
 | 
			
		||||
  static void StoreSettings(char *buff);
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ namespace ExtUI {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void onPrinterKilled(PGM_P error, PGM_P component) {
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
 | 
			
		||||
    dgus_screen_handler.PrinterKilled(error, component);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ namespace ExtUI {
 | 
			
		||||
     */
 | 
			
		||||
  }
 | 
			
		||||
  void onIdle() {}
 | 
			
		||||
  void onPrinterKilled(PGM_P const error, PGM_P const component) {}
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const component) {}
 | 
			
		||||
  void onMediaInserted() {}
 | 
			
		||||
  void onMediaError() {}
 | 
			
		||||
  void onMediaRemoved() {}
 | 
			
		||||
 
 | 
			
		||||
@@ -38,9 +38,9 @@ namespace ExtUI {
 | 
			
		||||
 | 
			
		||||
  void onIdle() { EventLoop::loop(); }
 | 
			
		||||
 | 
			
		||||
  void onPrinterKilled(PGM_P const error, PGM_P const component) {
 | 
			
		||||
    char str[strlen_P(error) + strlen_P(component) + 3];
 | 
			
		||||
    sprintf_P(str, PSTR(S_FMT ": " S_FMT), error, component);
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
 | 
			
		||||
    char str[strlen_P(FTOP(error)) + strlen_P(FTOP(component)) + 3];
 | 
			
		||||
    sprintf_P(str, PSTR(S_FMT ": " S_FMT), FTOP(error), FTOP(component));
 | 
			
		||||
    KillScreen::show(str);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -74,35 +74,36 @@ uint16_t inbound_count;
 | 
			
		||||
bool last_printing_status = false;
 | 
			
		||||
 | 
			
		||||
// Everything written needs the high bit set.
 | 
			
		||||
void write_to_lcd_P(PGM_P const message) {
 | 
			
		||||
void write_to_lcd(FSTR_P const fmsg) {
 | 
			
		||||
  PGM_P pmsg = FTOP(fmsg);
 | 
			
		||||
  char encoded_message[MAX_CURLY_COMMAND];
 | 
			
		||||
  uint8_t message_length = _MIN(strlen_P(message), sizeof(encoded_message));
 | 
			
		||||
  uint8_t message_length = _MIN(strlen_P(pmsg), sizeof(encoded_message));
 | 
			
		||||
 | 
			
		||||
  LOOP_L_N(i, message_length)
 | 
			
		||||
    encoded_message[i] = pgm_read_byte(&message[i]) | 0x80;
 | 
			
		||||
    encoded_message[i] = pgm_read_byte(&pmsg[i]) | 0x80;
 | 
			
		||||
 | 
			
		||||
  LCD_SERIAL.Print::write(encoded_message, message_length);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void write_to_lcd(const char * const message) {
 | 
			
		||||
void write_to_lcd(const char * const cmsg) {
 | 
			
		||||
  char encoded_message[MAX_CURLY_COMMAND];
 | 
			
		||||
  const uint8_t message_length = _MIN(strlen(message), sizeof(encoded_message));
 | 
			
		||||
  const uint8_t message_length = _MIN(strlen(cmsg), sizeof(encoded_message));
 | 
			
		||||
 | 
			
		||||
  LOOP_L_N(i, message_length)
 | 
			
		||||
    encoded_message[i] = message[i] | 0x80;
 | 
			
		||||
    encoded_message[i] = cmsg[i] | 0x80;
 | 
			
		||||
 | 
			
		||||
  LCD_SERIAL.Print::write(encoded_message, message_length);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// {E:<msg>} is for error states.
 | 
			
		||||
void set_lcd_error_P(PGM_P const error, PGM_P const component/*=nullptr*/) {
 | 
			
		||||
  write_to_lcd_P(PSTR("{E:"));
 | 
			
		||||
  write_to_lcd_P(error);
 | 
			
		||||
void set_lcd_error(FSTR_P const error, FSTR_P const component/*=nullptr*/) {
 | 
			
		||||
  write_to_lcd(F("{E:"));
 | 
			
		||||
  write_to_lcd(error);
 | 
			
		||||
  if (component) {
 | 
			
		||||
    write_to_lcd_P(PSTR(" "));
 | 
			
		||||
    write_to_lcd_P(component);
 | 
			
		||||
    write_to_lcd(F(" "));
 | 
			
		||||
    write_to_lcd(component);
 | 
			
		||||
  }
 | 
			
		||||
  write_to_lcd_P(PSTR("}"));
 | 
			
		||||
  write_to_lcd(F("}"));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -243,16 +244,16 @@ void process_lcd_p_command(const char *command) {
 | 
			
		||||
  switch (command[0]) {
 | 
			
		||||
    case 'P':
 | 
			
		||||
        ExtUI::pausePrint();
 | 
			
		||||
        write_to_lcd_P(PSTR("{SYS:PAUSED}"));
 | 
			
		||||
        write_to_lcd(F("{SYS:PAUSED}"));
 | 
			
		||||
        break;
 | 
			
		||||
    case 'R':
 | 
			
		||||
        ExtUI::resumePrint();
 | 
			
		||||
        write_to_lcd_P(PSTR("{SYS:RESUMED}"));
 | 
			
		||||
        write_to_lcd(F("{SYS:RESUMED}"));
 | 
			
		||||
        break;
 | 
			
		||||
    case 'X':
 | 
			
		||||
        write_to_lcd_P(PSTR("{SYS:CANCELING}"));
 | 
			
		||||
        write_to_lcd(F("{SYS:CANCELING}"));
 | 
			
		||||
        ExtUI::stopPrint();
 | 
			
		||||
        write_to_lcd_P(PSTR("{SYS:STARTED}"));
 | 
			
		||||
        write_to_lcd(F("{SYS:STARTED}"));
 | 
			
		||||
        break;
 | 
			
		||||
    case 'H': queue.enqueue_now_P(G28_STR); break; // Home all axes
 | 
			
		||||
    default: {
 | 
			
		||||
@@ -271,13 +272,13 @@ void process_lcd_p_command(const char *command) {
 | 
			
		||||
        // but the V2 LCD switches to "print" mode on {SYS:DIR} response.
 | 
			
		||||
        if (card.flag.filenameIsDir) {
 | 
			
		||||
          card.cd(card.filename);
 | 
			
		||||
          write_to_lcd_P(PSTR("{SYS:DIR}"));
 | 
			
		||||
          write_to_lcd(F("{SYS:DIR}"));
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
          char message_buffer[MAX_CURLY_COMMAND];
 | 
			
		||||
          sprintf_P(message_buffer, PSTR("{PRINTFILE:%s}"), card.longest_filename());
 | 
			
		||||
          write_to_lcd(message_buffer);
 | 
			
		||||
          write_to_lcd_P(PSTR("{SYS:BUILD}"));
 | 
			
		||||
          write_to_lcd(F("{SYS:BUILD}"));
 | 
			
		||||
          card.openAndPrintFile(card.filename);
 | 
			
		||||
        }
 | 
			
		||||
      #endif
 | 
			
		||||
@@ -332,7 +333,7 @@ void process_lcd_s_command(const char *command) {
 | 
			
		||||
          write_to_lcd(message_buffer);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        write_to_lcd_P(PSTR("{SYS:OK}"));
 | 
			
		||||
        write_to_lcd(F("{SYS:OK}"));
 | 
			
		||||
      #endif
 | 
			
		||||
    } break;
 | 
			
		||||
 | 
			
		||||
@@ -413,7 +414,7 @@ void update_usb_status(const bool forceUpdate) {
 | 
			
		||||
  // This is more logical.
 | 
			
		||||
  if (last_usb_connected_status != MYSERIAL1.connected() || forceUpdate) {
 | 
			
		||||
    last_usb_connected_status = MYSERIAL1.connected();
 | 
			
		||||
    write_to_lcd_P(last_usb_connected_status ? PSTR("{R:UC}\r\n") : PSTR("{R:UD}\r\n"));
 | 
			
		||||
    write_to_lcd(last_usb_connected_status ? F("{R:UC}\r\n") : F("{R:UD}\r\n"));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,10 +33,10 @@ extern uint16_t inbound_count;
 | 
			
		||||
// For sending print completion messages
 | 
			
		||||
extern bool last_printing_status;
 | 
			
		||||
 | 
			
		||||
void write_to_lcd_P(PGM_P const message);
 | 
			
		||||
void write_to_lcd(const char * const message);
 | 
			
		||||
void write_to_lcd(FSTR_P const fmsg);
 | 
			
		||||
void write_to_lcd(const char * const cmsg);
 | 
			
		||||
 | 
			
		||||
void set_lcd_error_P(PGM_P const error, PGM_P const component=nullptr);
 | 
			
		||||
void set_lcd_error(FSTR_P const error, FSTR_P const component=nullptr);
 | 
			
		||||
 | 
			
		||||
void process_lcd_c_command(const char *command);
 | 
			
		||||
void process_lcd_eb_command(const char *command);
 | 
			
		||||
 
 | 
			
		||||
@@ -55,13 +55,13 @@ namespace ExtUI {
 | 
			
		||||
    LCD_SERIAL.begin(LCD_BAUDRATE);
 | 
			
		||||
 | 
			
		||||
    // Signal init
 | 
			
		||||
    write_to_lcd_P(PSTR("{SYS:STARTED}\r\n"));
 | 
			
		||||
    write_to_lcd(F("{SYS:STARTED}\r\n"));
 | 
			
		||||
 | 
			
		||||
    // send a version that says "unsupported"
 | 
			
		||||
    write_to_lcd_P(PSTR("{VER:99}\r\n"));
 | 
			
		||||
    write_to_lcd(F("{VER:99}\r\n"));
 | 
			
		||||
 | 
			
		||||
    // No idea why it does this twice.
 | 
			
		||||
    write_to_lcd_P(PSTR("{SYS:STARTED}\r\n"));
 | 
			
		||||
    write_to_lcd(F("{SYS:STARTED}\r\n"));
 | 
			
		||||
    update_usb_status(true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -98,8 +98,8 @@ namespace ExtUI {
 | 
			
		||||
    #endif
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void onPrinterKilled(PGM_P const error, PGM_P const component) {
 | 
			
		||||
    set_lcd_error_P(error, component);
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
 | 
			
		||||
    set_lcd_error(error, component);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  #if HAS_PID_HEATING
 | 
			
		||||
@@ -109,28 +109,28 @@ namespace ExtUI {
 | 
			
		||||
      //SERIAL_ECHOLNPGM("OnPidTuning:", rst);
 | 
			
		||||
      switch (rst) {
 | 
			
		||||
        case PID_STARTED:
 | 
			
		||||
          set_lcd_error_P(GET_TEXT(MSG_PID_AUTOTUNE));
 | 
			
		||||
          set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE));
 | 
			
		||||
          break;
 | 
			
		||||
        case PID_BAD_EXTRUDER_NUM:
 | 
			
		||||
          set_lcd_error_P(GET_TEXT(MSG_PID_BAD_EXTRUDER_NUM));
 | 
			
		||||
          set_lcd_error(GET_TEXT_F(MSG_PID_BAD_EXTRUDER_NUM));
 | 
			
		||||
          break;
 | 
			
		||||
        case PID_TEMP_TOO_HIGH:
 | 
			
		||||
          set_lcd_error_P(GET_TEXT(MSG_PID_TEMP_TOO_HIGH));
 | 
			
		||||
          set_lcd_error(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH));
 | 
			
		||||
          break;
 | 
			
		||||
        case PID_TUNING_TIMEOUT:
 | 
			
		||||
          set_lcd_error_P(GET_TEXT(MSG_PID_TIMEOUT));
 | 
			
		||||
          set_lcd_error(GET_TEXT_F(MSG_PID_TIMEOUT));
 | 
			
		||||
          break;
 | 
			
		||||
        case PID_DONE:
 | 
			
		||||
          set_lcd_error_P(GET_TEXT(MSG_PID_AUTOTUNE_DONE));
 | 
			
		||||
          set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE));
 | 
			
		||||
          break;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  void onPrintTimerStarted() { write_to_lcd_P(PSTR("{SYS:BUILD}")); }
 | 
			
		||||
  void onPrintTimerStarted() { write_to_lcd(F("{SYS:BUILD}")); }
 | 
			
		||||
  void onPrintTimerPaused() {}
 | 
			
		||||
  void onPrintTimerStopped() { write_to_lcd_P(PSTR("{TQ:100}")); }
 | 
			
		||||
  void onPrintTimerStopped() { write_to_lcd(F("{TQ:100}")); }
 | 
			
		||||
 | 
			
		||||
  // Not needed for Malyan LCD
 | 
			
		||||
  void onStatusChanged(const char * const) {}
 | 
			
		||||
 
 | 
			
		||||
@@ -2030,7 +2030,7 @@ void get_wifi_commands() {
 | 
			
		||||
            wait_for_heatup = false;
 | 
			
		||||
            TERN_(HAS_LCD_MENU, wait_for_user = false);
 | 
			
		||||
          }
 | 
			
		||||
          if (strcmp(command, "M112") == 0) kill(M112_KILL_STR, nullptr, true);
 | 
			
		||||
          if (strcmp(command, "M112") == 0) kill(FPSTR(M112_KILL_STR), nullptr, true);
 | 
			
		||||
          if (strcmp(command, "M410") == 0) quickstop_stepper();
 | 
			
		||||
        #endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ namespace ExtUI {
 | 
			
		||||
 | 
			
		||||
  void onStartup()                                   { nextion.Startup();  }
 | 
			
		||||
  void onIdle()                                      { nextion.IdleLoop(); }
 | 
			
		||||
  void onPrinterKilled(PGM_P const error, PGM_P const component) { nextion.PrinterKilled(error,component); }
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.PrinterKilled(error, component); }
 | 
			
		||||
  void onMediaInserted() {}
 | 
			
		||||
  void onMediaError()    {}
 | 
			
		||||
  void onMediaRemoved()  {}
 | 
			
		||||
 
 | 
			
		||||
@@ -84,12 +84,12 @@ void NextionTFT::IdleLoop() {
 | 
			
		||||
  UpdateOnChange();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void NextionTFT::PrinterKilled(PGM_P error, PGM_P component) {
 | 
			
		||||
void NextionTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) {
 | 
			
		||||
  SEND_TXT_END("page error");
 | 
			
		||||
  SEND_TXT("t3", "Error");
 | 
			
		||||
  SEND_TXT_P("t4", component);
 | 
			
		||||
  SEND_TXT_P("t5", error);
 | 
			
		||||
  SEND_TXT("t6", "Need reset");
 | 
			
		||||
  SEND_TXT_F("t3", F("Error"));
 | 
			
		||||
  SEND_TXT_F("t4", component);
 | 
			
		||||
  SEND_TXT_F("t5", error);
 | 
			
		||||
  SEND_TXT_F("t6", F("Need reset"));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void NextionTFT::PrintFinished() {
 | 
			
		||||
 
 | 
			
		||||
@@ -56,8 +56,8 @@
 | 
			
		||||
 | 
			
		||||
#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_TXT(x,y)       (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(F(y)), nextion.SendtoTFT(F("\"\xFF\xFF\xFF")))
 | 
			
		||||
#define SEND_TXT_F(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")))
 | 
			
		||||
 
 | 
			
		||||
@@ -1077,6 +1077,7 @@ namespace ExtUI {
 | 
			
		||||
  void resumePrint() { ui.resume_print(); }
 | 
			
		||||
  void stopPrint()   { ui.abort_print(); }
 | 
			
		||||
 | 
			
		||||
  // Simplest approach is to make an SRAM copy
 | 
			
		||||
  void onUserConfirmRequired(FSTR_P const fstr) {
 | 
			
		||||
    char msg[strlen_P(FTOP(fstr)) + 1];
 | 
			
		||||
    strcpy_P(msg, FTOP(fstr));
 | 
			
		||||
@@ -1153,7 +1154,7 @@ void MarlinUI::init() { ExtUI::onStartup(); }
 | 
			
		||||
 | 
			
		||||
void MarlinUI::update() { ExtUI::onIdle(); }
 | 
			
		||||
 | 
			
		||||
void MarlinUI::kill_screen(PGM_P const error, PGM_P const component) {
 | 
			
		||||
void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const component) {
 | 
			
		||||
  using namespace ExtUI;
 | 
			
		||||
  if (!flags.printer_killed) {
 | 
			
		||||
    flags.printer_killed = true;
 | 
			
		||||
 
 | 
			
		||||
@@ -394,7 +394,7 @@ namespace ExtUI {
 | 
			
		||||
  void onMediaError();
 | 
			
		||||
  void onMediaRemoved();
 | 
			
		||||
  void onPlayTone(const uint16_t frequency, const uint16_t duration);
 | 
			
		||||
  void onPrinterKilled(PGM_P const error, PGM_P const component);
 | 
			
		||||
  void onPrinterKilled(FSTR_P const error, FSTR_P const component);
 | 
			
		||||
  void onPrintTimerStarted();
 | 
			
		||||
  void onPrintTimerPaused();
 | 
			
		||||
  void onPrintTimerStopped();
 | 
			
		||||
 
 | 
			
		||||
@@ -663,9 +663,9 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
    draw_status_screen();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void MarlinUI::kill_screen(PGM_P lcd_error, PGM_P lcd_component) {
 | 
			
		||||
  void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) {
 | 
			
		||||
    init();
 | 
			
		||||
    status_printf(1, F(S_FMT ": " S_FMT), lcd_error, lcd_component);
 | 
			
		||||
    status_printf(1, F(S_FMT ": " S_FMT), FTOP(lcd_error), FTOP(lcd_component));
 | 
			
		||||
    TERN_(HAS_LCD_MENU, return_to_status());
 | 
			
		||||
 | 
			
		||||
    // RED ALERT. RED ALERT.
 | 
			
		||||
 
 | 
			
		||||
@@ -356,9 +356,9 @@ public:
 | 
			
		||||
  static void status_printf(const uint8_t level, FSTR_P const fmt, ...);
 | 
			
		||||
 | 
			
		||||
  #if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED)
 | 
			
		||||
    static void kill_screen(PGM_P const lcd_error, PGM_P const lcd_component);
 | 
			
		||||
    static void kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component);
 | 
			
		||||
  #else
 | 
			
		||||
    static inline void kill_screen(PGM_P const, PGM_P const) {}
 | 
			
		||||
    static inline void kill_screen(FSTR_P const, FSTR_P const) {}
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if HAS_DISPLAY
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user