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

Feature-Request: Use M118 instead of M117 commands #252

Open
OllisGit opened this issue Feb 3, 2022 · 16 comments
Open

Feature-Request: Use M118 instead of M117 commands #252

OllisGit opened this issue Feb 3, 2022 · 16 comments

Comments

@OllisGit
Copy link
Owner

OllisGit commented Feb 3, 2022

Details see https://community.octoprint.org/t/how-to-send-m118-a1-p0-action-notification-time-left-hms-e-g-02h04m06s/41553

OllisGit added a commit that referenced this issue Feb 6, 2022
- E #252 replaced all gcode from M117 to M118
@OllisGit
Copy link
Owner Author

OllisGit commented Feb 6, 2022

A dev version that just replace all M117 comands with M118 is out: https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/tag/1.29.0.dev1

@Pascal-m
Copy link

Pascal-m commented Feb 7, 2022

Hy @OllisGit ,
Thank you for the version of Dev
I started tested and I detected a small dysfunction in the remaining time.
TFT is waiting for a non-truncated time format :

M118 A1 P0 action:notification Time Left hms (e.g. 00h16m06s)

Unfortunately when I use the [printtime_left] statement the time is cut example for a time remain 20 minutes 13second I receive 20m13s while I would have that I receive 00h20m13s

Is there a way to keep hours the minutes and seconds?

Thk :)

image

image

@OllisGit
Copy link
Owner Author

OllisGit commented Mar 23, 2022

Hi @Pascal-m,
for seconds there is already a flag (in your case you need to disable it), but not for the leading minutes/hours.
image

I need to implement this feature...do you need two digits or is one enough?
I prefer one digit, like this 0d0h0m31s

@MehStrongBadMeh
Copy link

I need to implement this feature...do you need two digits or is one enough? I prefer one digit, like this 0d0h0m31s

I just tested this out by manually sending M118 commands via Octoprint Terminal. Sending the command M118 A1 P0 action:notification Time Left 1h1m10s and M118 A1 P0 action:notification Time Left 0h1m10s both properly updated the time remaining. So it appears there is no need for there to be two digits. Same goes for using M117, as I don't have the UART issue with my setup, so only the lack of hours when less than one hour remaining is an issue.

@Pascal-m
Copy link

Pascal-m commented Apr 4, 2022

hello sorry for the delay
In the specification it takes 2 digits on the hour minute and second

example:
01h02m06s
Or
00h09m04
Thx

@Pascal-m
Copy link

Pascal-m commented Jun 5, 2022

Hello OllosGit,
good news, in the latest version of the TFT firmware, it accepts one digit now :)
Do you think you can make the change?
Thk
Pascal

Hi @Pascal-m, for seconds there is already a flag (in your case you need to disable it), but not for the leading minutes/hours. image

I need to implement this feature...do you need two digits or is one enough? I prefer one digit, like this 0d0h0m31s

@wd5gnr
Copy link

wd5gnr commented Oct 15, 2022

Just to let you know, I am using 1.29.0.dev1 with the same use case and for layers and progress, it works well. I haven't dug into the time yet since there are only two notifications.

@racSF
Copy link

racSF commented Oct 19, 2022

Just to let you know, I am using 1.29.0.dev1 with the same use case and for layers and progress, it works well. I haven't dug into the time yet since there are only two notifications.

True - dataprogress is correctly set, when using

A1 P0 action:notification Data Left [current_layer]/[total_layers]
as message pattern.

I can also confirm, that the issue with the missing leading hours still exists, would it be possible to implement it as option like the one mentioned by pascal-m ? For this I would use:

A1 P0 action:notification Time Left [printtime_left]

@racSF
Copy link

racSF commented Oct 20, 2022

I'll try to fit my needs by altering the file: "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/octoprint_DisplayLayerProgress/stringUtils.py"

And change the secondsToText function to:

def secondsToText(secs, hideSeconds=False):
    result = ""
    days = secs // 86400
    hours = (secs - days * 86400) // 3600
    minutes = (secs - days * 86400 - hours * 3600) // 60
    seconds = secs - days * 86400 - hours * 3600 - minutes * 60
    if (hours > 0):
        if (hideSeconds == True):
            result = "{}h".format(hours) + "{}m".format(minutes)
        else:
            result = "{}h".format(hours) + "{}m".format(minutes) + "{}s".format(seconds)
    elif (minutes > 0):
        if (hideSeconds == True):
            result = "{}m".format(minutes)
        else:
            --->   result = "{}h".format(hours) + "{}m".format(minutes) + "{}s".format(seconds)
    elif (seconds >= 0):
            --->   result = "{}h".format(hours) + "{}m".format(minutes) + "{}s".format(seconds)

This should only help if you use the sidewinder - I'll test it maybe tommorrow ;)

@racSF
Copy link

racSF commented Oct 24, 2022

I could test it today - and the change worked as intended - just to beautify things up, here is my current secondsToText without any Arrows, symbols or whatever:

def secondsToText(secs, hideSeconds=False):
    result = ""
    days = secs // 86400
    hours = (secs - days * 86400) // 3600
    minutes = (secs - days * 86400 - hours * 3600) // 60
    seconds = secs - days * 86400 - hours * 3600 - minutes * 60
    if (hours > 0):
        if (hideSeconds == True):
            result = "{}h".format(hours) + "{}m".format(minutes)
        else:
            result = "{}h".format(hours) + "{}m".format(minutes) + "{}s".format(seconds)
    elif (minutes > 0):
        if (hideSeconds == True):
            result = "{}m".format(minutes)
        else:
            result = "{}h".format(hours) + "{}m".format(minutes) + "{}s".format(seconds)
    elif (seconds >= 0):
        result = "{}h".format(hours) + "{}m".format(minutes) + "{}s".format(seconds)
    return result

As mentioned earlier - this is not needed by most of the Marlins out there - but the Sidewinder X1 in team with the BTT TFT needs this approach - its a quick and dirty hack, which will most likely be destroyed on the next update of the plugin - maybe @OllisGit could implement a Sidewinder Checkbox within the options to force the formatting to always consist of HoursMinutesSeconds, no matter how many days or only minutes are left :)

@heinrichWeichert
Copy link

I'm also interested in this, could this be made possible with a variable like [printtime_left_incl_hours] ?

@raihei
Copy link

raihei commented Feb 20, 2023

That would be great, I am also interested. And maybe a checkbox "Use M118 instead of M117"?

@lethuer
Copy link

lethuer commented Mar 28, 2024

I also want to use M118 instead of M117 for my tft on an artillery genius.
Is there any action to get an "official" update to provide this possibility in the plugin ?

@lethuer
Copy link

lethuer commented Mar 29, 2024

Hi there !

I'm using an Artillery Genius (Not Pro).
I tested this test version for M118 provided by @OllisGit: https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/tag/1.29.0.dev1
together with this small modification provided by @racSF: #252 (comment)
and created a zip File with that which can be installed directly:
OctoPrint-DisplayLayerProgress-1.29.0.dev1_MissingHourMod_compressed.zip

I have configured this:
For print progress I used progress information: P0 A1 action:notification Data Left [progress]/100
Another possibility would be to use layer information: P0 A1 action:notification Data Left [current_layer]/[total_layers]
image

That's working for me AFTER uploading a file again (which includes M118 messages instead M117), so I would really like to get a stable version !
Otherwise changes would be gone with next update, which is provided:
image

Additionally I would like it would be possible to send three M118 messages to the printer:

M118 P0 A1 action:notification Time Left XXhYYmZZs
-> Updates Time Left Field
M118 P0 A1 action:notification Layer Left XX/YY
-> Updates Layer Left Field
M118 P0 A1 action:notification Data Left XX/YY
-> Updates Percentage Field + Progress Bar

But currently there are only 2 fields are available.
For me it wouldn't be neccessary to toggle between messeges, they could be send all at the same time.

One small downside:
Currently I additionally have installed an SSD1306 display together with this plugin:
https://plugins.octoprint.org/plugins/ssd1306_oled_display/
With the modified "DisplayLayerProgress" plugin mentioned above on the display now "INIDICATOR-Layer1" is displayed.
I think the reason is that the plugin also uses M117 messages which are now completely replaced by M118.

@lethuer
Copy link

lethuer commented Mar 29, 2024

For me it wouldn't be neccessary to toggle between messeges, they could be send all at the same time.

Currently I additionally have installed an SSD1306 display together with this plugin:
https://plugins.octoprint.org/plugins/ssd1306_oled_display/
With the modified "DisplayLayerProgress" plugin mentioned above on the display now "INIDICATOR-Layer1" is displayed.
I think the reason is that the plugin also uses M117 messages which are now completely replaced by M118.

With solution discussed in OctoPrint forum it is possible to stay with original "DisplayLayerProgress" plugin and use a modified "M73 Progress" plugin:
https://community.octoprint.org/t/tft-percentage-progress-not-updatet-m73/57420/27?u=lethuer

Here is the modified plugin so far, changes made by https://community.octoprint.org/u/b-morgan:
OctoPrint-M73Progress-0.2.1-M118.zip
He kept the M73 command and added two M118 commands, one for "time left" and one for "data left", so "layer left" is missing currently.

This makes my previous mentioned downsides obsolete:

  1. All M118 messages are sent at the same time
  2. Other plugins which also requires M117 messages aren't affected

@lethuer
Copy link

lethuer commented Mar 30, 2024

For adding layer information I've found this possibility to use in the slicer: https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/wiki/How-does-the-plugin-works#cura
Unfortunately this modified script "InsertAtLayerChangeEnhancement" don't use the information about [LAYER_COUNT] yet.
I updated the script to get a format like needed:
M118 P0 A1 action:notification Layer Left [layer_num]/[layer_count]
InsertAtLayerChangeEnhancementForTotalLayer.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants