-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
Notifier Print Progress Enhancements #840
base: master
Are you sure you want to change the base?
Conversation
…ker into notifier-enhancements
@@ -109,6 +109,7 @@ def __str__(self) -> str: | |||
return self._name_.lower() # type: ignore | |||
|
|||
class JobEvent(ExtendedEnum): | |||
LAYER_CHANGED = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to append the new event to the bottom of the Enum with a value of 8
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did spot this when I was coding it originally. Setting it to 8 would require additional changes a few lines further down in common.py which determines if the printer has finished or aborted. Adding the new state as 0 (zero) didn't disturb that existing code.
@property
def finished(self) -> bool:
return self.value >= 5
@property
def aborted(self) -> bool:
return self.value >= 6
We could change it to this untested code, but I don't know if that might cause any problems elsewhere.
LAYER_CHANGED = 8
@property
def finished(self) -> bool:
return (self.value >= 5 and self.value != 8)
@property
def aborted(self) -> bool:
return (self.value >= 6 and self.value != 8)
I've been using your changes for a couple of weeks (thanks!) but I can't seem to access the filename in the progress notification like I do with the other notifiers:
The above config produces this notification:
Other kinds of events work as expected instead:
Dumping the stats during a print shows that the I'll add some debugging output and report back. |
Co-authored-by: Niccolò Maggioni <[email protected]>
Co-authored-by: Niccolò Maggioni <[email protected]>
Thanks again for reviewing the code and testing this out. The layer change event only appears to have the info payload from the printer. The filename only appears to be populated in the state changes, which is why it's there for started, complete, etc. This is the extent of what I get in event_args[1] in the layer_change event, which is itself populated in
I don't know if we could work backwards up the event stack to see if the filename can be pulled through. I couldn't figure it out at the time. Could it be added into the GCode and pulled through that way like the total and current layer counts? [Edit] I found the filename in the |
@thankyousam Filename is now populated, thanks!
|
Notifier.py: Enable Layer Change progress messages through Notifier
Expanded the stub of existing code in notifier.py to generate a layer change notification at user specified % layer progress points during the print. This allows the user to receive notifications at set progress points. Only the current layer and total layer count is available in the print state data, so this doesn't necessarily represent linear progress.
Before this change it was only possible to automatically generate a notification at the start or end of the print, or if something went wrong and caused an error or pause.
Additional inclusion of a timestamp variable in all Notifier event data to allow the event time to be included in the notification text.
See the additional Notifier sections in the configuration.md documentation for usage.
Files updated:
moonraker/common.py
moonraker/components/job_state.py
moonraker/components/notifier.py
docs/configuration.md
Signed-off-by: David Osbourn [email protected]