Merge remote-tracking branch 'upstream/MK3' into MK3-new_lang
This commit is contained in:
commit
a1ea5019dc
5
.gitignore
vendored
5
.gitignore
vendored
@ -4,3 +4,8 @@
|
||||
Debug
|
||||
Firmware/Configuration_prusa.h
|
||||
Firmware/Doc
|
||||
/Firmware/.vs/Firmware/v14
|
||||
/Firmware/__vm
|
||||
/Firmware/Firmware.sln
|
||||
/Firmware/Firmware.vcxproj
|
||||
/Firmware/Firmware.vcxproj.filters
|
||||
|
@ -178,6 +178,8 @@
|
||||
#define EEPROM_EXTRUDER_MULTIPLIER_0 (EEPROM_BOARD_TYPE - 4) //float
|
||||
#define EEPROM_EXTRUDER_MULTIPLIER_1 (EEPROM_EXTRUDER_MULTIPLIER_0 - 4) //float
|
||||
#define EEPROM_EXTRUDER_MULTIPLIER_2 (EEPROM_EXTRUDER_MULTIPLIER_1 - 4) //float
|
||||
#define EEPROM_EXTRUDEMULTIPLY (EEPROM_EXTRUDER_MULTIPLIER_2 - 2) // uint16
|
||||
|
||||
|
||||
//TMC2130 configuration
|
||||
#define EEPROM_TMC_AXIS_SIZE //axis configuration block size
|
||||
|
@ -350,6 +350,15 @@ extern char dir_names[3][9];
|
||||
// save/restore printing
|
||||
extern bool saved_printing;
|
||||
|
||||
//estimated time to end of the print
|
||||
extern uint8_t print_percent_done_normal;
|
||||
extern uint16_t print_time_remaining_normal;
|
||||
extern uint8_t print_percent_done_silent;
|
||||
extern uint16_t print_time_remaining_silent;
|
||||
#define PRINT_TIME_REMAINING_INIT 65535
|
||||
#define PRINT_PERCENT_DONE_INIT 255
|
||||
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == 4) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL))
|
||||
|
||||
extern void calculate_extruder_multipliers();
|
||||
|
||||
// Similar to the default Arduino delay function,
|
||||
@ -402,6 +411,11 @@ extern void print_mesh_bed_leveling_table();
|
||||
extern void fsensor_init();
|
||||
#endif //PAT9125
|
||||
|
||||
//estimated time to end of the print
|
||||
extern uint16_t print_time_remaining();
|
||||
extern uint8_t print_percent_done();
|
||||
static void print_time_remaining_init();
|
||||
|
||||
#ifdef HOST_KEEPALIVE_FEATURE
|
||||
|
||||
// States for managing Marlin and host communication
|
||||
|
@ -186,6 +186,7 @@
|
||||
// Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
|
||||
// The '#' is necessary when calling from within sd files, as it stops buffer prereading
|
||||
// M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
|
||||
// M73 - Show percent done and print time remaining
|
||||
// M80 - Turn on Power Supply
|
||||
// M81 - Turn off Power Supply
|
||||
// M82 - Set E codes absolute (default)
|
||||
@ -323,6 +324,7 @@ unsigned long pause_time = 0;
|
||||
unsigned long start_pause_print = millis();
|
||||
unsigned long t_fan_rising_edge = millis();
|
||||
static LongTimer safetyTimer;
|
||||
static LongTimer crashDetTimer;
|
||||
|
||||
//unsigned long load_filament_time;
|
||||
|
||||
@ -448,6 +450,11 @@ uint8_t saved_filament_type;
|
||||
// save/restore printing
|
||||
bool saved_printing = false;
|
||||
|
||||
// storing estimated time to end of print counted by slicer
|
||||
uint8_t print_percent_done_normal = PRINT_PERCENT_DONE_INIT;
|
||||
uint16_t print_time_remaining_normal = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes
|
||||
uint8_t print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
|
||||
uint16_t print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes
|
||||
|
||||
//===========================================================================
|
||||
//=============================Private Variables=============================
|
||||
@ -677,6 +684,25 @@ void crashdet_detected(uint8_t mask)
|
||||
cmdqueue_pop_front();
|
||||
}*/
|
||||
st_synchronize();
|
||||
static uint8_t crashDet_counter = 0;
|
||||
bool automatic_recovery_after_crash = true;
|
||||
bool yesno;
|
||||
|
||||
if (crashDet_counter++ == 0) {
|
||||
crashDetTimer.start();
|
||||
}
|
||||
else if (crashDetTimer.expired(CRASHDET_TIMER * 1000ul)){
|
||||
crashDetTimer.stop();
|
||||
crashDet_counter = 0;
|
||||
}
|
||||
else if(crashDet_counter == CRASHDET_COUNTER_MAX){
|
||||
automatic_recovery_after_crash = false;
|
||||
crashDetTimer.stop();
|
||||
crashDet_counter = 0;
|
||||
}
|
||||
else {
|
||||
crashDetTimer.start();
|
||||
}
|
||||
|
||||
lcd_update_enable(true);
|
||||
lcd_implementation_clear();
|
||||
@ -693,17 +719,21 @@ void crashdet_detected(uint8_t mask)
|
||||
eeprom_update_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT, eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) + 1);
|
||||
}
|
||||
|
||||
#ifdef AUTOMATIC_RECOVERY_AFTER_CRASH
|
||||
bool yesno = true;
|
||||
#else
|
||||
bool yesno = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_CRASH_DETECTED), false);
|
||||
#endif
|
||||
|
||||
|
||||
lcd_update_enable(true);
|
||||
lcd_update(2);
|
||||
lcd_setstatuspgm(_T(MSG_CRASH_DETECTED));
|
||||
gcode_G28(true, true, false, false); //home X and Y
|
||||
st_synchronize();
|
||||
|
||||
if(automatic_recovery_after_crash)
|
||||
yesno = true;
|
||||
else
|
||||
yesno = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Crash detected. Resume print?"), false);
|
||||
lcd_update_enable(true);
|
||||
if (yesno)
|
||||
{
|
||||
enquecommand_P(PSTR("G28 X Y"));
|
||||
enquecommand_P(PSTR("CRASH_RECOVER"));
|
||||
}
|
||||
else
|
||||
@ -720,10 +750,15 @@ void crashdet_recover()
|
||||
|
||||
void crashdet_cancel()
|
||||
{
|
||||
card.sdprinting = false;
|
||||
card.closefile();
|
||||
tmc2130_sg_stop_on_crash = true;
|
||||
if (saved_printing_type == PRINTING_TYPE_SD) {
|
||||
lcd_print_stop();
|
||||
}else if(saved_printing_type == PRINTING_TYPE_USB){
|
||||
SERIAL_ECHOLNPGM("// action:cancel"); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI
|
||||
SERIAL_PROTOCOLLNRPGM(_T(MSG_OK));
|
||||
}
|
||||
}
|
||||
|
||||
#endif //TMC2130
|
||||
|
||||
void failstats_reset_print()
|
||||
@ -5102,6 +5137,22 @@ Sigma_Exit:
|
||||
}
|
||||
#endif // Z_PROBE_REPEATABILITY_TEST
|
||||
#endif // ENABLE_AUTO_BED_LEVELING
|
||||
case 73: //M73 show percent done and time remaining
|
||||
if(code_seen('P')) print_percent_done_normal = code_value();
|
||||
if(code_seen('R')) print_time_remaining_normal = code_value();
|
||||
if(code_seen('Q')) print_percent_done_silent = code_value();
|
||||
if(code_seen('S')) print_time_remaining_silent = code_value();
|
||||
|
||||
SERIAL_ECHOPGM("NORMAL MODE: Percent done: ");
|
||||
MYSERIAL.print(int(print_percent_done_normal));
|
||||
SERIAL_ECHOPGM("; print time remaining in mins: ");
|
||||
MYSERIAL.println(print_time_remaining_normal);
|
||||
SERIAL_ECHOPGM("SILENT MODE: Percent done: ");
|
||||
MYSERIAL.print(int(print_percent_done_silent));
|
||||
SERIAL_ECHOPGM("; print time remaining in mins: ");
|
||||
MYSERIAL.println(print_time_remaining_silent);
|
||||
|
||||
break;
|
||||
|
||||
case 104: // M104
|
||||
if(setTargetedHotend(104)){
|
||||
@ -5402,6 +5453,8 @@ Sigma_Exit:
|
||||
#endif
|
||||
}
|
||||
}
|
||||
//in the end of print set estimated time to end of print and extruders used during print to default values for next print
|
||||
print_time_remaining_init();
|
||||
snmm_filaments_used = 0;
|
||||
break;
|
||||
case 85: // M85
|
||||
@ -7411,8 +7464,7 @@ static void handleSafetyTimer()
|
||||
#if (EXTRUDERS > 1)
|
||||
#error Implemented only for one extruder.
|
||||
#endif //(EXTRUDERS > 1)
|
||||
if (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == 4) || saved_printing
|
||||
|| (lcd_commands_type == LCD_COMMAND_V2_CAL) || (!degTargetBed() && !degTargetHotend(0)))
|
||||
if ((PRINTER_ACTIVE) || (!degTargetBed() && !degTargetHotend(0)))
|
||||
{
|
||||
safetyTimer.stop();
|
||||
}
|
||||
@ -8386,6 +8438,7 @@ void uvlo_()
|
||||
eeprom_update_float((float*)(EEPROM_EXTRUDER_MULTIPLIER_2), extruder_multiplier[2]);
|
||||
#endif
|
||||
#endif
|
||||
eeprom_update_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY), (uint16_t)extrudemultiply);
|
||||
|
||||
// Finaly store the "power outage" flag.
|
||||
if(sd_print) eeprom_update_byte((uint8_t*)EEPROM_UVLO, 1);
|
||||
@ -8601,7 +8654,7 @@ void recover_machine_state_after_power_panic()
|
||||
extruder_multiplier[2] = eeprom_read_float((float*)(EEPROM_EXTRUDER_MULTIPLIER_2));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extrudemultiply = (int)eeprom_read_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY));
|
||||
}
|
||||
|
||||
void restore_print_from_eeprom() {
|
||||
@ -8920,5 +8973,34 @@ void print_mesh_bed_leveling_table()
|
||||
SERIAL_ECHOLNPGM("");
|
||||
}
|
||||
|
||||
uint16_t print_time_remaining() {
|
||||
uint16_t print_t = PRINT_TIME_REMAINING_INIT;
|
||||
if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_remaining_normal;
|
||||
else print_t = print_time_remaining_silent;
|
||||
if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100 * print_t / feedmultiply;
|
||||
return print_t;
|
||||
}
|
||||
|
||||
uint8_t print_percent_done() {
|
||||
//in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize
|
||||
uint8_t percent_done = 0;
|
||||
if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100) {
|
||||
percent_done = print_percent_done_normal;
|
||||
}
|
||||
else if (print_percent_done_silent <= 100) {
|
||||
percent_done = print_percent_done_silent;
|
||||
}
|
||||
else {
|
||||
percent_done = card.percentDone();
|
||||
}
|
||||
return percent_done;
|
||||
}
|
||||
|
||||
static void print_time_remaining_init() {
|
||||
print_time_remaining_normal = PRINT_TIME_REMAINING_INIT;
|
||||
print_time_remaining_silent = PRINT_TIME_REMAINING_INIT;
|
||||
print_percent_done_normal = PRINT_PERCENT_DONE_INIT;
|
||||
print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
|
||||
}
|
||||
|
||||
#define FIL_LOAD_LENGTH 60
|
||||
|
@ -678,6 +678,53 @@ void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str)
|
||||
lcd.print(str);
|
||||
}
|
||||
|
||||
static inline void lcd_print_percent_done() {
|
||||
if (is_usb_printing)
|
||||
{
|
||||
lcd_printPGM(PSTR("USB"));
|
||||
}
|
||||
else if(IS_SD_PRINTING)
|
||||
{
|
||||
lcd_printPGM(PSTR("SD"));
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_printPGM(PSTR(" "));
|
||||
}
|
||||
if (IS_SD_PRINTING || (PRINTER_ACTIVE && (print_percent_done_normal != PRINT_PERCENT_DONE_INIT)))
|
||||
{
|
||||
lcd.print(itostr3(print_percent_done()));
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_printPGM(PSTR("---"));
|
||||
}
|
||||
lcd.print('%');
|
||||
}
|
||||
|
||||
static inline void lcd_print_time() {
|
||||
//if remaining print time estimation is available print it else print elapsed time
|
||||
//uses 8 characters
|
||||
uint16_t print_t = 0;
|
||||
if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT){
|
||||
print_t = print_time_remaining();
|
||||
}
|
||||
else if(starttime != 0){
|
||||
print_t = millis() / 60000 - starttime / 60000;
|
||||
}
|
||||
lcd.print(LCD_STR_CLOCK[0]);
|
||||
if((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)||(starttime != 0)))
|
||||
{
|
||||
lcd.print(itostr2(print_t/60));
|
||||
lcd.print(':');
|
||||
lcd.print(itostr2(print_t%60));
|
||||
(print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) ? lcd.print('R') : lcd.print(' ');
|
||||
(feedmultiply == 100) ? lcd.print(' ') : lcd.print('?');
|
||||
}else{
|
||||
lcd_printPGM(PSTR("--:-- "));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
20x4 |01234567890123456789|
|
||||
@ -774,36 +821,14 @@ if (print_sd_status)
|
||||
{
|
||||
//Print SD status
|
||||
lcd.setCursor(0, 2);
|
||||
if (is_usb_printing)
|
||||
{
|
||||
lcd_printPGM(PSTR("--"));
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_printPGM(PSTR("SD"));
|
||||
}
|
||||
if (IS_SD_PRINTING)
|
||||
{
|
||||
lcd.print(itostr3(card.percentDone()));
|
||||
lcd.print('%');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_usb_printing)
|
||||
{
|
||||
lcd_printPGM(PSTR(">USB"));
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_printPGM(PSTR("---"));
|
||||
lcd.print('%');
|
||||
}
|
||||
}
|
||||
lcd_print_percent_done();
|
||||
|
||||
}
|
||||
|
||||
// Farm number display
|
||||
if (farm_mode)
|
||||
{
|
||||
lcd.setCursor(0, 6);
|
||||
lcd_printPGM(PSTR(" F"));
|
||||
lcd.print(farm_no);
|
||||
lcd_printPGM(PSTR(" "));
|
||||
@ -836,20 +861,9 @@ if (print_sd_status)
|
||||
lcd.print(buflen); // number of commands in cmd buffer
|
||||
if (buflen < 9) lcd_printPGM(" ");
|
||||
#else
|
||||
//Print time elapsed
|
||||
lcd.setCursor(LCD_WIDTH - 8 -1, 2);
|
||||
lcd_printPGM(PSTR(" "));
|
||||
lcd.print(LCD_STR_CLOCK[0]);
|
||||
if(starttime != 0)
|
||||
{
|
||||
uint16_t time = millis() / 60000 - starttime / 60000;
|
||||
lcd.print(itostr2(time/60));
|
||||
lcd.print(':');
|
||||
lcd.print(itostr2(time%60));
|
||||
}else{
|
||||
lcd_printPGM(PSTR("--:--"));
|
||||
}
|
||||
lcd_printPGM(PSTR(" "));
|
||||
//Print time
|
||||
lcd.setCursor(LCD_WIDTH - 8, 2);
|
||||
lcd_print_time();
|
||||
#endif //CMD_DIAGNOSTICS
|
||||
|
||||
#ifdef DEBUG_DISABLE_LCD_STATUS_LINE
|
||||
|
@ -141,6 +141,7 @@
|
||||
//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line
|
||||
//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message.
|
||||
//#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display.
|
||||
//#define CMD_DIAGNOSTICS //Show cmd queue length on printer display
|
||||
#endif /* DEBUG_BUILD */
|
||||
|
||||
|
||||
|
@ -141,6 +141,7 @@
|
||||
//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line
|
||||
//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message.
|
||||
//#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display.
|
||||
//#define CMD_DIAGNOSTICS //Show cmd queue length on printer display
|
||||
#endif /* DEBUG_BUILD */
|
||||
|
||||
|
||||
|
@ -112,8 +112,9 @@
|
||||
|
||||
#define Z_AXIS_ALWAYS_ON 1
|
||||
|
||||
// Automatic recovery after crash is detected
|
||||
#define AUTOMATIC_RECOVERY_AFTER_CRASH
|
||||
//Crash detection
|
||||
#define CRASHDET_TIMER 45 //seconds
|
||||
#define CRASHDET_COUNTER_MAX 3
|
||||
|
||||
// New XYZ calibration
|
||||
#define NEW_XYZCAL
|
||||
@ -176,6 +177,7 @@
|
||||
#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line
|
||||
#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message.
|
||||
#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display.
|
||||
#define CMD_DIAGNOSTICS //Show cmd queue length on printer display
|
||||
#endif /* DEBUG_BUILD */
|
||||
|
||||
//#define EXPERIMENTAL_FEATURES
|
||||
|
Loading…
Reference in New Issue
Block a user