Skip to content

Commit

Permalink
Merge branch 'release' of https://github.com/crysxd/OctoApp-Plugin in…
Browse files Browse the repository at this point in the history
…to release
  • Loading branch information
crysxd committed Jan 30, 2024
2 parents 20e6a43 + 0ae57fb commit 99dd1b6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The app will automatically register itself with the plugin the next time you use
## Setup Moonraker

1. Open a terminal on your Klipper host via SSH
2. Run `/bin/bash -c \"$(curl -fsSL https://octoapp.eu/install.sh)\"`
2. Run `/bin/bash -c "$(curl -fsSL https://octoapp.eu/install.sh)"`
This will clone this repository and guide your through the setup process

The app will automatically register itself with the plugin the next time you use the app. The plugin will run as a Linux service in the background, you can start or stop it via Mainsail or Fluidd. To see a list of registered apps open http://_yourmoonraker_/server/database/item?namespace=octoapp
Expand All @@ -36,4 +36,4 @@ The app will automatically register itself with the plugin the next time you use
Nothing to configure! OctoApp will connect automatically to the plugin

## Issues / Rquests
Please use the app's bug report function in case of any issues. Feature requests can go to [GitLab](https://gitlab.com/realoctoapp/octoapp/-/issues/).
Please use the app's bug report function in case of any issues. Feature requests can go to [GitLab](https://gitlab.com/realoctoapp/octoapp/-/issues/).
19 changes: 15 additions & 4 deletions octoprint_octoapp/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ def OnGcodeSent(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwarg
# No need to use a thread since all events are handled on a new thread.
self.NotificationHandler.OnFilamentChange()

# M0 is a pause command
# https://marlinfw.org/docs/gcode/M000-M001.html
# We check for this both in sent and received, to make sure we cover all use cases. The OnUserInteractionNeeded will only allow one notification to fire every so often.
if self.isPauseCommand(gcode):
Sentry.Info("NOTIFICATION", "Firing On User Interaction Required From GcodeSent: "+str(gcode))
# No need to use a thread since all events are handled on a new thread.
self.NotificationHandler.OnUserInteractionNeeded()

# Look for positive extrude commands, so we can keep track of them for final snap and our first layer tracking logic.
# Example cmd value: `G1 X112.979 Y93.81 E.03895`
if self.NotificationHandler is not None and gcode and cmd and gcode == "G1":
Expand Down Expand Up @@ -165,14 +173,17 @@ def OnGcodeReceived(self, comm_instance, line, *args, **kwargs):
Sentry.Debug("NOTIFICATION", "Skipping beep, only %s seconds left and %s percent" % (timeLeft, progress))

# Look for a line indicating user interaction is needed.
elif "paused for user" in lineLower or "// action:paused" in lineLower or "//action:pause" in lineLower or "@pause" in lineLower:
Sentry.Info("NOTIFICATION", "Firing On User Interaction Required From GcodeReceived: "+str(line))
# No need to use a thread since all events are handled on a new thread.
self.NotificationHandler.OnUserInteractionNeeded()
elif self.isPauseCommand(lineLower):
Sentry.Info("NOTIFICATION", "Firing On User Interaction Required From GcodeReceived: "+str(line))
# No need to use a thread since all events are handled on a new thread.
self.NotificationHandler.OnUserInteractionNeeded()

# We must return line the line won't make it to OctoPrint!
return line

def isPauseCommand(self, line: str):
lineLower = line.lower()
return "paused for user" in lineLower or "// action:paused" in lineLower or "//action:pause" in lineLower or "@pause" in lineLower or "m0" == lineLower

# A dict helper
def _exists(self, dictObj:dict, key:str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
# Note that this is also parsed by the moonraker module to pull the version, so the string and format must remain the same!
plugin_version = "2.0.2"
plugin_version = "2.0.3"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit 99dd1b6

Please sign in to comment.