Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use M70 to set label for the filament to load at the M600 Insert filament screen #4731

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3528,6 +3528,8 @@ static void gcode_M600(const bool automatic, const float x_position, const float
}
while (repeat);

lcd_clear_generic_use_text();

lcd_update_enable(true);

// Not let's go back to print
Expand Down Expand Up @@ -5931,6 +5933,17 @@ SERIAL_PROTOCOLPGM("\n\n");
#endif // Z_PROBE_REPEATABILITY_TEST
#endif // ENABLE_AUTO_BED_LEVELING

/*!
### M70 - Display Message <a href="https://reprap.org/wiki/G-code#M70:_Display_message">M70: Store Message</a>
*/
case 70:
{
const char *src = strchr_pointer + 3;
while (*src == ' ') src++;
lcd_set_generic_use_text(src);
}
break;

/*!
### M72 - Set/get Printer State <a href="https://reprap.org/wiki/G-code#M72:_Set.2FGet_Printer_State">M72: Set/get Printer State</a>
Without any parameter get printer state
Expand Down
22 changes: 21 additions & 1 deletion Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ static uint8_t lcd_status_message_level;
static uint8_t lcd_status_message_idx = 0;
static char lcd_status_message[LCD_WIDTH + 1];

/* Buffer for a generic LCD text */
static char lcd_generic_use_text[LCD_WIDTH + 1];

/* !Configuration settings */

static uint8_t lay1cal_filament = 0;
Expand Down Expand Up @@ -2156,11 +2159,17 @@ void lcd_wait_interact() {
lcd_clear();

lcd_puts_at_P(0, 0, _T(MSG_INSERT_FILAMENT));
lcd_set_cursor(0, 1);
if (lcd_generic_use_text[0]) {
lcd_print(lcd_generic_use_text);
lcd_set_cursor(0, 2);
}

#ifdef FILAMENT_SENSOR
if (!fsensor.getAutoLoadEnabled())
#endif //FILAMENT_SENSOR
{
lcd_puts_at_P(0, 1, _T(MSG_PRESS));
lcd_puts_P(_T(MSG_PRESS));
}
}

Expand Down Expand Up @@ -7312,6 +7321,17 @@ uint8_t get_message_level()
return lcd_status_message_level;
}

void lcd_set_generic_use_text(const char *text)
{
strncpy(lcd_generic_use_text, text, LCD_WIDTH);
lcd_generic_use_text[LCD_WIDTH] = 0;
}

void lcd_clear_generic_use_text()
{
lcd_generic_use_text[0] = 0;
}

void menu_lcd_longpress_func(void)
{
// Wake up the LCD backlight and,
Expand Down
4 changes: 4 additions & 0 deletions Firmware/ultralcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ void lcd_reset_status_message_timeout();
void lcd_setalertstatus(const char* message, uint8_t severity = LCD_STATUS_ALERT);
void lcd_setalertstatuspgm(const char* message, uint8_t severity = LCD_STATUS_ALERT);

// Manage the generic use text content
void lcd_set_generic_use_text(const char *message);
void lcd_clear_generic_use_text();

//! Get/reset the current alert level
uint8_t get_message_level();
void lcd_reset_alert_level();
Expand Down