|
@@ -66,13 +66,17 @@ extern void crashdet_disable();
|
|
|
#endif //TMC2130
|
|
|
|
|
|
|
|
|
-
|
|
|
#ifdef SDCARD_SORT_ALPHA
|
|
|
- bool presort_flag = false;
|
|
|
+bool presort_flag = false;
|
|
|
#endif
|
|
|
|
|
|
-int lcd_commands_type=LCD_COMMAND_IDLE;
|
|
|
-int lcd_commands_step=0;
|
|
|
+int lcd_commands_type = LCD_COMMAND_IDLE;
|
|
|
+int lcd_commands_step = 0;
|
|
|
+
|
|
|
+unsigned int custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
|
|
+unsigned int custom_message_state = 0;
|
|
|
+
|
|
|
+
|
|
|
bool isPrintPaused = false;
|
|
|
uint8_t farm_mode = 0;
|
|
|
int farm_no = 0;
|
|
@@ -84,7 +88,6 @@ unsigned long display_time; //just timer for showing pid finished message on lcd
|
|
|
float pid_temp = DEFAULT_PID_TEMP;
|
|
|
|
|
|
static bool forceMenuExpire = false;
|
|
|
-bool menuExiting = false;
|
|
|
|
|
|
|
|
|
static float manual_feedrate[] = MANUAL_FEEDRATE;
|
|
@@ -224,62 +227,6 @@ bool wait_for_unclick;
|
|
|
const char STR_SEPARATOR[] PROGMEM = "------------";
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-static inline void lcd_print_percent_done() {
|
|
|
- if (is_usb_printing)
|
|
|
- {
|
|
|
- lcd_puts_P(PSTR("USB"));
|
|
|
- }
|
|
|
- else if(IS_SD_PRINTING)
|
|
|
- {
|
|
|
- lcd_puts_P(PSTR("SD"));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lcd_puts_P(PSTR(" "));
|
|
|
- }
|
|
|
- if (IS_SD_PRINTING || (PRINTER_ACTIVE && (print_percent_done_normal != PRINT_PERCENT_DONE_INIT)))
|
|
|
- {
|
|
|
- lcd_print(itostr3(print_percent_done()));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lcd_puts_P(PSTR("---"));
|
|
|
- }
|
|
|
- lcd_puts_P(PSTR("% "));
|
|
|
-}
|
|
|
-
|
|
|
-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));
|
|
|
- if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
|
|
|
- {
|
|
|
- lcd_print('R');
|
|
|
- (feedmultiply == 100) ? lcd_print(' ') : lcd_print('?');
|
|
|
- }
|
|
|
- else {
|
|
|
- lcd_puts_P(PSTR(" "));
|
|
|
- }
|
|
|
- }else{
|
|
|
- lcd_puts_P(PSTR("--:-- "));
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
|
|
|
{
|
|
|
char c;
|
|
@@ -332,6 +279,7 @@ void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr,
|
|
|
while(n--)
|
|
|
lcd_print(' ');
|
|
|
}
|
|
|
+
|
|
|
void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
|
|
|
{
|
|
|
char c;
|
|
@@ -518,121 +466,78 @@ uint8_t menu_item_sdfile(const char* str, const char* str_fn, char* str_fnl)
|
|
|
#endif //NEW_SD_MENU
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-/*
|
|
|
-
|
|
|
-20x4 |01234567890123456789|
|
|
|
- |T 000/000D Z000.0 |
|
|
|
- |B 000/000D F100% |
|
|
|
- |SD100% T--:-- |
|
|
|
- |Status line.........|
|
|
|
-*/
|
|
|
-static void lcd_implementation_status_screen()
|
|
|
+// Print temperature (nozzle/bed) (9 chars total)
|
|
|
+void lcdui_print_temp(char type, int val_current, int val_target)
|
|
|
{
|
|
|
-
|
|
|
- int tHotend=int(degHotend(0) + 0.5);
|
|
|
- int tTarget=int(degTargetHotend(0) + 0.5);
|
|
|
-
|
|
|
- //Print the hotend temperature
|
|
|
- lcd_set_cursor(0, 0);
|
|
|
- lcd_print(LCD_STR_THERMOMETER[0]);
|
|
|
- lcd_print(itostr3(tHotend));
|
|
|
- lcd_print('/');
|
|
|
- lcd_print(itostr3left(tTarget));
|
|
|
- lcd_puts_P(PSTR(LCD_STR_DEGREE " "));
|
|
|
- lcd_puts_P(PSTR(" "));
|
|
|
-
|
|
|
- //Print the Z coordinates
|
|
|
- lcd_set_cursor(LCD_WIDTH - 8-2, 0);
|
|
|
-#if 1
|
|
|
- lcd_puts_P(PSTR(" Z"));
|
|
|
- if (custom_message_type == 1) {
|
|
|
- // In a bed calibration mode.
|
|
|
- lcd_puts_P(PSTR(" --- "));
|
|
|
- } else {
|
|
|
- lcd_print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
|
|
|
- lcd_print(' ');
|
|
|
- }
|
|
|
-#else
|
|
|
- lcd_puts_P(PSTR(" Queue:"));
|
|
|
- lcd_print(int(moves_planned()));
|
|
|
- lcd_print(' ');
|
|
|
-#endif
|
|
|
+ int chars = lcd_printf_P(_N("%c%3d/%d%c"), type, val_current, val_target, LCD_STR_DEGREE[0]);
|
|
|
+ lcd_space(9 - chars);
|
|
|
+}
|
|
|
|
|
|
- //Print the Bedtemperature
|
|
|
- lcd_set_cursor(0, 1);
|
|
|
- tHotend=int(degBed() + 0.5);
|
|
|
- tTarget=int(degTargetBed() + 0.5);
|
|
|
- lcd_print(LCD_STR_BEDTEMP[0]);
|
|
|
- lcd_print(itostr3(tHotend));
|
|
|
- lcd_print('/');
|
|
|
- lcd_print(itostr3left(tTarget));
|
|
|
- lcd_puts_P(PSTR(LCD_STR_DEGREE " "));
|
|
|
- lcd_puts_P(PSTR(" "));
|
|
|
+// Print Z-coordinate (8 chars total)
|
|
|
+void lcdui_print_Z_coord(void)
|
|
|
+{
|
|
|
+ int chars = 8;
|
|
|
+ if (custom_message_type == CUSTOM_MSG_TYPE_MESHBL)
|
|
|
+ lcd_puts_P(_N("Z --- "));
|
|
|
+ else
|
|
|
+ chars = lcd_printf_P(_N("Z%6.2f "), current_position[Z_AXIS]);
|
|
|
+// lcd_space(8 - chars);
|
|
|
+}
|
|
|
|
|
|
#ifdef PLANNER_DIAGNOSTICS
|
|
|
- //Print Feedrate
|
|
|
- lcd_set_cursor(LCD_WIDTH - 8-2, 1);
|
|
|
- lcd_print(LCD_STR_FEEDRATE[0]);
|
|
|
- lcd_print(itostr3(feedmultiply));
|
|
|
- lcd_puts_P(PSTR("% Q"));
|
|
|
- {
|
|
|
- uint8_t queue = planner_queue_min();
|
|
|
- if (queue < (BLOCK_BUFFER_SIZE >> 1)) {
|
|
|
- lcd_putc('!');
|
|
|
- } else {
|
|
|
- lcd_putc((char)(queue / 10) + '0');
|
|
|
- queue %= 10;
|
|
|
- }
|
|
|
- lcd_putc((char)queue + '0');
|
|
|
- planner_queue_min_reset();
|
|
|
- }
|
|
|
-#else /* PLANNER_DIAGNOSTICS */
|
|
|
- //Print Feedrate
|
|
|
- lcd_set_cursor(LCD_WIDTH - 8-2, 1);
|
|
|
- lcd_puts_P(PSTR(" "));
|
|
|
-/*
|
|
|
- if (maxlimit_status)
|
|
|
- {
|
|
|
- maxlimit_status = 0;
|
|
|
- lcd_print('!');
|
|
|
- }
|
|
|
- else*/
|
|
|
- lcd_print(LCD_STR_FEEDRATE[0]);
|
|
|
- lcd_print(itostr3(feedmultiply));
|
|
|
- lcd_puts_P(PSTR("% "));
|
|
|
-#endif /* PLANNER_DIAGNOSTICS */
|
|
|
-
|
|
|
- bool print_sd_status = true;
|
|
|
-
|
|
|
-#ifdef PINDA_THERMISTOR
|
|
|
-// if (farm_mode && (custom_message_type == 4))
|
|
|
- if (false)
|
|
|
+// Print planner diagnostics (8 chars total)
|
|
|
+void lcdui_print_planner_diag(void)
|
|
|
+{
|
|
|
+ lcd_set_cursor(LCD_WIDTH - 8-2, 1);
|
|
|
+ lcd_print(LCD_STR_FEEDRATE[0]);
|
|
|
+ lcd_print(itostr3(feedmultiply));
|
|
|
+ lcd_puts_P(PSTR("% Q"));
|
|
|
{
|
|
|
- lcd_set_cursor(0, 2);
|
|
|
- lcd_puts_P(PSTR("P"));
|
|
|
- lcd_print(ftostr3(current_temperature_pinda));
|
|
|
- lcd_puts_P(PSTR(LCD_STR_DEGREE " "));
|
|
|
- print_sd_status = false;
|
|
|
+ uint8_t queue = planner_queue_min();
|
|
|
+ if (queue < (BLOCK_BUFFER_SIZE >> 1))
|
|
|
+ lcd_putc('!');
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lcd_putc((char)(queue / 10) + '0');
|
|
|
+ queue %= 10;
|
|
|
+ }
|
|
|
+ lcd_putc((char)queue + '0');
|
|
|
+ planner_queue_min_reset();
|
|
|
}
|
|
|
-#endif //PINDA_THERMISTOR
|
|
|
+}
|
|
|
+#endif // PLANNER_DIAGNOSTICS
|
|
|
|
|
|
+// Print feedrate (8 chars total)
|
|
|
+void lcdui_print_feedrate(void)
|
|
|
+{
|
|
|
+ int chars = lcd_printf_P(_N("%c%3d%%"), LCD_STR_FEEDRATE[0], feedmultiply);
|
|
|
+ lcd_space(8 - chars);
|
|
|
+}
|
|
|
|
|
|
-if (print_sd_status)
|
|
|
+// Print percent done in form "USB---%", " SD---%", " ---%" (7 chars total)
|
|
|
+void lcdui_print_percent_done(void)
|
|
|
{
|
|
|
- //Print SD status
|
|
|
- lcd_set_cursor(0, 2);
|
|
|
- lcd_print_percent_done();
|
|
|
+ const char* src = is_usb_printing?_N("USB"):(IS_SD_PRINTING?_N(" SD"):_N(" "));
|
|
|
+ char per[4];
|
|
|
+ bool num = IS_SD_PRINTING || (PRINTER_ACTIVE && (print_percent_done_normal != PRINT_PERCENT_DONE_INIT));
|
|
|
+ sprintf_P(per, num?_N("%3hhd"):_N("---"), calc_percent_done());
|
|
|
+ int chars = lcd_printf_P(_N("%3S%3s%%"), src, per);
|
|
|
+// lcd_space(7 - chars);
|
|
|
+}
|
|
|
|
|
|
+// Print extruder status (5 chars total)
|
|
|
+void lcdui_print_extruder(void)
|
|
|
+{
|
|
|
+ int chars = lcd_printf_P(_N(" T%u"), mmu_extruder);
|
|
|
+ lcd_space(5 - chars);
|
|
|
}
|
|
|
|
|
|
+// Print farm number (5 chars total)
|
|
|
+void lcdui_print_farm(void)
|
|
|
+{
|
|
|
+ int chars = lcd_printf_P(_N(" F0 "));
|
|
|
+// lcd_space(5 - chars);
|
|
|
+/*
|
|
|
// Farm number display
|
|
|
if (farm_mode)
|
|
|
{
|
|
@@ -662,29 +567,45 @@ if (print_sd_status)
|
|
|
lcd_puts_P(PSTR(" "));
|
|
|
#endif
|
|
|
}
|
|
|
+*/
|
|
|
+}
|
|
|
|
|
|
#ifdef CMD_DIAGNOSTICS
|
|
|
+// Print CMD queue diagnostic (8 chars total)
|
|
|
+void lcdui_print_cmd_diag(void)
|
|
|
+{
|
|
|
lcd_set_cursor(LCD_WIDTH - 8 -1, 2);
|
|
|
lcd_puts_P(PSTR(" C"));
|
|
|
lcd_print(buflen); // number of commands in cmd buffer
|
|
|
if (buflen < 9) lcd_puts_P(" ");
|
|
|
-#else
|
|
|
- //Print time
|
|
|
- lcd_set_cursor(LCD_WIDTH - 8, 2);
|
|
|
- lcd_print_time();
|
|
|
+}
|
|
|
#endif //CMD_DIAGNOSTICS
|
|
|
|
|
|
-#ifdef DEBUG_DISABLE_LCD_STATUS_LINE
|
|
|
- return;
|
|
|
-#endif //DEBUG_DISABLE_LCD_STATUS_LINE
|
|
|
-
|
|
|
- //Print status line
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
-
|
|
|
- // If heating in progress, set flag
|
|
|
- if (heating_status != 0) { custom_message = true; }
|
|
|
+// Print time (8 chars total)
|
|
|
+void lcdui_print_time(void)
|
|
|
+{
|
|
|
+ //if remaining print time estimation is available print it else print elapsed time
|
|
|
+ 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;
|
|
|
+ int chars = 0;
|
|
|
+ if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (starttime != 0)))
|
|
|
+ {
|
|
|
+ char suff = (print_time_remaining_normal == PRINT_TIME_REMAINING_INIT)?' ':'R';
|
|
|
+ chars = lcd_printf_P(_N("%c%02u:%02u%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ chars = lcd_printf_P(_N("%c--:-- "), LCD_STR_CLOCK[0]);
|
|
|
+ lcd_space(8 - chars);
|
|
|
+}
|
|
|
|
|
|
- if (IS_SD_PRINTING) {
|
|
|
+//Print status line on status screen
|
|
|
+void lcdui_print_status_line(void)
|
|
|
+{
|
|
|
+ if (IS_SD_PRINTING)
|
|
|
+ {
|
|
|
if (strcmp(longFilenameOLD, card.longFilename) != 0)
|
|
|
{
|
|
|
memset(longFilenameOLD, '\0', strlen(longFilenameOLD));
|
|
@@ -693,150 +614,127 @@ if (print_sd_status)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // If printing from SD, show what we are printing
|
|
|
- if ((IS_SD_PRINTING) && !custom_message
|
|
|
-#ifdef DEBUG_BUILD
|
|
|
- && lcd_status_message[0] == 0
|
|
|
-#endif /* DEBUG_BUILD */
|
|
|
- )
|
|
|
+ if (heating_status)
|
|
|
+ { // If heating flag, show progress of heating
|
|
|
+ heating_status_counter++;
|
|
|
+ if (heating_status_counter > 13)
|
|
|
+ {
|
|
|
+ heating_status_counter = 0;
|
|
|
+ }
|
|
|
+ lcd_set_cursor(7, 3);
|
|
|
+ lcd_puts_P(PSTR(" "));
|
|
|
|
|
|
- {
|
|
|
- if(strlen(card.longFilename) > LCD_WIDTH)
|
|
|
- {
|
|
|
-
|
|
|
- int inters = 0;
|
|
|
- int gh = scrollstuff;
|
|
|
- while (((gh - scrollstuff) < LCD_WIDTH) && (inters == 0))
|
|
|
- {
|
|
|
-
|
|
|
- if (card.longFilename[gh] == '\0')
|
|
|
- {
|
|
|
- lcd_set_cursor(gh - scrollstuff, 3);
|
|
|
- lcd_print(card.longFilename[gh - 1]);
|
|
|
- scrollstuff = 0;
|
|
|
- gh = scrollstuff;
|
|
|
- inters = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lcd_set_cursor(gh - scrollstuff, 3);
|
|
|
- lcd_print(card.longFilename[gh - 1]);
|
|
|
- gh++;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- scrollstuff++;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lcd_print(longFilenameOLD);
|
|
|
- }
|
|
|
+ for (unsigned int dots = 0; dots < heating_status_counter; dots++)
|
|
|
+ {
|
|
|
+ lcd_set_cursor(7 + dots, 3);
|
|
|
+ lcd_print('.');
|
|
|
+ }
|
|
|
+ switch (heating_status)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(_T(MSG_HEATING));
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(_T(MSG_HEATING_COMPLETE));
|
|
|
+ heating_status = 0;
|
|
|
+ heating_status_counter = 0;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(_T(MSG_BED_HEATING));
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(_T(MSG_BED_DONE));
|
|
|
+ heating_status = 0;
|
|
|
+ heating_status_counter = 0;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- // If not, check for other special events
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
- if (custom_message)
|
|
|
+ else if ((IS_SD_PRINTING) && (custom_message_type == CUSTOM_MSG_TYPE_STATUS))
|
|
|
+ { // If printing from SD, show what we are printing
|
|
|
+ if(strlen(card.longFilename) > LCD_WIDTH)
|
|
|
{
|
|
|
- // If heating flag, show progress of heating.
|
|
|
- if (heating_status != 0)
|
|
|
+ int inters = 0;
|
|
|
+ int gh = scrollstuff;
|
|
|
+ while (((gh - scrollstuff) < LCD_WIDTH) && (inters == 0))
|
|
|
{
|
|
|
- heating_status_counter++;
|
|
|
- if (heating_status_counter > 13)
|
|
|
+ if (card.longFilename[gh] == '\0')
|
|
|
{
|
|
|
- heating_status_counter = 0;
|
|
|
+ lcd_set_cursor(gh - scrollstuff, 3);
|
|
|
+ lcd_print(card.longFilename[gh - 1]);
|
|
|
+ scrollstuff = 0;
|
|
|
+ gh = scrollstuff;
|
|
|
+ inters = 1;
|
|
|
}
|
|
|
- lcd_set_cursor(7, 3);
|
|
|
- lcd_puts_P(PSTR(" "));
|
|
|
-
|
|
|
- for (unsigned int dots = 0; dots < heating_status_counter; dots++)
|
|
|
- {
|
|
|
- lcd_set_cursor(7 + dots, 3);
|
|
|
- lcd_print('.');
|
|
|
- }
|
|
|
-
|
|
|
- switch (heating_status)
|
|
|
+ else
|
|
|
{
|
|
|
- case 1:
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(_T(MSG_HEATING));
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(_T(MSG_HEATING_COMPLETE));
|
|
|
- heating_status = 0;
|
|
|
- heating_status_counter = 0;
|
|
|
- custom_message = false;
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(_T(MSG_BED_HEATING));
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(_T(MSG_BED_DONE));
|
|
|
- heating_status = 0;
|
|
|
- heating_status_counter = 0;
|
|
|
- custom_message = false;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ lcd_set_cursor(gh - scrollstuff, 3);
|
|
|
+ lcd_print(card.longFilename[gh - 1]);
|
|
|
+ gh++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // If mesh bed leveling in progress, show the status
|
|
|
-
|
|
|
- if (custom_message_type == 1)
|
|
|
+ scrollstuff++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lcd_print(longFilenameOLD);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { // Otherwise check for other special events
|
|
|
+ switch (custom_message_type)
|
|
|
+ {
|
|
|
+ case CUSTOM_MSG_TYPE_STATUS: // Nothing special, print status message normally
|
|
|
+ lcd_print(lcd_status_message);
|
|
|
+ break;
|
|
|
+ case CUSTOM_MSG_TYPE_MESHBL: // If mesh bed leveling in progress, show the status
|
|
|
+ if (custom_message_state > 10)
|
|
|
{
|
|
|
- if (custom_message_state > 10)
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(PSTR(" "));
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(_T(MSG_CALIBRATE_Z_AUTO));
|
|
|
+ lcd_puts_P(PSTR(" : "));
|
|
|
+ lcd_print(custom_message_state-10);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (custom_message_state == 3)
|
|
|
{
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(PSTR(" "));
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(_T(MSG_CALIBRATE_Z_AUTO));
|
|
|
- lcd_puts_P(PSTR(" : "));
|
|
|
- lcd_print(custom_message_state-10);
|
|
|
+ lcd_puts_P(_T(WELCOME_MSG));
|
|
|
+ lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
|
|
}
|
|
|
- else
|
|
|
+ if (custom_message_state > 3 && custom_message_state <= 10 )
|
|
|
{
|
|
|
- if (custom_message_state == 3)
|
|
|
- {
|
|
|
- lcd_puts_P(_T(WELCOME_MSG));
|
|
|
- lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
- custom_message = false;
|
|
|
- custom_message_type = 0;
|
|
|
- }
|
|
|
- if (custom_message_state > 3 && custom_message_state <= 10 )
|
|
|
- {
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(PSTR(" "));
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(_i("Calibration done"));////MSG_HOMEYZ_DONE c=0 r=0
|
|
|
- custom_message_state--;
|
|
|
- }
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(PSTR(" "));
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(_i("Calibration done"));////MSG_HOMEYZ_DONE c=0 r=0
|
|
|
+ custom_message_state--;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- // If loading filament, print status
|
|
|
- if (custom_message_type == 2)
|
|
|
+ break;
|
|
|
+ case CUSTOM_MSG_TYPE_F_LOAD: // If loading filament, print status
|
|
|
+ lcd_print(lcd_status_message);
|
|
|
+ break;
|
|
|
+ case CUSTOM_MSG_TYPE_PIDCAL: // PID tuning in progress
|
|
|
+ lcd_print(lcd_status_message);
|
|
|
+ if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0)
|
|
|
{
|
|
|
- lcd_print(lcd_status_message);
|
|
|
+ lcd_set_cursor(10, 3);
|
|
|
+ lcd_print(itostr3(pid_cycle));
|
|
|
+ lcd_print('/');
|
|
|
+ lcd_print(itostr3left(pid_number_of_cycles));
|
|
|
}
|
|
|
- // PID tuning in progress
|
|
|
- if (custom_message_type == 3) {
|
|
|
- lcd_print(lcd_status_message);
|
|
|
- if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) {
|
|
|
- lcd_set_cursor(10, 3);
|
|
|
- lcd_print(itostr3(pid_cycle));
|
|
|
-
|
|
|
- lcd_print('/');
|
|
|
- lcd_print(itostr3left(pid_number_of_cycles));
|
|
|
- }
|
|
|
- }
|
|
|
- // PINDA temp calibration in progress
|
|
|
- if (custom_message_type == 4) {
|
|
|
+ break;
|
|
|
+ case CUSTOM_MSG_TYPE_TEMCAL: // PINDA temp calibration in progress
|
|
|
+ {
|
|
|
char progress[4];
|
|
|
lcd_set_cursor(0, 3);
|
|
|
lcd_puts_P(_T(MSG_TEMP_CALIBRATION));
|
|
@@ -844,199 +742,214 @@ if (print_sd_status)
|
|
|
sprintf(progress, "%d/6", custom_message_state);
|
|
|
lcd_print(progress);
|
|
|
}
|
|
|
- // temp compensation preheat
|
|
|
- if (custom_message_type == 5) {
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(_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;
|
|
|
+ case CUSTOM_MSG_TYPE_TEMPRE: // temp compensation preheat
|
|
|
+ lcd_set_cursor(0, 3);
|
|
|
+ lcd_puts_P(_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(' ');
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Nothing special, print status message normally
|
|
|
- lcd_print(lcd_status_message);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// Fill the rest of line to have nice and clean output
|
|
|
- for(int fillspace = 0; fillspace<20;fillspace++)
|
|
|
- {
|
|
|
- if((lcd_status_message[fillspace] > 31 ))
|
|
|
- {
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lcd_print(' ');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ for(int fillspace = 0; fillspace < 20; fillspace++)
|
|
|
+ if ((lcd_status_message[fillspace] <= 31 ))
|
|
|
+ lcd_print(' ');
|
|
|
}
|
|
|
|
|
|
+void lcdui_print_status_screen(void)
|
|
|
+{
|
|
|
+//|01234567890123456789|
|
|
|
+//|N 000/000D Z000.0 |
|
|
|
+//|B 000/000D F100% |
|
|
|
+//|USB100% T0 t--:-- |
|
|
|
+//|Status line.........|
|
|
|
+//----------------------
|
|
|
+//N - nozzle temp symbol LCD_STR_THERMOMETER
|
|
|
+//B - bed temp symbol LCD_STR_BEDTEMP
|
|
|
+//F - feedrate symbol LCD_STR_FEEDRATE
|
|
|
+//t - clock symbol LCD_STR_THERMOMETER
|
|
|
|
|
|
-/* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
|
|
|
+ lcd_set_cursor(0, 0); //line 0
|
|
|
|
|
|
-static void lcd_status_screen()
|
|
|
-{
|
|
|
- if (firstrun == 1)
|
|
|
- {
|
|
|
- firstrun = 0;
|
|
|
-
|
|
|
- if(lcd_status_message_level == 0){
|
|
|
- strncpy_P(lcd_status_message, _T(WELCOME_MSG), LCD_WIDTH);
|
|
|
- lcd_finishstatus();
|
|
|
- }
|
|
|
- if (eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 1) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 2) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 3) == 255)
|
|
|
- {
|
|
|
- eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0);
|
|
|
- eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ //Print the hotend temperature (9 chars total)
|
|
|
+ lcdui_print_temp(LCD_STR_THERMOMETER[0], (int)(degHotend(0) + 0.5), (int)(degTargetHotend(0) + 0.5));
|
|
|
|
|
|
-
|
|
|
- if (lcd_status_update_delay)
|
|
|
- lcd_status_update_delay--;
|
|
|
- else
|
|
|
- lcd_draw_update = 1;
|
|
|
- if (lcd_draw_update)
|
|
|
- {
|
|
|
- ReInitLCD++;
|
|
|
+ lcd_space(3); //3 spaces
|
|
|
|
|
|
+ //Print Z-coordinate (8 chars total)
|
|
|
+ lcdui_print_Z_coord();
|
|
|
|
|
|
- if (ReInitLCD == 30)
|
|
|
- {
|
|
|
- lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
|
|
|
- ReInitLCD = 0 ;
|
|
|
- }
|
|
|
+ lcd_set_cursor(0, 1); //line 1
|
|
|
+
|
|
|
+ //Print the Bed temperature (9 chars total)
|
|
|
+ lcdui_print_temp(LCD_STR_BEDTEMP[0], (int)(degBed() + 0.5), (int)(degTargetBed() + 0.5));
|
|
|
+
|
|
|
+ lcd_space(3); //3 spaces
|
|
|
+
|
|
|
+#ifdef PLANNER_DIAGNOSTICS
|
|
|
+ //Print planner diagnostics (8 chars)
|
|
|
+ lcdui_print_planner_diag();
|
|
|
+#else // PLANNER_DIAGNOSTICS
|
|
|
+ //Print Feedrate (8 chars)
|
|
|
+ lcdui_print_feedrate();
|
|
|
+#endif // PLANNER_DIAGNOSTICS
|
|
|
+
|
|
|
+ lcd_set_cursor(0, 2); //line 2
|
|
|
+
|
|
|
+ //Print SD status (7 chars)
|
|
|
+ lcdui_print_percent_done();
|
|
|
+
|
|
|
+ if (mmu_enabled)
|
|
|
+ //Print extruder status (5 chars)
|
|
|
+ lcdui_print_extruder();
|
|
|
+ else if (farm_mode)
|
|
|
+ //Print farm number (5 chars)
|
|
|
+ lcdui_print_farm();
|
|
|
else
|
|
|
- {
|
|
|
+ lcd_space(5); //5 spaces
|
|
|
|
|
|
- if ((ReInitLCD % 10) == 0)
|
|
|
- {
|
|
|
- lcd_refresh_noclear(); //to maybe revive the LCD if static electricity killed it.
|
|
|
- }
|
|
|
+#ifdef CMD_DIAGNOSTICS
|
|
|
+ //Print cmd queue diagnostics (8chars)
|
|
|
+ lcdui_print_cmd_diag();
|
|
|
+#else
|
|
|
+ //Print time (8chars)
|
|
|
+ lcdui_print_time();
|
|
|
+#endif //CMD_DIAGNOSTICS
|
|
|
|
|
|
- }
|
|
|
+ lcd_set_cursor(0, 3); //line 3
|
|
|
|
|
|
+#ifndef DEBUG_DISABLE_LCD_STATUS_LINE
|
|
|
+ lcdui_print_status_line();
|
|
|
+#endif //DEBUG_DISABLE_LCD_STATUS_LINE
|
|
|
|
|
|
- lcd_implementation_status_screen();
|
|
|
- //lcd_clear();
|
|
|
+}
|
|
|
|
|
|
- if (farm_mode)
|
|
|
+// Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent
|
|
|
+static void lcd_status_screen()
|
|
|
+{
|
|
|
+ if (firstrun == 1)
|
|
|
{
|
|
|
- farm_timer--;
|
|
|
- if (farm_timer < 1)
|
|
|
+ firstrun = 0;
|
|
|
+ if(lcd_status_message_level == 0)
|
|
|
{
|
|
|
- farm_timer = 10;
|
|
|
- prusa_statistics(0);
|
|
|
+ strncpy_P(lcd_status_message, _T(WELCOME_MSG), LCD_WIDTH);
|
|
|
+ lcd_finishstatus();
|
|
|
}
|
|
|
- switch (farm_timer)
|
|
|
+ if (eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 1) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 2) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 3) == 255)
|
|
|
{
|
|
|
- case 8:
|
|
|
- prusa_statistics(21);
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- if (IS_SD_PRINTING)
|
|
|
- {
|
|
|
- prusa_statistics(20);
|
|
|
- }
|
|
|
- break;
|
|
|
+ eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0);
|
|
|
+ eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0);
|
|
|
}
|
|
|
- } // end of farm_mode
|
|
|
+ }
|
|
|
|
|
|
+ if (lcd_status_update_delay)
|
|
|
+ lcd_status_update_delay--;
|
|
|
+ else
|
|
|
+ lcd_draw_update = 1;
|
|
|
|
|
|
|
|
|
+ if (lcd_draw_update)
|
|
|
+ {
|
|
|
+ ReInitLCD++;
|
|
|
+ if (ReInitLCD == 30)
|
|
|
+ {
|
|
|
+ lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
|
|
|
+ ReInitLCD = 0 ;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if ((ReInitLCD % 10) == 0)
|
|
|
+ lcd_refresh_noclear(); //to maybe revive the LCD if static electricity killed it.
|
|
|
+ }
|
|
|
|
|
|
+ lcdui_print_status_screen();
|
|
|
|
|
|
- lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
|
|
|
- if (lcd_commands_type != LCD_COMMAND_IDLE)
|
|
|
- {
|
|
|
- lcd_commands();
|
|
|
- }
|
|
|
-
|
|
|
+ if (farm_mode)
|
|
|
+ {
|
|
|
+ farm_timer--;
|
|
|
+ if (farm_timer < 1)
|
|
|
+ {
|
|
|
+ farm_timer = 10;
|
|
|
+ prusa_statistics(0);
|
|
|
+ }
|
|
|
+ switch (farm_timer)
|
|
|
+ {
|
|
|
+ case 8:
|
|
|
+ prusa_statistics(21);
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ if (IS_SD_PRINTING)
|
|
|
+ prusa_statistics(20);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } // end of farm_mode
|
|
|
|
|
|
- } // end of lcd_draw_update
|
|
|
+ lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
|
|
|
+ if (lcd_commands_type != LCD_COMMAND_IDLE)
|
|
|
+ lcd_commands();
|
|
|
+ } // end of lcd_draw_update
|
|
|
|
|
|
- bool current_click = LCD_CLICKED;
|
|
|
+ bool current_click = LCD_CLICKED;
|
|
|
|
|
|
- if (ignore_click) {
|
|
|
- if (wait_for_unclick) {
|
|
|
- if (!current_click) {
|
|
|
- ignore_click = wait_for_unclick = false;
|
|
|
- }
|
|
|
- else {
|
|
|
- current_click = false;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (current_click) {
|
|
|
- lcd_quick_feedback();
|
|
|
- wait_for_unclick = true;
|
|
|
- current_click = false;
|
|
|
- }
|
|
|
- }
|
|
|
+ if (ignore_click)
|
|
|
+ {
|
|
|
+ if (wait_for_unclick)
|
|
|
+ {
|
|
|
+ if (!current_click)
|
|
|
+ ignore_click = wait_for_unclick = false;
|
|
|
+ else
|
|
|
+ current_click = false;
|
|
|
+ }
|
|
|
+ else if (current_click)
|
|
|
+ {
|
|
|
+ lcd_quick_feedback();
|
|
|
+ wait_for_unclick = true;
|
|
|
+ current_click = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (current_click && (lcd_commands_type != LCD_COMMAND_STOP_PRINT)) //click is aborted unless stop print finishes
|
|
|
- {
|
|
|
- menu_depth = 0; //redundant, as already done in lcd_return_to_status(), just to be sure
|
|
|
- menu_submenu(lcd_main_menu);
|
|
|
- lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
|
|
|
- }
|
|
|
+ if (current_click && (lcd_commands_type != LCD_COMMAND_STOP_PRINT)) //click is aborted unless stop print finishes
|
|
|
+ {
|
|
|
+ menu_depth = 0; //redundant, as already done in lcd_return_to_status(), just to be sure
|
|
|
+ menu_submenu(lcd_main_menu);
|
|
|
+ lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
|
|
|
+ }
|
|
|
|
|
|
#ifdef ULTIPANEL_FEEDMULTIPLY
|
|
|
- // Dead zone at 100% feedrate
|
|
|
- if ((feedmultiply < 100 && (feedmultiply + int(lcd_encoder)) > 100) ||
|
|
|
- (feedmultiply > 100 && (feedmultiply + int(lcd_encoder)) < 100))
|
|
|
- {
|
|
|
- lcd_encoder = 0;
|
|
|
- feedmultiply = 100;
|
|
|
- }
|
|
|
-
|
|
|
- if (feedmultiply == 100 && int(lcd_encoder) > ENCODER_FEEDRATE_DEADZONE)
|
|
|
- {
|
|
|
- feedmultiply += int(lcd_encoder) - ENCODER_FEEDRATE_DEADZONE;
|
|
|
- lcd_encoder = 0;
|
|
|
- }
|
|
|
- else if (feedmultiply == 100 && int(lcd_encoder) < -ENCODER_FEEDRATE_DEADZONE)
|
|
|
- {
|
|
|
- feedmultiply += int(lcd_encoder) + ENCODER_FEEDRATE_DEADZONE;
|
|
|
- lcd_encoder = 0;
|
|
|
- }
|
|
|
- else if (feedmultiply != 100)
|
|
|
- {
|
|
|
- feedmultiply += int(lcd_encoder);
|
|
|
- lcd_encoder = 0;
|
|
|
- }
|
|
|
+ // Dead zone at 100% feedrate
|
|
|
+ if ((feedmultiply < 100 && (feedmultiply + int(lcd_encoder)) > 100) ||
|
|
|
+ (feedmultiply > 100 && (feedmultiply + int(lcd_encoder)) < 100))
|
|
|
+ {
|
|
|
+ lcd_encoder = 0;
|
|
|
+ feedmultiply = 100;
|
|
|
+ }
|
|
|
+ if (feedmultiply == 100 && int(lcd_encoder) > ENCODER_FEEDRATE_DEADZONE)
|
|
|
+ {
|
|
|
+ feedmultiply += int(lcd_encoder) - ENCODER_FEEDRATE_DEADZONE;
|
|
|
+ lcd_encoder = 0;
|
|
|
+ }
|
|
|
+ else if (feedmultiply == 100 && int(lcd_encoder) < -ENCODER_FEEDRATE_DEADZONE)
|
|
|
+ {
|
|
|
+ feedmultiply += int(lcd_encoder) + ENCODER_FEEDRATE_DEADZONE;
|
|
|
+ lcd_encoder = 0;
|
|
|
+ }
|
|
|
+ else if (feedmultiply != 100)
|
|
|
+ {
|
|
|
+ feedmultiply += int(lcd_encoder);
|
|
|
+ lcd_encoder = 0;
|
|
|
+ }
|
|
|
#endif //ULTIPANEL_FEEDMULTIPLY
|
|
|
|
|
|
- if (feedmultiply < 10)
|
|
|
- feedmultiply = 10;
|
|
|
- else if (feedmultiply > 999)
|
|
|
- feedmultiply = 999;
|
|
|
-
|
|
|
- /*if (farm_mode && !printer_connected) {
|
|
|
- lcd_set_cursor(0, 3);
|
|
|
- lcd_puts_P(_i("Printer disconnected"));////MSG_PRINTER_DISCONNECTED c=20 r=1
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
-//#define FSENS_FACTOR (2580.8/50) //filament sensor factor [steps / encoder counts]
|
|
|
-//#define FSENS_FACTOR (2580.8/45.3) //filament sensor factor [steps / encoder counts]
|
|
|
- //lcd_set_cursor(0, 3);
|
|
|
- //lcd_print(" ");
|
|
|
- //lcd_set_cursor(0, 3);
|
|
|
- //lcd_print(pat9125_x);
|
|
|
- //lcd_set_cursor(6, 3);
|
|
|
- //lcd_print(pat9125_y);
|
|
|
- //lcd_set_cursor(12, 3);
|
|
|
- //lcd_print(pat9125_b);
|
|
|
-
|
|
|
+ if (feedmultiply < 10)
|
|
|
+ feedmultiply = 10;
|
|
|
+ else if (feedmultiply > 999)
|
|
|
+ feedmultiply = 999;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1637,7 +1550,6 @@ void lcd_commands()
|
|
|
if (lcd_commands_step == 0)
|
|
|
{
|
|
|
lcd_commands_step = 6;
|
|
|
- custom_message = true;
|
|
|
}
|
|
|
|
|
|
if (lcd_commands_step == 1 && !blocks_queued())
|
|
@@ -1645,8 +1557,7 @@ void lcd_commands()
|
|
|
lcd_commands_step = 0;
|
|
|
lcd_commands_type = 0;
|
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
- custom_message_type = 0;
|
|
|
- custom_message = false;
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
|
|
isPrintPaused = false;
|
|
|
}
|
|
|
if (lcd_commands_step == 2 && !blocks_queued())
|
|
@@ -1702,8 +1613,7 @@ void lcd_commands()
|
|
|
if (mmu_enabled)
|
|
|
setAllTargetHotends(0);
|
|
|
manage_heater();
|
|
|
- custom_message = true;
|
|
|
- custom_message_type = 2;
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_F_LOAD;
|
|
|
lcd_commands_step = 5;
|
|
|
}
|
|
|
if (lcd_commands_step == 7 && !blocks_queued())
|
|
@@ -1733,7 +1643,7 @@ void lcd_commands()
|
|
|
if (lcd_commands_type == LCD_COMMAND_FARM_MODE_CONFIRM) /// farm mode confirm
|
|
|
{
|
|
|
|
|
|
- if (lcd_commands_step == 0) { lcd_commands_step = 6; custom_message = true; }
|
|
|
+ if (lcd_commands_step == 0) { lcd_commands_step = 6; }
|
|
|
|
|
|
if (lcd_commands_step == 1 && !blocks_queued())
|
|
|
{
|
|
@@ -1776,9 +1686,8 @@ void lcd_commands()
|
|
|
char cmd1[30];
|
|
|
|
|
|
if (lcd_commands_step == 0) {
|
|
|
- custom_message_type = 3;
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_PIDCAL;
|
|
|
custom_message_state = 1;
|
|
|
- custom_message = true;
|
|
|
lcd_draw_update = 3;
|
|
|
lcd_commands_step = 3;
|
|
|
}
|
|
@@ -1811,8 +1720,7 @@ void lcd_commands()
|
|
|
}
|
|
|
if ((lcd_commands_step == 1) && ((millis()- display_time)>2000)) { //calibration finished message
|
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
- custom_message_type = 0;
|
|
|
- custom_message = false;
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
|
|
pid_temp = DEFAULT_PID_TEMP;
|
|
|
lcd_commands_step = 0;
|
|
|
lcd_commands_type = 0;
|
|
@@ -2525,7 +2433,7 @@ static void lcd_LoadFilament()
|
|
|
{
|
|
|
if (degHotend0() > EXTRUDE_MINTEMP)
|
|
|
{
|
|
|
- custom_message = true;
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_F_LOAD;
|
|
|
loading_flag = true;
|
|
|
enquecommand_P(PSTR("M701")); //load filament
|
|
|
SERIAL_ECHOLN("Loading filament");
|
|
@@ -2653,7 +2561,7 @@ static void _lcd_move(const char *name, int axis, int min, int max)
|
|
|
lcd_set_cursor(0, 1);
|
|
|
menu_draw_float31(' ', name, current_position[axis]);
|
|
|
}
|
|
|
- if (menuExiting || LCD_CLICKED) (void)enable_endstops(_md->endstopsEnabledPrevious);
|
|
|
+ if (menu_leaving || LCD_CLICKED) (void)enable_endstops(_md->endstopsEnabledPrevious);
|
|
|
if (LCD_CLICKED) menu_back();
|
|
|
}
|
|
|
|
|
@@ -2885,7 +2793,7 @@ static void _lcd_babystep(int axis, const char *msg)
|
|
|
lcd_set_cursor(0, 1);
|
|
|
menu_draw_float13(' ', msg, _md->babystepMemMM[axis]);
|
|
|
}
|
|
|
- if (LCD_CLICKED || menuExiting)
|
|
|
+ if (LCD_CLICKED || menu_leaving)
|
|
|
{
|
|
|
// Only update the EEPROM when leaving the menu.
|
|
|
EEPROM_save_B(
|
|
@@ -2896,35 +2804,36 @@ static void _lcd_babystep(int axis, const char *msg)
|
|
|
if (LCD_CLICKED) menu_back();
|
|
|
}
|
|
|
|
|
|
-static void lcd_babystep_x() {
|
|
|
+static void lcd_babystep_x()
|
|
|
+{
|
|
|
_lcd_babystep(X_AXIS, (_i("Babystepping X")));////MSG_BABYSTEPPING_X c=0 r=0
|
|
|
}
|
|
|
-static void lcd_babystep_y() {
|
|
|
+
|
|
|
+static void lcd_babystep_y()
|
|
|
+{
|
|
|
_lcd_babystep(Y_AXIS, (_i("Babystepping Y")));////MSG_BABYSTEPPING_Y c=0 r=0
|
|
|
}
|
|
|
-static void lcd_babystep_z() {
|
|
|
+
|
|
|
+static void lcd_babystep_z()
|
|
|
+{
|
|
|
_lcd_babystep(Z_AXIS, (_i("Adjusting Z")));////MSG_BABYSTEPPING_Z c=20 r=0
|
|
|
}
|
|
|
|
|
|
-static void lcd_adjust_bed();
|
|
|
|
|
|
typedef struct
|
|
|
-{ // 13bytes total
|
|
|
+{ // 12bytes + 9bytes = 21bytes total
|
|
|
+ uint8_t reserved[MENU_DATA_EDIT_SIZE]; //12 bytes reserved for number editing functions
|
|
|
int8_t status; // 1byte
|
|
|
- int8_t left; // 1byte
|
|
|
- int8_t right; // 1byte
|
|
|
- int8_t front; // 1byte
|
|
|
- int8_t rear; // 1byte
|
|
|
- int left2; // 2byte
|
|
|
- int right2; // 2byte
|
|
|
- int front2; // 2byte
|
|
|
- int rear2; // 2byte
|
|
|
+ int16_t left; // 2byte
|
|
|
+ int16_t right; // 2byte
|
|
|
+ int16_t front; // 2byte
|
|
|
+ int16_t rear; // 2byte
|
|
|
} _menu_data_adjust_bed_t;
|
|
|
-#if (13 > MENU_DATA_SIZE)
|
|
|
+#if (21 > MENU_DATA_SIZE)
|
|
|
#error "check MENU_DATA_SIZE definition!"
|
|
|
#endif
|
|
|
|
|
|
-static void lcd_adjust_bed_reset()
|
|
|
+void lcd_adjust_bed_reset(void)
|
|
|
{
|
|
|
eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1);
|
|
|
eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_LEFT , 0);
|
|
@@ -2935,73 +2844,48 @@ static void lcd_adjust_bed_reset()
|
|
|
_md->status = 0;
|
|
|
}
|
|
|
|
|
|
-void adjust_bed_reset()
|
|
|
-{
|
|
|
- _menu_data_adjust_bed_t* _md = (_menu_data_adjust_bed_t*)&(menu_data[0]);
|
|
|
- eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1);
|
|
|
- eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_LEFT, 0);
|
|
|
- eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_RIGHT, 0);
|
|
|
- eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_FRONT, 0);
|
|
|
- eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_REAR, 0);
|
|
|
- _md->left = _md->left2 = 0;
|
|
|
- _md->right = _md->right2 = 0;
|
|
|
- _md->front = _md->front2 = 0;
|
|
|
- _md->rear = _md->rear2 = 0;
|
|
|
-}
|
|
|
-
|
|
|
#define BED_ADJUSTMENT_UM_MAX 50
|
|
|
|
|
|
-static void lcd_adjust_bed()
|
|
|
+void lcd_adjust_bed(void)
|
|
|
{
|
|
|
_menu_data_adjust_bed_t* _md = (_menu_data_adjust_bed_t*)&(menu_data[0]);
|
|
|
if (_md->status == 0)
|
|
|
{
|
|
|
// Menu was entered.
|
|
|
- // Initialize its status.
|
|
|
+ _md->left = 0;
|
|
|
+ _md->right = 0;
|
|
|
+ _md->front = 0;
|
|
|
+ _md->rear = 0;
|
|
|
+ if (eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1)
|
|
|
+ {
|
|
|
+ _md->left = eeprom_read_int8((unsigned char*)EEPROM_BED_CORRECTION_LEFT);
|
|
|
+ _md->right = eeprom_read_int8((unsigned char*)EEPROM_BED_CORRECTION_RIGHT);
|
|
|
+ _md->front = eeprom_read_int8((unsigned char*)EEPROM_BED_CORRECTION_FRONT);
|
|
|
+ _md->rear = eeprom_read_int8((unsigned char*)EEPROM_BED_CORRECTION_REAR);
|
|
|
+ }
|
|
|
_md->status = 1;
|
|
|
- bool valid = false;
|
|
|
- _md->left = _md->left2 = eeprom_read_int8((unsigned char*)EEPROM_BED_CORRECTION_LEFT);
|
|
|
- _md->right = _md->right2 = eeprom_read_int8((unsigned char*)EEPROM_BED_CORRECTION_RIGHT);
|
|
|
- _md->front = _md->front2 = eeprom_read_int8((unsigned char*)EEPROM_BED_CORRECTION_FRONT);
|
|
|
- _md->rear = _md->rear2 = eeprom_read_int8((unsigned char*)EEPROM_BED_CORRECTION_REAR);
|
|
|
- if (eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1 &&
|
|
|
- _md->left >= -BED_ADJUSTMENT_UM_MAX && _md->left <= BED_ADJUSTMENT_UM_MAX &&
|
|
|
- _md->right >= -BED_ADJUSTMENT_UM_MAX && _md->right <= BED_ADJUSTMENT_UM_MAX &&
|
|
|
- _md->front >= -BED_ADJUSTMENT_UM_MAX && _md->front <= BED_ADJUSTMENT_UM_MAX &&
|
|
|
- _md->rear >= -BED_ADJUSTMENT_UM_MAX && _md->rear <= BED_ADJUSTMENT_UM_MAX)
|
|
|
- valid = true;
|
|
|
- if (! valid) {
|
|
|
- // Reset the values: simulate an edit.
|
|
|
- _md->left2 = 0;
|
|
|
- _md->right2 = 0;
|
|
|
- _md->front2 = 0;
|
|
|
- _md->rear2 = 0;
|
|
|
- }
|
|
|
- lcd_draw_update = 1;
|
|
|
- eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1);
|
|
|
}
|
|
|
-
|
|
|
- if (_md->left != _md->left2)
|
|
|
- eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_LEFT, _md->left = _md->left2);
|
|
|
- if (_md->right != _md->right2)
|
|
|
- eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_RIGHT, _md->right = _md->right2);
|
|
|
- if (_md->front != _md->front2)
|
|
|
- eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_FRONT, _md->front = _md->front2);
|
|
|
- if (_md->rear != _md->rear2)
|
|
|
- eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_REAR, _md->rear = _md->rear2);
|
|
|
-
|
|
|
MENU_BEGIN();
|
|
|
- MENU_ITEM_BACK_P(_T(MSG_SETTINGS));
|
|
|
- MENU_ITEM_EDIT_int3_P(_i("Left side [um]"), &_md->left2, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_LEFT c=14 r=1
|
|
|
- MENU_ITEM_EDIT_int3_P(_i("Right side[um]"), &_md->right2, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_RIGHT c=14 r=1
|
|
|
- MENU_ITEM_EDIT_int3_P(_i("Front side[um]"), &_md->front2, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_FRONT c=14 r=1
|
|
|
- MENU_ITEM_EDIT_int3_P(_i("Rear side [um]"), &_md->rear2, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_REAR c=14 r=1
|
|
|
+ // leaving menu - this condition must be immediately before MENU_ITEM_BACK_P
|
|
|
+ if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving)
|
|
|
+ {
|
|
|
+ eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_LEFT, _md->left);
|
|
|
+ eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_RIGHT, _md->right);
|
|
|
+ eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_FRONT, _md->front);
|
|
|
+ eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_REAR, _md->rear);
|
|
|
+ eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1);
|
|
|
+ }
|
|
|
+ MENU_ITEM_BACK_P(_T(MSG_SETTINGS));
|
|
|
+ MENU_ITEM_EDIT_int3_P(_i("Left side [um]"), &_md->left, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_LEFT c=14 r=1
|
|
|
+ MENU_ITEM_EDIT_int3_P(_i("Right side[um]"), &_md->right, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_RIGHT c=14 r=1
|
|
|
+ MENU_ITEM_EDIT_int3_P(_i("Front side[um]"), &_md->front, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_FRONT c=14 r=1
|
|
|
+ MENU_ITEM_EDIT_int3_P(_i("Rear side [um]"), &_md->rear, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_REAR c=14 r=1
|
|
|
MENU_ITEM_FUNCTION_P(_i("Reset"), lcd_adjust_bed_reset);////MSG_BED_CORRECTION_RESET c=0 r=0
|
|
|
MENU_END();
|
|
|
}
|
|
|
|
|
|
-void pid_extruder() {
|
|
|
-
|
|
|
+void pid_extruder()
|
|
|
+{
|
|
|
lcd_clear();
|
|
|
lcd_set_cursor(1, 0);
|
|
|
lcd_puts_P(_i("Set temperature:"));////MSG_SET_TEMPERATURE c=19 r=1
|
|
@@ -3606,8 +3490,7 @@ void lcd_bed_calibration_show_result(uint8_t result, uint8_t point_too_far_mask)
|
|
|
|
|
|
void lcd_temp_cal_show_result(bool result) {
|
|
|
|
|
|
- custom_message_type = 0;
|
|
|
- custom_message = false;
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
|
|
disable_x();
|
|
|
disable_y();
|
|
|
disable_z();
|
|
@@ -5254,8 +5137,7 @@ static void change_extr_menu(){
|
|
|
//unload filament for single material printer (used in M702 gcode)
|
|
|
void unload_filament()
|
|
|
{
|
|
|
- custom_message = true;
|
|
|
- custom_message_type = 2;
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_F_LOAD;
|
|
|
lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT));
|
|
|
|
|
|
// extr_unload2();
|
|
@@ -5290,8 +5172,7 @@ void unload_filament()
|
|
|
lcd_update_enable(true);
|
|
|
|
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
- custom_message = false;
|
|
|
- custom_message_type = 0;
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -5777,8 +5658,7 @@ static void lcd_colorprint_change() {
|
|
|
|
|
|
enquecommand_P(PSTR("M600"));
|
|
|
|
|
|
- custom_message = true;
|
|
|
- custom_message_type = 2; //just print status message
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; //just print status message
|
|
|
lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS));
|
|
|
lcd_return_to_status();
|
|
|
lcd_draw_update = 3;
|
|
@@ -7338,14 +7218,14 @@ void menu_lcd_lcdupdate_func(void)
|
|
|
|
|
|
if (z_menu_expired() || other_menu_expired() || forced_menu_expire())
|
|
|
{
|
|
|
- // Exiting a menu. Let's call the menu function the last time with menuExiting flag set to true
|
|
|
+ // Exiting a menu. Let's call the menu function the last time with menu_leaving flag set to true
|
|
|
// to give it a chance to save its state.
|
|
|
// This is useful for example, when the babystep value has to be written into EEPROM.
|
|
|
if (menu_menu != NULL)
|
|
|
{
|
|
|
- menuExiting = true;
|
|
|
+ menu_leaving = 1;
|
|
|
(*menu_menu)();
|
|
|
- menuExiting = false;
|
|
|
+ menu_leaving = 0;
|
|
|
}
|
|
|
lcd_clear();
|
|
|
lcd_return_to_status();
|