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

Show print screen / progress bar while printing #2631

Closed
tom-321 opened this issue Nov 11, 2022 · 12 comments · Fixed by #2692
Closed

Show print screen / progress bar while printing #2631

tom-321 opened this issue Nov 11, 2022 · 12 comments · Fixed by #2692
Labels
question Further information is requested

Comments

@tom-321
Copy link

tom-321 commented Nov 11, 2022

Your question or details you need. Please describe.
No idea if this is a matter of the display, but I don't know what else to set in Marlin (I've uncommented REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)

I'm trying to show the print screen
I print over USB (Repetiere Server) and the TFT35 V2.0 ist connected to the skr 2 rev b (Marlin 2.1.1) over TFT display pins / serial port.
Serial port 1 and 2 is activated in firmware

What do I have to do to display the print screen which shows the progress ?

@tom-321 tom-321 added the question Further information is requested label Nov 11, 2022
@radek8
Copy link
Contributor

radek8 commented Nov 12, 2022

#2180

@radek8
Copy link
Contributor

radek8 commented Nov 12, 2022

Unfortunately, your display does not have a simulated Merlin display mode.

@rondlh
Copy link

rondlh commented Nov 13, 2022

@tom-321 What you want is possible, but is a use case that is not in the current scope of the software provided here. You would need some customization to achieve this. Marlin can generate the required codes (SET_PROGRESS_MANUALLY, M73), the TFT needs to process these commands and show them. Not a big deal, but outside of the scope here.

@tom-321
Copy link
Author

tom-321 commented Nov 19, 2022

@rondlh Thanks for the advice
If I have understood this correctly M73 is not in the gcode, ist generated by marlin to set displayed progress of the connected serial devices

But what I don't understand is why it doesn't work then.
I have defined LCD_SET_PROGRESS_MANUALLY in the configuration_adv.
On my Ender3 v2 (with octoprint) it also works fine...

@rubienr
Copy link
Contributor

rubienr commented Nov 26, 2022

Hi @tom-321,

I have seen many issues reporting M117 and/or M73 not working properly. What I found by scrolling the source is that:

  1. the print screen on the BTT TFT device is not activated because it expects to see // action:print_start and that action isn't sent by Marlin nor OctoPrint (I don't know how Repetier behaves).
  2. OctoPrint does not send the expected actions (// action:command) for start, stop, pause, resume and cancel.
  3. from my perspective M73 is not working as expected or documentation of PROG_SOURCE might not be correct/complete.
  4. it works with M117 followed by: Time Left %dh%dm%ds or Layer Left %d/%d or Data Left %d/%d.
  5. Cura does not provide the expected strings for M117 (see parseACK.c)

Workaround for 1 and 2 to (de-)activate the print screen:

In OctoPrint go to Settings → Printer → G-Code Scripts and enter those respectively:

  • M118 A1 P2 action:print_start
  • M118 A1 P2 action:print_end
  • M118 A1 P2 action:cancel
  • M118 A1 P2 action:pause
  • M118 A1 P2 action:resume

Note: you might need to change Pn (here P2) to something else.

Workaround for 4, 5 to populate remaining time, progress and layer to the display:

I couldn't get it running with M73 P%d. My naive hotfix is to add layer, time and progress information to the G-Code by Cura and then sring-replace those with M117 ... commands. Unfortunately the documentation lacks and its not obvious that commands of pattern M117 (Layer|Time|Data) Left \d*/\d* are hijacked and not printed to display as M117 should do. Example: M117 layer Left xxx would go to display, whereas in contrary M117 Layer Left xxx would be hijacked, parsed but not be printed at all.

In Cura → Extensions → Post Processing → Modify G-Code:

  1. add "Display Filename And Layer On LCD": scroll-enabled false; text to display empty; initial layer number 0; display max layer enabled
  2. add "Search and Replace": search M117\s*Layer\s*(\d*)\s*of\s*(\d*)\s.*; replace M117 Layer Left \1/\2; use regexp enabled
  3. add "Display Progress on LCD": time remaining enabled; time reporting method M117; update frequency every layer; percentage enabled
  4. add "Search and Replace": search M73\s*P(\d*).*; replace M117 Data Left \1/100; use regexp enabled

This adds lines in the G-Code i.e. as

M117 Time Left 0h00m34s
M73 P50
M117 Layer 30 of 60 somefilename

and replaces to

M117 Time Left 0h00m34s
M117 Data Left 50/100
M117 Layer Left 30/60

Bug investigation:

I can see that in interfaceCmd.c M117 works as expected

        case 117:  // M117
          if (cmd_seen_from(cmd_base_index, "Time Left"))  // parsing printing time left
          {
            // format: Time Left <XX>h<YY>m<ZZ>s (e.g. Time Left 02h04m06s)
            parsePrintRemainingTime(&cmd_ptr[cmd_index]);  // cmd_index was set by cmd_seen_from function
            setTimeFromSlicer(true);
          }

but M73 in interfaceCmd.c not

        case 73:
          if (cmd_seen('P'))
          {
            setPrintProgressSource(PROG_SLICER);
            setPrintProgressPercentage(cmd_value());
          }

With:

How to reproduce:

In OctoPrint console send:

M118 A1 P2 action:print_start
M117 Time Left 0h00m34s
; set progress
M117 Data Left 50/100
M117 Layer Left 30/60
M118 A1 P2 action:print_start
; set progress doesn't work
M73 P50
M118 P2 M73 P50

Note: with btttft in Marlin mode M73 works as expected.

@tom-321
Copy link
Author

tom-321 commented Dec 1, 2022

Hi @rubienr,
thanks for the detailed instructions :)

I've managed it to activate the print screen (1 and 2)

In repetier server you can define start and end gcodes
If you sent colon „:“ in repetiere server terminal you need do put a hashtag „#“ at the beginning (otherwise it will replace it with space)

Bildschirmfoto 2022-12-01

@tom-321
Copy link
Author

tom-321 commented Dec 1, 2022

Bildschirmfoto 2022-12-01_

@rubienr
Copy link
Contributor

rubienr commented Dec 4, 2022

In my opinion,

  • something goes wrong with M73 (even if sent directly to the display's serial port by M118 A1 P2 M73 ...), and
  • the command M117 (Layer|Time|Data) Left \d*/\d* is hijacked if it is provided in the afore mentioned form but that fact is not well documented and the specific behaviour cannot be disabled.

My experience with the print screen is ambivalent. While the upper screen part providies a very nice and well done progress overview, the lower buttons are somehow limiting. I wish the print screen wouldn't stay sticky in the foreground, allow me to go the the status screen (i.e. "More" button cold be the back-arrow) and back again (from the main screen).

Another issue I observed while "Remote printing..." is shown on top of the screen: it does not allow me to successfully use the pause/resume and abort buttons because it says "Busy processing, please wait..." .

My current workaround is:

  1. not sending M118 A1 P2 action:print_start on print start
  2. replace the move/homing menu item on main screen (2nd button) with the printing menu: MainPage.c
  3. replace the print menu item (bottom right button) on status screen with move/homing: StatusScreen.c
  4. activate the printing screen manually from the main screen (drawback: some counters do not auto update since the firmware never detected the print start)

As I don't need the SD-card support (and its respective menu) for me this is sufficient at the moment.

@tom-321 documentation related to print screen + remote printing: https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware#printing-from-remote-host

@digant73
Copy link
Contributor

digant73 commented Jan 26, 2023

Hi @tom-321,

I have seen many issues reporting M117 and/or M73 not working properly. What I found by scrolling the source is that:

  1. the print screen on the BTT TFT device is not activated because it expects to see // action:print_start and that action isn't sent by Marlin nor OctoPrint (I don't know how Repetier behaves).
  2. OctoPrint does not send the expected actions (// action:command) for start, stop, pause, resume and cancel.
  3. from my perspective M73 is not working as expected or documentation of PROG_SOURCE might not be correct/complete.

Despite the confusing explanation and validity of features related to config option prog_source, progress from M73 is always used when M73 is parsed, so the provided progress should be properly displayed (see further clarifications below)

  1. it works with M117 followed by: Time Left %dh%dm%ds or Layer Left %d/%d or Data Left %d/%d.
  2. Cura does not provide the expected strings for M117 (see parseACK.c)

Workaround for 1 and 2 to (de-)activate the print screen:

In OctoPrint go to Settings → Printer → G-Code Scripts and enter those respectively:

  • M118 A1 P2 action:print_start
  • M118 A1 P2 action:print_end
  • M118 A1 P2 action:cancel
  • M118 A1 P2 action:pause
  • M118 A1 P2 action:resume

Note: you might need to change Pn (here P2) to something else.

Workaround for 4, 5 to populate remaining time, progress and layer to the display:

I couldn't get it running with M73 P%d. My naive hotfix is to add layer, time and progress information to the G-Code by Cura and then sring-replace those with M117 ... commands. Unfortunately the documentation lacks and its not obvious that commands of pattern M117 (Layer|Time|Data) Left \d*/\d* are hijacked and not printed to display as M117 should do. Example: M117 layer Left xxx would go to display, whereas in contrary M117 Layer Left xxx would be hijacked, parsed but not be printed at all.

In Cura → Extensions → Post Processing → Modify G-Code:

  1. add "Display Filename And Layer On LCD": scroll-enabled false; text to display empty; initial layer number 0; display max layer enabled
  2. add "Search and Replace": search M117\s*Layer\s*(\d*)\s*of\s*(\d*)\s.*; replace M117 Layer Left \1/\2; use regexp enabled
  3. add "Display Progress on LCD": time remaining enabled; time reporting method M117; update frequency every layer; percentage enabled
  4. add "Search and Replace": search M73\s*P(\d*).*; replace M117 Data Left \1/100; use regexp enabled

This adds lines in the G-Code i.e. as

M117 Time Left 0h00m34s
M73 P50
M117 Layer 30 of 60 somefilename

and replaces to

M117 Time Left 0h00m34s
M117 Data Left 50/100
M117 Layer Left 30/60

Bug investigation:

I can see that in interfaceCmd.c M117 works as expected

        case 117:  // M117
          if (cmd_seen_from(cmd_base_index, "Time Left"))  // parsing printing time left
          {
            // format: Time Left <XX>h<YY>m<ZZ>s (e.g. Time Left 02h04m06s)
            parsePrintRemainingTime(&cmd_ptr[cmd_index]);  // cmd_index was set by cmd_seen_from function
            setTimeFromSlicer(true);
          }

but M73 in interfaceCmd.c not

        case 73:
          if (cmd_seen('P'))
          {
            setPrintProgressSource(PROG_SLICER);
            setPrintProgressPercentage(cmd_value());
          }

With:

How to reproduce:

In OctoPrint console send:

M118 A1 P2 action:print_start
M117 Time Left 0h00m34s
; set progress
M117 Data Left 50/100
M117 Layer Left 30/60

I confirm this is a correct flow that should properly work. I would always use P0 (as reported in README.md) on M118 instead of a specific port (P2 in your example) just to be sure the M118 message is forwarded to TFT and parsed by TFT.

M118 A1 P2 action:print_start
; set progress doesn't work
M73 P50
M118 P2 M73 P50

With the exception of M118 P2 M73 P50 (wrong command not supported by TFT, so forget it), even this flow should properly work. M73 should be properly parsed and progress properly displayed on Printing menu.

NOTE:
M117 Layer/Time etc... are properly documented in README.md. I confirm that the text in M117 (as for any other text on other commands) is case sensitive (as any other matching key provided in parseAck.c. E.g. M117 Time Left xxxx is the one to use while M117 time left xxxx (lower case) is wrong (it is simply displayed in the notification bar).

As far as I understood, your use case is printing from OctoPrint connected to the mainboard instead of connected to one of TFT's serial port), Right?
I will have a look on the M73 issue you reported, if any

EDIT:
M73 is currently not supported only when printing from (remote) onboard media. In that case even if:

  • SET_PROGRESS_MANUALLY
  • M73_REPORT

are enabled in Marlin, the notification:
echo: M73 Progress: <XX>%; Time left: <YY>m;
sent by Marlin (for each M73) is currently not parsed by the TFT fw. Furthermore, an annoying echo message is instead displayed.
This bug has been fixed and it will be provided in a next PR.

@digant73
Copy link
Contributor

digant73 commented Jan 29, 2023

In my opinion,

  • something goes wrong with M73 (even if sent directly to the display's serial port by M118 A1 P2 M73 ...), and
  • the command M117 (Layer|Time|Data) Left \d*/\d* is hijacked if it is provided in the afore mentioned form but that fact is not well documented and the specific behaviour cannot be disabled.

My experience with the print screen is ambivalent. While the upper screen part providies a very nice and well done progress overview, the lower buttons are somehow limiting. I wish the print screen wouldn't stay sticky in the foreground, allow me to go the the status screen (i.e. "More" button cold be the back-arrow) and back again (from the main screen).

Another issue I observed while "Remote printing..." is shown on top of the screen: it does not allow me to successfully use the pause/resume and abort buttons because it says "Busy processing, please wait..." .

My current workaround is:

  1. not sending M118 A1 P2 action:print_start on print start
  2. replace the move/homing menu item on main screen (2nd button) with the printing menu: MainPage.c
  3. replace the print menu item (bottom right button) on status screen with move/homing: StatusScreen.c
  4. activate the printing screen manually from the main screen (drawback: some counters do not auto update since the firmware never detected the print start)

As I don't need the SD-card support (and its respective menu) for me this is sufficient at the moment.

@tom-321 documentation related to print screen + remote printing: https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware#printing-from-remote-host

The Feature Request (FR) about availability of Pause/Resume and Abort on remote printing was implemented in #2678. I currently closed it until some constraints from another contributor are accepted or rejected by btt.

@rubienr
Copy link
Contributor

rubienr commented Feb 3, 2023

Hello @digant73 ,

As far as I understood, your use case is printing from OctoPrint connected to the mainboard instead of connected to one of TFT's serial port), Right? I will have a look on the M73 issue you reported, if any

Yes: printing from OctoPrint via USB (serial) not from SD-card via BTT-TFT serial.

EDIT: M73 is currently not supported only when printing from (remote) onboard media. In that case even if:

* `SET_PROGRESS_MANUALLY`

* `M73_REPORT`

are enabled in Marlin, the notification: echo: M73 Progress: <XX>%; Time left: <YY>m; sent by Marlin (for each M73) is currently not parsed by the TFT fw. Furthermore, an annoying echo message is instead displayed. This bug has been fixed and it will be provided in a next PR.

😺 Thank you!

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants