Skip to content

Commit

Permalink
Dev Release 1.29.0.dev1
Browse files Browse the repository at this point in the history
- E #252 replaced all gcode from M117 to M118
  • Loading branch information
OllisGit committed Feb 6, 2022
1 parent 86ae2a4 commit b38a507
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
26 changes: 13 additions & 13 deletions octoprint_DisplayLayerProgress/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
# HEIGHT_METHODE_Z_EXPRESSION = "zExpression"

NOT_PRESENT = "-"
LAYER_MESSAGE_PREFIX = "M117 INDICATOR-Layer"
LAYER_MESSAGE_PREFIX = "M118 INDICATOR-Layer"
LAYER_COUNT_EXPRESSION = ".*\n?" +LAYER_MESSAGE_PREFIX + "([0-9]+)"

# Match G1 Z149.370 F1000 or G0 F9000 X161.554 Y118.520 Z14.950 ##no comments
Expand Down Expand Up @@ -439,9 +439,9 @@ def queuingGCodeHook(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **
# print("********************** " + commandAsString)
self._eventLogging("QUEUING-HOOK: " + commandAsString)
# prevent double messages
if commandAsString.startswith("M117"):
if commandAsString.startswith("M118"):
if self._lastM117Command == commandAsString:
# filter double M117 commands
# filter double M118 commands
self._eventLogging("QUEUING-HOOK DROP COMMAND: " + commandAsString)
return []
else:
Expand All @@ -452,7 +452,7 @@ def queuingGCodeHook(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **

# layer
if commandAsString.startswith(LAYER_MESSAGE_PREFIX):
# filter M117 indicator-command, not needed any more
# filter M118 indicator-command, not needed any more
return []

# movement type
Expand Down Expand Up @@ -480,7 +480,7 @@ def sendingGCodeHookWorkerMethod(self, commandAsString):
self._startLayerTime = currentTime

self._updateDisplay(UPDATE_DISPLAY_REASON_LAYER_CHANGED)
# filter M117 indicator-command, not needed any more
# filter M118 indicator-command, not needed any more
return

# M600
Expand Down Expand Up @@ -543,7 +543,7 @@ def sentGCodeHook(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwa
commandAsString = stringUtils.to_native_str(cmd)

self._eventLogging("SENT-HOOK: " + commandAsString)
if commandAsString.startswith("M117 "):
if commandAsString.startswith("M118 "):
# add to queue for async-processing
self._sentGCodeHookCommandQueue.addToQueue(commandAsString)
return
Expand All @@ -552,7 +552,7 @@ def sentGCodeHook(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwa
def sentGCodeHookWorkerMethod(self, commandAsString):
showDesktopPrinterDisplay = self._cachedSettings.getBooleanValue(SETTINGS_KEY_SHOW_ALL_PRINTERMESSAGES)
if (showDesktopPrinterDisplay == True):
printerMessage = commandAsString[len("M117 "):]
printerMessage = commandAsString[len("M118 "):]
if self._cachedSettings.getBooleanValue(SETTINGS_KEY_ADD_TRAILINGCHAR):
printerMessage = printerMessage[:-1]

Expand Down Expand Up @@ -906,7 +906,7 @@ def _updateDisplay(self, updateReason):
}
# printerMessagePattern = self._cachedSettings.getStringValue(SETTINGS_KEY_PRINTERDISPLAY_MESSAGEPATTERN)
printerMessagePattern = self._currentPrinterDisplayMessagePattern
printerMessageCommand = "M117 " + stringUtils.multiple_replace(printerMessagePattern, currentValueDict)
printerMessageCommand = "M118 " + stringUtils.multiple_replace(printerMessagePattern, currentValueDict)


############ prepare clientMessage
Expand Down Expand Up @@ -1077,7 +1077,7 @@ def _formatHeightValue(self, heightValue):
_lastSendPrinterCommand = None
_lastSendTime = None
# printer specific command-manipulation.
# e.g. ANET E10 cuts the last char from M117-commands, so this helper adds an additional underscore to the message
# e.g. ANET E10 cuts the last char from M118-commands, so this helper adds an additional underscore to the message
def _sendCommandToPrinter(self, command):
if (self._lastSendPrinterCommand != command):

Expand All @@ -1091,7 +1091,7 @@ def _sendCommandToPrinter(self, command):
return

if self._cachedSettings.getStringValue(SETTINGS_KEY_ADD_TRAILINGCHAR):
if command.startswith("M117"):
if command.startswith("M118"):
command += "_"
# logging for debugging print("Send GCode:" + command)
self._eventLogging("SEND-COMMAND: "+command)
Expand Down Expand Up @@ -1193,7 +1193,7 @@ def _parseLayerExpressions(self, layerExpressionPatterns):
layerIndicatorProcessedFileMarker = "; DisplayLayerProgress_layerIndicatorProcessed = true"

# Looks for a property at the end of the file that this file was already processed with LayerIndicators
# If not present loop thru the first lines looking for M117 LayerIndicator messages
# If not present loop thru the first lines looking for M118 LayerIndicator messages
# returning
# - no marker
# - property found
Expand All @@ -1208,7 +1208,7 @@ def _alreadyAddedLayerIndicators(self, path):
break

if resultType == "no marker":
# lets look in the first 500 (adjustable) lines, maybe there is already an M117 Indicator
# lets look in the first 500 (adjustable) lines, maybe there is already an M118 Indicator
lineCounter = 0
# layerIndicatorLookAheadLimit = 500
layerIndicatorLookAheadLimit = self._cachedSettings.getStringValue(SETTINGS_KEY_LAYERINDICATOR_LOOKAHEAD_LIMIT)
Expand Down Expand Up @@ -1588,7 +1588,7 @@ def on_event(self, event, payload):
self._updateDisplay(UPDATE_DISPLAY_REASON_FRONTEND_CALL)

self._eventLogging("event print done!")
# not needed could be done via standard code-settings self._sendCommandToPrinter("M117 Print Done")
# not needed could be done via standard code-settings self._sendCommandToPrinter("M118 Print Done")
self._isPrinterRunning = False

elif event == Events.CLIENT_OPENED or event == Events.SETTINGS_UPDATED:
Expand Down
6 changes: 3 additions & 3 deletions octoprint_DisplayLayerProgress/stringUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def getLastLinesFromFile(file_name, N):
#print(secondsToText(None, seconds) )

# import octoprint.util
# # gcode_line_as_str = "M117 Priming Filamentâ{¦"
# gcode_line_as_bytes = b'M117 Priming Filament\xe2{\xa6\n'
# # gcode_line_as_str = "M118 Priming Filamentâ{¦"
# gcode_line_as_bytes = b'M118 Priming Filament\xe2{\xa6\n'
# print (gcode_line_as_bytes)
#
# # gcode_encoded = gcode_line_as_bytes.decode('ISO-8859-1')
Expand All @@ -213,7 +213,7 @@ def getLastLinesFromFile(file_name, N):
# print(unicode_line)

# line = ";LAYER:1234"
# gcode_to_add = "M117 INDICATOR-Layer[layer_num]\n"
# gcode_to_add = "M118 INDICATOR-Layer[layer_num]\n"
#
# layerNumber = line[7:]
# newGcode_to_add = gcode_to_add.replace("[layer_num]", layerNumber, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<label class="checkbox">Show printer display on Desktop
<input type="checkbox" data-bind="checked: settingsViewModel.settings.plugins.DisplayLayerProgress.showAllPrinterMessages" />
</label>
<label style="padding-left:21px">Every <code>M117 - Message</code> which is send to the printer, will also shown in a Desktop-PopUp</label>
<label style="padding-left:21px">Every <code>M118 - Message</code> which is send to the printer, will also shown in a Desktop-PopUp</label>

<div>
<label class="checkbox">Screen location: (<a target="newTab" href="https://github.com/sciactive/pnotify/tree/2.1.0#example-stacks">description</a>)</label>
Expand Down Expand Up @@ -178,7 +178,7 @@
output. <br/>
To test it, send the following message example G-Code (via terminal) to your printer:<br/>
<br/>
<code>M117 xxx% L=xxx/xxx H=xxx.xx/xxx.xx</code>
<code>M118 xxx% L=xxx/xxx H=xxx.xx/xxx.xx</code>
<br/><br/>
!!! Some printers ignore the overlapping characters or special chars (e.g. :) and some
<b><i>stop</i></b> working !!!
Expand All @@ -189,7 +189,7 @@
<div class="control-group">
<legend>Output interval</legend>
<div>
You can define an interval how often the printer-display will be updated. If you choose a value greater zero, you can probably reduce the amount of DLP-M117 messages that will be send to the printer.
You can define an interval how often the printer-display will be updated. If you choose a value greater zero, you can probably reduce the amount of DLP-M118 messages that will be send to the printer.
</div>
<br/>
<div class="controls">
Expand Down Expand Up @@ -229,9 +229,9 @@
</label>
<label style="padding-left:21px">
Every Slicer use a different format to put the layer-information into the G-Code.<br/><br/>
If you activate this checkbox, the plugin looks for below layer-expressions and adds a "neutral" M117-command (e.g. <code>M117 INDICATOR-Layer45</code>) into the uploaded G-Code.<br/>
During print this M117-command will be replaced with the print message you defined.<br/><br/>
If you deactivate this checkbox, your slicer needs to provide the above M117 indicator commands.<br/>
If you activate this checkbox, the plugin looks for below layer-expressions and adds a "neutral" M118-command (e.g. <code>M118 INDICATOR-Layer45</code>) into the uploaded G-Code.<br/>
During print this M118-command will be replaced with the print message you defined.<br/><br/>
If you deactivate this checkbox, your slicer needs to provide the above M118 indicator commands.<br/>
This is helpfull if you use large files (>50MB) or if you use a mounted filesystem (e.g. NAS) instead of uploading files via UI.
</label>

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "DisplayLayerProgress"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "1.28.0"
plugin_version = "1.29.0.dev1"

# 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 b38a507

Please sign in to comment.