diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index 8c22825e7..fb7bbc1a2 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -1039,4 +1039,17 @@ bool CardReader::ToshibaFlashAir_GetIP(uint8_t *ip) return card.readExtMemory(1, 1, 0x400+0x150, 4, ip); } +//Used for Reprint action +bool CardReader::FileExists(const char* filename) +{ + bool exists = false; + + if (file.open(curDir, filename, O_READ)) + { + exists = true; + file.close(); + } + return exists; +} + #endif //SDSUPPORT diff --git a/Firmware/cardreader.h b/Firmware/cardreader.h index 9fb3f0b4f..7bc402e94 100644 --- a/Firmware/cardreader.h +++ b/Firmware/cardreader.h @@ -83,6 +83,9 @@ public: bool ToshibaFlashAir_isEnabled() const { return card.getFlashAirCompatible(); } void ToshibaFlashAir_enable(bool enable) { card.setFlashAirCompatible(enable); } bool ToshibaFlashAir_GetIP(uint8_t *ip); + + //Reprint + bool FileExists(const char* filename); public: bool saving; diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index 73e2b830c..b03d5d468 100755 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -657,6 +657,7 @@ void get_command() // queue is complete, but before we process EOF commands prevent // re-entry by disabling SD processing from any st_synchronize call card.closefile(); + enableReprint=true; SERIAL_PROTOCOLLNRPGM(_n("Done printing file"));////MSG_FILE_PRINTED char time[30]; diff --git a/Firmware/messages.cpp b/Firmware/messages.cpp index 3ccd0f861..651646bba 100644 --- a/Firmware/messages.cpp +++ b/Firmware/messages.cpp @@ -190,7 +190,7 @@ extern const char MSG_LOAD_ALL[] PROGMEM_I1 = ISTR("Load All"); ////MSG_LOAD_ALL extern const char MSG_NOZZLE_CNG_MENU [] PROGMEM_I1 = ISTR("Nozzle change");////MSG_NOZZLE_CNG_MENU c=18 extern const char MSG_NOZZLE_CNG_READ_HELP [] PROGMEM_I1 = ISTR("For a Nozzle change please read\nprusa.io/nozzle-mk3s");////MSG_NOZZLE_CNG_READ_HELP c=20 r=4 extern const char MSG_NOZZLE_CNG_CHANGED [] PROGMEM_I1 = ISTR("Hotend at 280C! Nozzle changed and tightened to specs?");////MSG_NOZZLE_CNG_CHANGED c=20 r=6 - +extern const char MSG_REPRINT [] PROGMEM_I1 = ISTR("Reprint"); ////MSG_REPRINT c=7 //not internationalized messages #if 0 const char MSG_FW_VERSION_BETA[] PROGMEM_N1 = "You are using a BETA firmware version! It is in a development state! Use this version with CAUTION as it may DAMAGE the printer!"; ////MSG_FW_VERSION_BETA c=20 r=8 diff --git a/Firmware/messages.h b/Firmware/messages.h index 68ac51b0e..3a070d1c5 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -191,6 +191,7 @@ extern const char MSG_LOAD_ALL[]; extern const char MSG_NOZZLE_CNG_MENU []; extern const char MSG_NOZZLE_CNG_READ_HELP []; extern const char MSG_NOZZLE_CNG_CHANGED []; +extern const char MSG_REPRINT []; //not internationalized messages #if 0 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 9162a4cc4..a495b38f2 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -255,6 +255,8 @@ uint8_t selected_sheet = 0; bool bMain; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function +//action: Reprint +bool enableReprint = false; static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* longFilename) { uint8_t len = LCD_WIDTH - 1; @@ -5193,6 +5195,14 @@ static void lcd_main_menu() MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_); #endif //TMC2130_DEBUG + // Menu item for reprint + if(!printer_active() && enableReprint && card.cardOK) + { + MENU_ITEM_SUBMENU_P(_T(MSG_REPRINT), reprint_from_eeprom); + }else if (!card.cardOK) + { + enableReprint = false; + } // Menu is never shown when idle if (babystep_allowed_strict() && (printJobOngoing() || lcd_commands_type == LcdCommands::Layer1Cal)) MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 @@ -7454,3 +7464,52 @@ void lcd_heat_bed_on_load_toggle() value = !value; eeprom_update_byte((uint8_t*)EEPROM_HEAT_BED_ON_LOAD_FILAMENT, value); } + +void reprint_from_eeprom() { + char cmd[30]; + char filename[13]; + char altfilename[13]; + uint8_t depth = 0; + char dir_name[9]; + + enableReprint=false; + + //cmdqueue_reset(); + + depth = eeprom_read_byte((uint8_t*)EEPROM_DIR_DEPTH); + + MYSERIAL.println(int(depth)); + for (int i = 0; i < depth; i++) { + for (int j = 0; j < 8; j++) { + dir_name[j] = eeprom_read_byte((uint8_t*)EEPROM_DIRS + j + 8 * i); + } + dir_name[8] = '\0'; + MYSERIAL.println(dir_name); + // strcpy(dir_names[i], dir_name); + card.chdir(dir_name, false); + } + + for (int i = 0; i < 8; i++) { + filename[i] = eeprom_read_byte((uint8_t*)EEPROM_FILENAME + i); + } + filename[8] = '\0'; + + strcpy(altfilename,filename); + if (!card.FileExists(altfilename)) + { + strcat_P(filename, PSTR(".gco")); + if (card.FileExists(filename)) + { + strcpy(altfilename,filename); + }else + { + strcat_P(altfilename, PSTR(".g")); + } + } + MYSERIAL.print(altfilename); + sprintf_P(cmd, PSTR("M23 %s"), altfilename); + enquecommand(cmd); + sprintf_P(cmd, PSTR("M24")); + enquecommand(cmd); + lcd_return_to_status(); +} diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index e8d3bb8ab..2129a7b80 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -19,6 +19,10 @@ void ultralcd_init(); #define LCD_STATUS_INFO_TIMEOUT 20000 #define LCD_STATUS_DELAYED_TIMEOUT 4000 +// Reprint +void reprint_from_eeprom(); +extern bool enableReprint; + // Set the current status message (equivalent to LCD_STATUS_NONE) void lcdui_print_status_line(void); void lcd_clearstatus(); diff --git a/lang/po/Firmware.pot b/lang/po/Firmware.pot index e2022d02e..42b8ec6a9 100644 --- a/lang/po/Firmware.pot +++ b/lang/po/Firmware.pot @@ -2470,3 +2470,7 @@ msgstr "" #. MSG_FW_MK3_DETECTED c=20 r=4 msgid "MK3 firmware detected on MK3S printer" msgstr "" + +#. MSG_REPRINT c=7 +msgid "Reprint" +msgstr "" diff --git a/lang/po/Firmware_cs.po b/lang/po/Firmware_cs.po index da20ea331..5d7d73192 100644 --- a/lang/po/Firmware_cs.po +++ b/lang/po/Firmware_cs.po @@ -2565,6 +2565,11 @@ msgstr "Připravit" msgid "Set not Ready" msgstr "Zrušit Připravena" +#. MSG_REPRINT c=7 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Reprint" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Vyjmete stary filament a stisknete tlacitko pro zavedeni noveho." diff --git a/lang/po/Firmware_de.po b/lang/po/Firmware_de.po index 8fba007ba..f82cb32d6 100644 --- a/lang/po/Firmware_de.po +++ b/lang/po/Firmware_de.po @@ -2593,6 +2593,11 @@ msgstr "Bereit setzen" msgid "Set not Ready" msgstr "Nicht breit setzen" +#. MSG_REPRINT c=7 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Abdruck" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Entferne das alte Fil. und drücke den Knopf, um das neue zu laden." diff --git a/lang/po/Firmware_es.po b/lang/po/Firmware_es.po index bec603784..fa8930cb5 100644 --- a/lang/po/Firmware_es.po +++ b/lang/po/Firmware_es.po @@ -2588,6 +2588,11 @@ msgstr "Listo" msgid "Set not Ready" msgstr "Conjunto no listo" +#. MSG_REPRINT c=10 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Reimprimir" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "" #~ "Retira el fil. viejo y presiona el dial para comenzar a cargar el nuevo." diff --git a/lang/po/Firmware_fr.po b/lang/po/Firmware_fr.po index 35694d7e1..103e87696 100644 --- a/lang/po/Firmware_fr.po +++ b/lang/po/Firmware_fr.po @@ -2600,6 +2600,11 @@ msgstr "Ensemble prête" msgid "Set not Ready" msgstr "Ensemble pas prête" +#. MSG_REPRINT c=13 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Réimpresision" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "" #~ "Retirez l'ancien fil. puis appuyez sur le bouton pour charger le nouveau." diff --git a/lang/po/Firmware_hr.po b/lang/po/Firmware_hr.po index 9c01f8265..233dfae5e 100644 --- a/lang/po/Firmware_hr.po +++ b/lang/po/Firmware_hr.po @@ -2582,6 +2582,11 @@ msgstr "Set spreman" msgid "Set not Ready" msgstr "Set nije spreman" +#. MSG_REPRINT c=8 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Pretisak" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Uklonite stari fil. i pritisnite gumb za pocetak stavljanja novog." diff --git a/lang/po/Firmware_hu.po b/lang/po/Firmware_hu.po index 10a9364f5..369a82174 100644 --- a/lang/po/Firmware_hu.po +++ b/lang/po/Firmware_hu.po @@ -2587,6 +2587,11 @@ msgstr "Készen áll" msgid "Set not Ready" msgstr "Készen nem áll" +#. MSG_REPRINT c=7 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Reprint" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Vedd ki a regi fil., majd nyomd meg a gombot az uj fil. betoltesehez." diff --git a/lang/po/Firmware_it.po b/lang/po/Firmware_it.po index fa11013a6..d080a3f51 100644 --- a/lang/po/Firmware_it.po +++ b/lang/po/Firmware_it.po @@ -2588,6 +2588,11 @@ msgstr "Imposta pronta" msgid "Set not Ready" msgstr "Imposta non pronta" +#. MSG_REPRINT c=10 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Ristampare" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Rimuovi il fil. precedente e premi la manopola per caricare il nuovo." diff --git a/lang/po/Firmware_nl.po b/lang/po/Firmware_nl.po index 1e924344e..8370d65dd 100644 --- a/lang/po/Firmware_nl.po +++ b/lang/po/Firmware_nl.po @@ -2590,6 +2590,11 @@ msgstr "Gereed zetten" msgid "Set not Ready" msgstr "Niet gereed zetten" +#. MSG_REPRINT c=7 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Reprint" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "" #~ "Verwijder de oude filament en druk op de knop om nieuwe filament te laden." diff --git a/lang/po/Firmware_no.po b/lang/po/Firmware_no.po index 5f296169f..069c0424d 100644 --- a/lang/po/Firmware_no.po +++ b/lang/po/Firmware_no.po @@ -2564,6 +2564,11 @@ msgstr "Gjør klar" msgid "Set not Ready" msgstr "Sett ikke klar" +#. MSG_REPRINT c=8 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Opptrykk" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Ta bort det gamle filamentet og trykk valghjulet for å laste et nytt." diff --git a/lang/po/Firmware_pl.po b/lang/po/Firmware_pl.po index afae99a12..ff502eec3 100644 --- a/lang/po/Firmware_pl.po +++ b/lang/po/Firmware_pl.po @@ -2580,6 +2580,11 @@ msgstr "Ustaw gotowość" msgid "Set not Ready" msgstr "Cofnij gotowość" +#. MSG_REPRINT c=7 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Przedruk" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Wyciągnij poprzedni filament i naciśnij pokrętło aby załadować nowy." diff --git a/lang/po/Firmware_ro.po b/lang/po/Firmware_ro.po index 5aa39b91c..18847a60c 100644 --- a/lang/po/Firmware_ro.po +++ b/lang/po/Firmware_ro.po @@ -2589,6 +2589,11 @@ msgstr "Printer pregătit" msgid "Set not Ready" msgstr "Print. nu pregătit" +#. MSG_REPRINT c=10 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Retiparire" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Scoateți fil. vechi și apăsați butonul pentru a încărca unul nou." diff --git a/lang/po/Firmware_sk.po b/lang/po/Firmware_sk.po index 0a8e10b83..535db01c6 100644 --- a/lang/po/Firmware_sk.po +++ b/lang/po/Firmware_sk.po @@ -2570,6 +2570,11 @@ msgstr "Pripravené" msgid "Set not Ready" msgstr "Nie je pripravené" +#. MSG_REPRINT c=6 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Dotlac" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Vyberte starý filament a stlačte tlačidlo pre zavedenie nového." diff --git a/lang/po/Firmware_sv.po b/lang/po/Firmware_sv.po index 6cc7bd6c9..c8dd04791 100644 --- a/lang/po/Firmware_sv.po +++ b/lang/po/Firmware_sv.po @@ -2577,6 +2577,11 @@ msgstr "Gör klar" msgid "Set not Ready" msgstr "Set inte klart" +#. MSG_REPRINT c=7 +#: ../../Firmware/ultralcd.cpp:5189 +msgid "Reprint" +msgstr "Omtryck" + #~ msgid "Remove old filament and press the knob to start loading new filament." #~ msgstr "Ta bort det gamla fil. och tryck på knappen för att börja ladda nytt."