From b38a5076cb17f525b8f07b2dd7e1ade039ad34e8 Mon Sep 17 00:00:00 2001 From: OllisGit Date: Sun, 6 Feb 2022 19:57:51 +0100 Subject: [PATCH] Dev Release 1.29.0.dev1 - E #252 replaced all gcode from M117 to M118 --- octoprint_DisplayLayerProgress/__init__.py | 26 +++++++++---------- octoprint_DisplayLayerProgress/stringUtils.py | 6 ++--- .../DisplayLayerProgress_settings.jinja2 | 12 ++++----- setup.py | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/octoprint_DisplayLayerProgress/__init__.py b/octoprint_DisplayLayerProgress/__init__.py index 2fcd096..3da24fe 100644 --- a/octoprint_DisplayLayerProgress/__init__.py +++ b/octoprint_DisplayLayerProgress/__init__.py @@ -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 @@ -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: @@ -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 @@ -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 @@ -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 @@ -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] @@ -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 @@ -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): @@ -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) @@ -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 @@ -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) @@ -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: diff --git a/octoprint_DisplayLayerProgress/stringUtils.py b/octoprint_DisplayLayerProgress/stringUtils.py index 17aedf0..c3764eb 100644 --- a/octoprint_DisplayLayerProgress/stringUtils.py +++ b/octoprint_DisplayLayerProgress/stringUtils.py @@ -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') @@ -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) diff --git a/octoprint_DisplayLayerProgress/templates/DisplayLayerProgress_settings.jinja2 b/octoprint_DisplayLayerProgress/templates/DisplayLayerProgress_settings.jinja2 index 59371bf..d8de08c 100644 --- a/octoprint_DisplayLayerProgress/templates/DisplayLayerProgress_settings.jinja2 +++ b/octoprint_DisplayLayerProgress/templates/DisplayLayerProgress_settings.jinja2 @@ -17,7 +17,7 @@ - +
@@ -178,7 +178,7 @@ output.
To test it, send the following message example G-Code (via terminal) to your printer:

- M117 xxx% L=xxx/xxx H=xxx.xx/xxx.xx + M118 xxx% L=xxx/xxx H=xxx.xx/xxx.xx

!!! Some printers ignore the overlapping characters or special chars (e.g. :) and some stop working !!! @@ -189,7 +189,7 @@
Output interval
- 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.

@@ -229,9 +229,9 @@ diff --git a/setup.py b/setup.py index eff3dc8..9437e40 100644 --- a/setup.py +++ b/setup.py @@ -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