Skip to content

Commit

Permalink
Use M117 to set a label for the filament to load at the M600 Insert f…
Browse files Browse the repository at this point in the history
…ilament screen.

Fix for issue prusa3d#4424, by 3d-gussner
  • Loading branch information
Panayiotis-git committed Dec 27, 2023
1 parent 45d70b1 commit 9342b2f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
7 changes: 6 additions & 1 deletion Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3472,6 +3472,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 @@ -6531,8 +6533,11 @@ SERIAL_PROTOCOLPGM("\n\n");
*/
case 117: {
const char *src = strchr_pointer + 4; // "M117"
lcd_setstatus(*src == ' '? src + 1: src);
while (isspace(*src)) src++;
lcd_setstatus(src);
custom_message_type = CustomMsg::M117;

lcd_set_generic_use_text(src);
}
break;

Expand Down
24 changes: 22 additions & 2 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,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 @@ -2121,12 +2124,18 @@ void lcd_wait_interact() {

lcd_clear();

lcd_puts_at_P(0, 1, _i("Insert filament"));////MSG_INSERT_FILAMENT c=20
lcd_puts_P(_i("Insert filament"));////MSG_INSERT_FILAMENT c=20
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, 2, _i("and press the knob"));////MSG_PRESS c=20 r=2
lcd_puts_P(_i("and press the knob"));////MSG_PRESS c=20 r=2
}
}

Expand Down Expand Up @@ -7233,6 +7242,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
2 changes: 1 addition & 1 deletion lang/po/Firmware_fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -2435,7 +2435,7 @@ msgstr "Offset point [0;0]"
#. MSG_PRESS c=20 r=2
#: ../../Firmware/ultralcd.cpp:2123
msgid "and press the knob"
msgstr "et appuyez sur le bouton"
msgstr "et appuyez\nsur le bouton"

#. MSG_TO_LOAD_FIL c=20
#: ../../Firmware/ultralcd.cpp:1783
Expand Down
2 changes: 1 addition & 1 deletion lang/po/Firmware_hu.po
Original file line number Diff line number Diff line change
Expand Up @@ -2424,7 +2424,7 @@ msgstr "[0;0] pont offszet"
#. MSG_PRESS c=20 r=2
#: ../../Firmware/ultralcd.cpp:2123
msgid "and press the knob"
msgstr "es nyomd meg a gombot"
msgstr "es nyomd meg\na gombot"

#. MSG_TO_LOAD_FIL c=20
#: ../../Firmware/ultralcd.cpp:1783
Expand Down

0 comments on commit 9342b2f

Please sign in to comment.