Hi guys!
I had some time this weekend and back to the original topic of the thread, I managed to implement the M117 Gcode to show in the LCD incoming messages from Octoprint Terminal(Here you can check the code or download the binary).
I made a code restriction to not show strings bigger than 30chars and it will return a warning into Octoprint Terminal(or whatever Serial terminal is connected).
Marlin/src/gcode/lcd/M117.cpp
#include "../../inc/MarlinConfig.h"
#if HAS_STATUS_MESSAGE
#include "../gcode.h"
#include "../../lcd/marlinui.h"
#include "../parser.h"
#if ENABLED(DWIN_CREALITY_LCD)
#include "../../lcd/dwin/e3v2/dwin.h"
#endif
/**
* M117: Set LCD Status Message
*/
void GcodeSuite::M117()
{
#if ENABLED(HOST_ACTION_COMMANDS)
if (parser.string_arg && parser.string_arg[0] != '\0')
{
char *my_string = parser.string_arg;
SERIAL_ECHOLN("Got M117 Command from Serial Terminal");
SERIAL_ECHOLNPAIR("String received: ", my_string);
delay(200);
if (strlen(my_string) > 30)
{
SERIAL_ECHOLN("Warning: String too long");
SERIAL_ECHOLN("Not sending to LCD");
}
else
{
TERN_(DWIN_CREALITY_LCD, DWIN_Show_M117(my_string));
}
}
else
{
SERIAL_ECHOLN("Warning: No string provided with M117");
}
#endif
if (parser.string_arg && parser.string_arg[0])
{
ui.set_status(parser.string_arg);
}
else
{
ui.reset_status();
}
}
#endif // HAS_STATUS_MESSAGE
Added a new function in Marlin/src/lcd/dwin/e3v2/dwin.cpp
void DWIN_Show_M117(char* str)
{
Clear_Main_Window();
HMI_flag.Refresh_bottom_flag = true; // Flag not to refresh bottom parameters
DWIN_ICON_Show(HMI_flag.language, LANGUAGE_Info, TITLE_X, TITLE_Y);
DWIN_ICON_Show(HMI_flag.language, LANGUAGE_Back, 42, 26);
DWIN_ICON_Show(ICON, ICON_PrintSize + 1, 115, 72);
DWIN_Draw_String(true,true,font8x16,Color_White,Color_Bg_Black,(DWIN_WIDTH - strlen(str) * MENU_CHR_W) / 2 , 150,F(str));
Draw_Back_First();
//Goto_MainMenu();
DWIN_UpdateLCD();
}
So s you can see there are aready some useful routines that can be used to use the DWIN Serial LCD From creality.
What I would like to see while printing is the “Printing Page” that we see when printing from SD, but looking at Octoprint Terminal Output it doesn’t send the info of it nor the PNG thumbnail. I think is possible to write another addon for Octoprint that send the print details to the printer and from there write another custom command inside the GCODEsuite to render the “Printing page” in the LCD with all the info, thumbnail and controls as it defaults do when printing from SD(I will need to research a lot for this).
Below a video on how the messages are displayed from Octoprint terminal, and using the Plugin “DisplayLayerProgress” when print is started.
Best Regards.