Merge remote-tracking branch 'upstream/MK3' into MK3_MK404

This commit is contained in:
3d-gussner 2021-02-18 11:39:36 +01:00
commit 4c8ba11417
3 changed files with 322 additions and 359 deletions

View File

@ -709,124 +709,98 @@ void softReset()
#endif #endif
static void factory_reset_stats(){
eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0);
eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0);
eeprom_update_byte((uint8_t *)EEPROM_CRASH_COUNT_X, 0);
eeprom_update_byte((uint8_t *)EEPROM_CRASH_COUNT_Y, 0);
eeprom_update_byte((uint8_t *)EEPROM_FERROR_COUNT, 0);
eeprom_update_byte((uint8_t *)EEPROM_POWER_COUNT, 0);
eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_X_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_Y_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_FERROR_COUNT_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_MMU_FAIL_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0);
eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0);
eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0);
}
// Factory reset function // Factory reset function
// This function is used to erase parts or whole EEPROM memory which is used for storing calibration and and so on. // This function is used to erase parts or whole EEPROM memory which is used for storing calibration and and so on.
// Level input parameter sets depth of reset // Level input parameter sets depth of reset
int er_progress = 0;
static void factory_reset(char level) static void factory_reset(char level)
{ {
lcd_clear(); lcd_clear();
switch (level) { Sound_MakeCustom(100,0,false);
switch (level) {
// Level 0: Language reset case 0: // Level 0: Language reset
case 0: lang_reset();
Sound_MakeCustom(100,0,false); break;
lang_reset();
break;
//Level 1: Reset statistics case 1: //Level 1: Reset statistics
case 1: factory_reset_stats();
Sound_MakeCustom(100,0,false); lcd_menu_statistics();
eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0); break;
eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0);
eeprom_update_byte((uint8_t *)EEPROM_CRASH_COUNT_X, 0); case 2: // Level 2: Prepare for shipping
eeprom_update_byte((uint8_t *)EEPROM_CRASH_COUNT_Y, 0); factory_reset_stats();
eeprom_update_byte((uint8_t *)EEPROM_FERROR_COUNT, 0); // [[fallthrough]] // there is no break intentionally
eeprom_update_byte((uint8_t *)EEPROM_POWER_COUNT, 0);
eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_X_TOT, 0); case 4: // Level 4: Preparation after being serviced
eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_Y_TOT, 0); // Force language selection at the next boot up.
eeprom_update_word((uint16_t *)EEPROM_FERROR_COUNT_TOT, 0); lang_reset();
eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0); // Force the "Follow calibration flow" message at the next boot up.
calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION);
eeprom_update_word((uint16_t *)EEPROM_MMU_FAIL_TOT, 0); eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard
eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0); farm_mode = false;
eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0); eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode);
eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0);
lcd_menu_statistics();
break;
// Level 2: Prepare for shipping
case 2:
//lcd_puts_P(PSTR("Factory RESET"));
//lcd_puts_at_P(1,2,PSTR("Shipping prep"));
// Force language selection at the next boot up.
lang_reset();
// Force the "Follow calibration flow" message at the next boot up.
calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION);
eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard
farm_mode = false;
eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode);
eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0);
eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0);
eeprom_update_byte((uint8_t *)EEPROM_CRASH_COUNT_X, 0);
eeprom_update_byte((uint8_t *)EEPROM_CRASH_COUNT_Y, 0);
eeprom_update_byte((uint8_t *)EEPROM_FERROR_COUNT, 0);
eeprom_update_byte((uint8_t *)EEPROM_POWER_COUNT, 0);
eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_X_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_Y_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_FERROR_COUNT_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_MMU_FAIL_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0);
eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0);
eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0);
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
fsensor_enable(); fsensor_enable();
fsensor_autoload_set(true); fsensor_autoload_set(true);
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
Sound_MakeCustom(100,0,false); break;
//_delay_ms(2000);
break;
// Level 3: erase everything, whole EEPROM will be set to 0xFF case 3:{ // Level 3: erase everything, whole EEPROM will be set to 0xFF
lcd_puts_P(PSTR("Factory RESET"));
lcd_puts_at_P(1, 2, PSTR("ERASING all data"));
uint16_t er_progress = 0;
lcd_set_cursor(3, 3);
lcd_space(6);
lcd_set_cursor(3, 3);
lcd_print(er_progress);
case 3: // Erase EEPROM
lcd_puts_P(PSTR("Factory RESET")); for (uint16_t i = 0; i < 4096; i++) {
lcd_puts_at_P(1, 2, PSTR("ERASING all data")); eeprom_update_byte((uint8_t*)i, 0xFF);
Sound_MakeCustom(100,0,false);
er_progress = 0;
lcd_puts_at_P(3, 3, PSTR(" "));
lcd_set_cursor(3, 3);
lcd_print(er_progress);
// Erase EEPROM
for (int i = 0; i < 4096; i++) {
eeprom_update_byte((uint8_t*)i, 0xFF);
if (i % 41 == 0) {
er_progress++;
lcd_puts_at_P(3, 3, PSTR(" "));
lcd_set_cursor(3, 3);
lcd_print(er_progress);
lcd_puts_P(PSTR("%"));
}
if (i % 41 == 0) {
er_progress++;
lcd_set_cursor(3, 3);
lcd_space(6);
lcd_set_cursor(3, 3);
lcd_print(er_progress);
lcd_puts_P(PSTR("%"));
} }
softReset();
}
softReset();
break; }break;
case 4:
bowden_menu();
break;
default:
break;
}
#ifdef SNMM
case 5:
bowden_menu();
break;
#endif
default:
break;
}
} }
extern "C" { extern "C" {
@ -857,30 +831,27 @@ void factory_reset()
{ {
lcd_clear(); lcd_clear();
lcd_puts_P(PSTR("Factory RESET")); lcd_puts_P(PSTR("Factory RESET"));
SET_OUTPUT(BEEPER); SET_OUTPUT(BEEPER);
if(eSoundMode!=e_SOUND_MODE_SILENT) if(eSoundMode!=e_SOUND_MODE_SILENT)
WRITE(BEEPER, HIGH); WRITE(BEEPER, HIGH);
while (!READ(BTN_ENC)); while (!READ(BTN_ENC));
WRITE(BEEPER, LOW); WRITE(BEEPER, LOW);
_delay_ms(2000); _delay_ms(2000);
char level = reset_menu(); char level = reset_menu();
factory_reset(level); factory_reset(level);
switch (level) { switch (level) {
case 0: _delay_ms(0); break; case 0:
case 1: _delay_ms(0); break; case 1:
case 2: _delay_ms(0); break; case 2:
case 3: _delay_ms(0); break; case 3:
case 4: _delay_ms(0); break;
} }
} }
@ -3799,31 +3770,90 @@ void process_commands()
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
int8_t SilentMode; int8_t SilentMode;
#endif #endif
/*! /*!
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------
### M117 - Display Message <a href="https://reprap.org/wiki/G-code#M117:_Display_Message">M117: Display Message</a> ### M117 - Display Message <a href="https://reprap.org/wiki/G-code#M117:_Display_Message">M117: Display Message</a>
This causes the given message to be shown in the status line on an attached LCD. This causes the given message to be shown in the status line on an attached LCD.
It is processed early as to allow printing messages that contain G, M, N or T. It is processed early as to allow printing messages that contain G, M, N or T.
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------
### Special internal commands ### Special internal commands
These are used by internal functions to process certain actions in the right order. Some of these are also usable by the user. These are used by internal functions to process certain actions in the right order. Some of these are also usable by the user.
They are processed early as the commands are complex (strings). They are processed early as the commands are complex (strings).
These are only available on the MK3(S) as these require TMC2130 drivers: These are only available on the MK3(S) as these require TMC2130 drivers:
- CRASH DETECTED - CRASH DETECTED
- CRASH RECOVER - CRASH RECOVER
- CRASH_CANCEL - CRASH_CANCEL
- TMC_SET_WAVE - TMC_SET_WAVE
- TMC_SET_STEP - TMC_SET_STEP
- TMC_SET_CHOP - TMC_SET_CHOP
*/ */
if (code_seen_P(PSTR("M117"))) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^" if (code_seen_P(PSTR("M117"))) //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^"
starpos = (strchr(strchr_pointer + 5, '*')); {
if (starpos != NULL) starpos = (strchr(strchr_pointer + 5, '*'));
*(starpos) = '\0'; if (starpos != NULL)
lcd_setstatus(strchr_pointer + 5); *(starpos) = '\0';
} lcd_setstatus(strchr_pointer + 5);
custom_message_type = CustomMsg::MsgUpdate;
}
/*!
### M0, M1 - Stop the printer <a href="https://reprap.org/wiki/G-code#M0:_Stop_or_Unconditional_stop">M0: Stop or Unconditional stop</a>
#### Usage
M0 [P<ms<] [S<sec>] [string]
M1 [P<ms>] [S<sec>] [string]
#### Parameters
- `P<ms>` - Expire time, in milliseconds
- `S<sec>` - Expire time, in seconds
- `string` - Must for M1 and optional for M0 message to display on the LCD
*/
else if (code_seen_P(PSTR("M0")) || code_seen_P(PSTR("M1 "))) {// M0 and M1 - (Un)conditional stop - Wait for user button press on LCD
char *src = strchr_pointer + 2;
codenum = 0;
bool hasP = false, hasS = false;
if (code_seen('P')) {
codenum = code_value(); // milliseconds to wait
hasP = codenum > 0;
}
if (code_seen('S')) {
codenum = code_value() * 1000; // seconds to wait
hasS = codenum > 0;
}
starpos = strchr(src, '*');
if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src;
custom_message_type = CustomMsg::M0Wait;
if (!hasP && !hasS && *src != '\0') {
lcd_setstatus(src);
} else {
LCD_MESSAGERPGM(_i("Wait for user..."));////MSG_USERWAIT
}
lcd_ignore_click(); //call lcd_ignore_click aslo for else ???
st_synchronize();
previous_millis_cmd = _millis();
if (codenum > 0) {
codenum += _millis(); // keep track of when we started waiting
KEEPALIVE_STATE(PAUSED_FOR_USER);
while(_millis() < codenum && !lcd_clicked()) {
manage_heater();
manage_inactivity(true);
lcd_update(0);
}
KEEPALIVE_STATE(IN_HANDLER);
lcd_ignore_click(false);
} else {
marlin_wait_for_click();
}
if (IS_SD_PRINTING)
custom_message_type = CustomMsg::Status;
else
LCD_MESSAGERPGM(_T(WELCOME_MSG));
}
#ifdef TMC2130 #ifdef TMC2130
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("CRASH_"), 6) == 0) else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("CRASH_"), 6) == 0)
@ -5682,60 +5712,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
switch(mcode_in_progress) switch(mcode_in_progress)
{ {
/*!
### M0, M1 - Stop the printer <a href="https://reprap.org/wiki/G-code#M0:_Stop_or_Unconditional_stop">M0: Stop or Unconditional stop</a>
*/
case 0: // M0 - Unconditional stop - Wait for user button press on LCD
case 1: // M1 - Conditional stop - Wait for user button press on LCD
{
char *src = strchr_pointer + 2;
codenum = 0;
bool hasP = false, hasS = false;
if (code_seen('P')) {
codenum = code_value(); // milliseconds to wait
hasP = codenum > 0;
}
if (code_seen('S')) {
codenum = code_value() * 1000; // seconds to wait
hasS = codenum > 0;
}
starpos = strchr(src, '*');
if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src;
if (!hasP && !hasS && *src != '\0') {
lcd_setstatus(src);
} else {
LCD_MESSAGERPGM(_i("Wait for user..."));////MSG_USERWAIT
}
lcd_ignore_click(); //call lcd_ignore_click aslo for else ???
st_synchronize();
previous_millis_cmd = _millis();
if (codenum > 0){
codenum += _millis(); // keep track of when we started waiting
KEEPALIVE_STATE(PAUSED_FOR_USER);
while(_millis() < codenum && !lcd_clicked()){
manage_heater();
manage_inactivity(true);
lcd_update(0);
}
KEEPALIVE_STATE(IN_HANDLER);
lcd_ignore_click(false);
}else{
marlin_wait_for_click();
}
if (IS_SD_PRINTING)
LCD_MESSAGERPGM(_T(MSG_RESUMING_PRINT));
else
LCD_MESSAGERPGM(_T(WELCOME_MSG));
}
break;
/*! /*!
### M17 - Enable all axes <a href="https://reprap.org/wiki/G-code#M17:_Enable.2FPower_all_stepper_motors">M17: Enable/Power all stepper motors</a> ### M17 - Enable all axes <a href="https://reprap.org/wiki/G-code#M17:_Enable.2FPower_all_stepper_motors">M17: Enable/Power all stepper motors</a>
*/ */
case 17: case 17:
LCD_MESSAGERPGM(_i("No move."));////MSG_NO_MOVE LCD_MESSAGERPGM(_i("No move."));////MSG_NO_MOVE
enable_x(); enable_x();
@ -8139,35 +8119,34 @@ Sigma_Exit:
/*! /*!
### M25 - Pause SD print <a href="https://reprap.org/wiki/G-code#M25:_Pause_SD_print">M25: Pause SD print</a> ### M25 - Pause SD print <a href="https://reprap.org/wiki/G-code#M25:_Pause_SD_print">M25: Pause SD print</a>
*/ */
case 25: case 25:
case 601: case 601:
{ {
if (!isPrintPaused) if (!isPrintPaused) {
{
st_synchronize(); st_synchronize();
ClearToSend(); //send OK even before the command finishes executing because we want to make sure it is not skipped because of cmdqueue_pop_front(); ClearToSend(); //send OK even before the command finishes executing because we want to make sure it is not skipped because of cmdqueue_pop_front();
cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore
lcd_pause_print(); lcd_pause_print();
} }
} }
break; break;
/*! /*!
### M602 - Resume print <a href="https://reprap.org/wiki/G-code#M602:_Resume_print">M602: Resume print</a> ### M602 - Resume print <a href="https://reprap.org/wiki/G-code#M602:_Resume_print">M602: Resume print</a>
*/ */
case 602: { case 602: {
if (isPrintPaused) if (isPrintPaused)
lcd_resume_print(); lcd_resume_print();
} }
break; break;
/*! /*!
### M603 - Stop print <a href="https://reprap.org/wiki/G-code#M603:_Stop_print">M603: Stop print</a> ### M603 - Stop print <a href="https://reprap.org/wiki/G-code#M603:_Stop_print">M603: Stop print</a>
*/ */
case 603: { case 603: {
lcd_print_stop(); lcd_print_stop();
} }
break; break;
#ifdef PINDA_THERMISTOR #ifdef PINDA_THERMISTOR
/*! /*!

View File

@ -752,158 +752,138 @@ void lcdui_print_time(void)
lcd_space(8 - chars); lcd_space(8 - chars);
} }
//Print status line on status screen //! @Brief Print status line on status screen
void lcdui_print_status_line(void) void lcdui_print_status_line(void)
{ {
if (IS_SD_PRINTING) if (IS_SD_PRINTING) {
{ if (strcmp(longFilenameOLD, (card.longFilename[0] ? card.longFilename : card.filename)) != 0) {
if (strcmp(longFilenameOLD, (card.longFilename[0] ? card.longFilename : card.filename)) != 0) memset(longFilenameOLD, '\0', strlen(longFilenameOLD));
{ sprintf_P(longFilenameOLD, PSTR("%s"), (card.longFilename[0] ? card.longFilename : card.filename));
memset(longFilenameOLD, '\0', strlen(longFilenameOLD)); scrollstuff = 0;
sprintf_P(longFilenameOLD, PSTR("%s"), (card.longFilename[0] ? card.longFilename : card.filename)); }
scrollstuff = 0; }
}
}
if (heating_status) if (heating_status) { // If heating flag, show progress of heating
{ // If heating flag, show progress of heating heating_status_counter++;
heating_status_counter++; if (heating_status_counter > 13) {
if (heating_status_counter > 13) heating_status_counter = 0;
{ }
heating_status_counter = 0; lcd_set_cursor(7, 3);
} lcd_space(13);
lcd_set_cursor(7, 3);
lcd_space(13);
for (unsigned int dots = 0; dots < heating_status_counter; dots++) for (unsigned int dots = 0; dots < heating_status_counter; dots++) {
{ lcd_putc_at(7 + dots, 3, '.');
lcd_putc_at(7 + dots, 3, '.'); }
} switch (heating_status) {
switch (heating_status) case 1:
{ lcd_puts_at_P(0, 3, _T(MSG_HEATING));
case 1: break;
lcd_puts_at_P(0, 3, _T(MSG_HEATING)); case 2:
break; lcd_puts_at_P(0, 3, _T(MSG_HEATING_COMPLETE));
case 2: heating_status = 0;
lcd_puts_at_P(0, 3, _T(MSG_HEATING_COMPLETE)); heating_status_counter = 0;
heating_status = 0; break;
heating_status_counter = 0; case 3:
break; lcd_puts_at_P(0, 3, _T(MSG_BED_HEATING));
case 3: break;
lcd_puts_at_P(0, 3, _T(MSG_BED_HEATING)); case 4:
break; lcd_puts_at_P(0, 3, _T(MSG_BED_DONE));
case 4: heating_status = 0;
lcd_puts_at_P(0, 3, _T(MSG_BED_DONE)); heating_status_counter = 0;
heating_status = 0; break;
heating_status_counter = 0; default:
break; break;
default: }
break; }
} else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsg::Status)) { // If printing from SD, show what we are printing
} if(strlen(longFilenameOLD) > LCD_WIDTH) {
else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsg::Status)) int inters = 0;
{ // If printing from SD, show what we are printing int gh = scrollstuff;
if(strlen(longFilenameOLD) > LCD_WIDTH) while (((gh - scrollstuff) < LCD_WIDTH) && (inters == 0)) {
{ if (longFilenameOLD[gh] == '\0') {
int inters = 0; lcd_set_cursor(gh - scrollstuff, 3);
int gh = scrollstuff; lcd_print(longFilenameOLD[gh - 1]);
while (((gh - scrollstuff) < LCD_WIDTH) && (inters == 0)) scrollstuff = 0;
{ gh = scrollstuff;
if (longFilenameOLD[gh] == '\0') inters = 1;
{ } else {
lcd_set_cursor(gh - scrollstuff, 3); lcd_set_cursor(gh - scrollstuff, 3);
lcd_print(longFilenameOLD[gh - 1]); lcd_print(longFilenameOLD[gh - 1]);
scrollstuff = 0; gh++;
gh = scrollstuff; }
inters = 1; }
} scrollstuff++;
else } else {
{ lcd_printf_P(PSTR("%-20s"), longFilenameOLD);
lcd_set_cursor(gh - scrollstuff, 3); }
lcd_print(longFilenameOLD[gh - 1]); } else { // Otherwise check for other special events
gh++; switch (custom_message_type) {
} case CustomMsg::MsgUpdate: //Short message even while printing from SD
} case CustomMsg::Status: // Nothing special, print status message normally
scrollstuff++; case CustomMsg::M0Wait: // M0/M1 Wait command working even from SD
} lcd_print(lcd_status_message);
else break;
{ case CustomMsg::MeshBedLeveling: // If mesh bed leveling in progress, show the status
lcd_printf_P(PSTR("%-20s"), longFilenameOLD); if (custom_message_state > 10) {
} lcd_set_cursor(0, 3);
} lcd_space(20);
else lcd_puts_at_P(0, 3, _T(MSG_CALIBRATE_Z_AUTO));
{ // Otherwise check for other special events lcd_puts_P(PSTR(" : "));
switch (custom_message_type) lcd_print(custom_message_state-10);
{ } else {
case CustomMsg::Status: // Nothing special, print status message normally if (custom_message_state == 3)
lcd_print(lcd_status_message); {
break; lcd_puts_P(_T(WELCOME_MSG));
case CustomMsg::MeshBedLeveling: // If mesh bed leveling in progress, show the status lcd_setstatuspgm(_T(WELCOME_MSG));
if (custom_message_state > 10) custom_message_type = CustomMsg::Status;
{ }
lcd_set_cursor(0, 3); if (custom_message_state > 3 && custom_message_state <= 10 ) {
lcd_space(20); lcd_set_cursor(0, 3);
lcd_puts_at_P(0, 3, _T(MSG_CALIBRATE_Z_AUTO)); lcd_space(19);
lcd_puts_P(PSTR(" : ")); lcd_puts_at_P(0, 3, _i("Calibration done"));////MSG_HOMEYZ_DONE
lcd_print(custom_message_state-10); custom_message_state--;
} }
else }
{ break;
if (custom_message_state == 3) case CustomMsg::FilamentLoading: // If loading filament, print status
{ lcd_print(lcd_status_message);
lcd_puts_P(_T(WELCOME_MSG)); break;
lcd_setstatuspgm(_T(WELCOME_MSG)); case CustomMsg::PidCal: // PID tuning in progress
custom_message_type = CustomMsg::Status; lcd_print(lcd_status_message);
} if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) {
if (custom_message_state > 3 && custom_message_state <= 10 ) lcd_set_cursor(10, 3);
{ lcd_print(itostr3(pid_cycle));
lcd_set_cursor(0, 3); lcd_print('/');
lcd_space(19); lcd_print(itostr3left(pid_number_of_cycles));
lcd_puts_at_P(0, 3, _i("Calibration done"));////MSG_HOMEYZ_DONE }
custom_message_state--; break;
} case CustomMsg::TempCal: // PINDA temp calibration in progress
} char statusLine[LCD_WIDTH + 1];
break; sprintf_P(statusLine, PSTR("%-20S"), _T(MSG_TEMP_CALIBRATION));
case CustomMsg::FilamentLoading: // If loading filament, print status char progress[4];
lcd_print(lcd_status_message); sprintf_P(progress, PSTR("%d/6"), custom_message_state);
break; memcpy(statusLine + 12, progress, sizeof(progress) - 1);
case CustomMsg::PidCal: // PID tuning in progress lcd_set_cursor(0, 3);
lcd_print(lcd_status_message); lcd_print(statusLine);
if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) break;
{ case CustomMsg::TempCompPreheat: // temp compensation preheat
lcd_set_cursor(10, 3); lcd_puts_at_P(0, 3, _i("PINDA Heating"));////MSG_PINDA_PREHEAT c=20 r=1
lcd_print(itostr3(pid_cycle)); if (custom_message_state <= PINDA_HEAT_T) {
lcd_print('/'); lcd_puts_P(PSTR(": "));
lcd_print(itostr3left(pid_number_of_cycles)); lcd_print(custom_message_state); //seconds
} lcd_print(' ');
break; }
case CustomMsg::TempCal: // PINDA temp calibration in progress break;
{ case CustomMsg::Resuming: //Resuming
char statusLine[LCD_WIDTH + 1]; lcd_puts_at_P(0, 3, _T(MSG_RESUMING_PRINT));
sprintf_P(statusLine, PSTR("%-20S"), _T(MSG_TEMP_CALIBRATION)); break;
char progress[4]; }
sprintf_P(progress, PSTR("%d/6"), custom_message_state); }
memcpy(statusLine + 12, progress, sizeof(progress) - 1);
lcd_set_cursor(0, 3);
lcd_print(statusLine);
}
break;
case CustomMsg::TempCompPreheat: // temp compensation preheat
lcd_puts_at_P(0, 3, _i("PINDA Heating"));////MSG_PINDA_PREHEAT c=20 r=1
if (custom_message_state <= PINDA_HEAT_T)
{
lcd_puts_P(PSTR(": "));
lcd_print(custom_message_state); //seconds
lcd_print(' ');
}
break;
}
}
// Fill the rest of line to have nice and clean output // Fill the rest of line to have nice and clean output
for(int fillspace = 0; fillspace < 20; fillspace++) for(int fillspace = 0; fillspace < 20; fillspace++)
if ((lcd_status_message[fillspace] <= 31 )) if ((lcd_status_message[fillspace] <= 31 ))
lcd_print(' '); lcd_print(' ');
} }
//! @brief Show Status Screen //! @brief Show Status Screen
@ -6136,15 +6116,15 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite
char reset_menu() { char reset_menu() {
const uint8_t items_no = const uint8_t items_no =
#ifdef SNMM #ifdef SNMM
5; 6;
#else #else
4; 5;
#endif #endif
static int8_t first = 0; static int8_t first = 0;
int8_t enc_dif = 0; int8_t enc_dif = 0;
char cursor_pos = 0; char cursor_pos = 0;
const char *const item[items_no] PROGMEM = {PSTR("Language"), PSTR("Statistics"), PSTR("Shipping prep"), PSTR("All Data") const char *const item[items_no] PROGMEM = {PSTR("Language"), PSTR("Statistics"), PSTR("Shipping prep"), PSTR("All Data"), PSTR("Service prep")
#ifdef SNMM #ifdef SNMM
, PSTR("Bowden length") , PSTR("Bowden length")
#endif #endif
@ -6535,12 +6515,13 @@ void lcd_resume_print()
lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS));
st_synchronize(); st_synchronize();
lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); ////MSG_RESUMING_PRINT c=20 custom_message_type = CustomMsg::Resuming;
isPrintPaused = false; isPrintPaused = false;
restore_print_from_ram_and_continue(default_retraction); restore_print_from_ram_and_continue(default_retraction);
pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation
refresh_cmd_timeout(); refresh_cmd_timeout();
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint
custom_message_type = CustomMsg::Status;
} }
static void change_sheet() static void change_sheet()

View File

@ -114,12 +114,15 @@ extern int8_t FSensorStateMenu;
enum class CustomMsg : uint_least8_t enum class CustomMsg : uint_least8_t
{ {
Status, //!< status message from lcd_status_message variable Status, //!< status message from lcd_status_message variable
MeshBedLeveling, //!< Mesh bed leveling in progress MeshBedLeveling, //!< Mesh bed leveling in progress
FilamentLoading, //!< Loading filament in progress FilamentLoading, //!< Loading filament in progress
PidCal, //!< PID tuning in progress PidCal, //!< PID tuning in progress
TempCal, //!< PINDA temperature calibration TempCal, //!< PINDA temperature calibration
TempCompPreheat, //!< Temperature compensation preheat TempCompPreheat, //!< Temperature compensation preheat
M0Wait, //!< M0/M1 Wait command working even from SD
MsgUpdate, //!< Short message even while printing from SD
Resuming, //!< Resuming message
}; };
extern CustomMsg custom_message_type; extern CustomMsg custom_message_type;