Skip to content

Commit

Permalink
New Version 1.26.0
Browse files Browse the repository at this point in the history
E #214: current_print_filename placeholder
B #220: total height replaced by newly uploaded file
B #182: show clock after reload
  • Loading branch information
OlafKa committed Apr 5, 2021
1 parent c382442 commit 307e3a4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ It shows:
* ```CurrentHeight, TotalHeight, Feedrate, Fanspeed,```
* ```ChangeFilamentTimeLeft, EstimatedChangeFilamentTime and ChangefilamentCount (based on M600 command location in file)```
* ```Printer State```
* ```Currently printed filename```

Some output examples:
- Printer Display: ```50% L=60/120 H=23mm/47mm```
Expand Down Expand Up @@ -91,6 +92,7 @@ You can receive the layer/height and other values via a GET-Call.
curl -H "X-Api-Key:57FECA453FE94D46851EFC94BC9B5265" http://localhost:5000/plugin/DisplayLayerProgress/values

{
"currentFilename": "AE10_xyzCalibration_cube.gcode",
"fanSpeed": "69%",
"feedrate": "3000",
"feedrateG0": "3000",
Expand Down Expand Up @@ -167,8 +169,9 @@ Plugin sends the following custom events to the eventbus like this:
'estimatedEndTime':'20:24',
'estimatedChangedFilamentTime': '20:22',
'changeFilamentTimeLeft': '1m12s,
'changeFilamentTimeLeftInSeconds': 72
'changeFilamentCount': 2
'changeFilamentTimeLeftInSeconds': 72,
'changeFilamentCount': 2,
'currentFilename': 'AE10_xyzCalibration_cube.gcode'
}
```
Other Plugins could listen to this events in there python-code like this:
Expand Down
30 changes: 24 additions & 6 deletions octoprint_DisplayLayerProgress/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
CHANGEFILAMENT_COUNT_KEYWORD_EXPRESSION = "[changefilament_count]"
PRINTER_STATE_KEYWORD_EXPRESSION = "[printer_state]"
M73PROGRESS_KEYWORD_EXPRESSION = "[M73progress]" # see https://github.com/tpmullan/OctoPrint-DetailedProgress
CURRENT_FILENAME_KEYWORD_EXPRESSION = "[current_print_filename]" # see https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/issues/214

UPDATE_DISPLAY_REASON_FRONTEND_CALL = "frontEndCall"
UPDATE_DISPLAY_REASON_HEIGHT_CHANGED = "heightChanged"
Expand Down Expand Up @@ -286,6 +287,8 @@ def __init__(self):
self._lastPrinterState = ""
self._m73Progress = ""

self._currentFilename = ""

self._printTimeGeniusPluginImplementationState = None
self._printTimeGeniusPluginImplementation = None

Expand Down Expand Up @@ -611,6 +614,8 @@ def _resetCurrentValues(self):

self._movementMode = MOVEMENT_ABSOLUTE

self._currentFilename = NOT_PRESENT


def _resetTotalValues(self):
self._layerTotalCountWithoutOffset = NOT_PRESENT
Expand Down Expand Up @@ -788,7 +793,8 @@ def _updateDisplay(self, updateReason):
CHANGEFILAMENTTIME_LEFT_KEYWORD_EXPRESSION: self._filamentChangeTimeLeftFormatted,
CHANGEFILAMENT_COUNT_KEYWORD_EXPRESSION: str(len(self._m600LayerProcessingList)),
PRINTER_STATE_KEYWORD_EXPRESSION: self._printerState,
M73PROGRESS_KEYWORD_EXPRESSION: self._m73Progress
M73PROGRESS_KEYWORD_EXPRESSION: self._m73Progress,
CURRENT_FILENAME_KEYWORD_EXPRESSION: self._currentFilename
}
printerMessagePattern = self._cachedSettings.getStringValue(SETTINGS_KEY_PRINTERDISPLAY_MESSAGEPATTERN)
printerMessageCommand = "M117 " + stringUtils.multiple_replace(printerMessagePattern, currentValueDict)
Expand Down Expand Up @@ -901,7 +907,8 @@ def _updateDisplay(self, updateReason):
estimatedChangedFilamentTime=self._filamentChangeETAFormatted,
changeFilamentTimeLeft=self._filamentChangeTimeLeftFormatted,
changeFilamentTimeLeftInSeconds=self._filamentChangeTimeLeftInSeconds,
changeFilamentCount=len(self._m600LayerProcessingList)
changeFilamentCount=len(self._m600LayerProcessingList),
currentFilename=self._currentFilename
)

if (self._lastSendEventBusData != eventPayload):
Expand Down Expand Up @@ -1175,7 +1182,8 @@ def get_displayLayerProgressValues(self):
"changeFilamentTimeLeft": self._filamentChangeTimeLeftFormatted,
"changeFilamentTimeLeftInSeconds": self._filamentChangeTimeLeftInSeconds,
"changeFilamentCount": len(self._m600LayerProcessingList)
}
},
"currentFilename": self._currentFilename
})

################################################################################################ COMMON PLUGIN HOOKS
Expand Down Expand Up @@ -1264,6 +1272,9 @@ def on_event(self, event, payload):
self._logger.info("File '" + selectedFile + "' selected. Determining number of layers.")
self._resetCurrentValues()
self._resetTotalValues()

self._currentFilename = selectedFilename

self._updateDisplay(UPDATE_DISPLAY_REASON_FRONTEND_CALL)

if (fileLocation == octoprint.filemanager.FileDestinations.SDCARD):
Expand Down Expand Up @@ -1399,6 +1410,8 @@ def on_event(self, event, payload):
# which M600 layers should be processed
self._m600LayerProcessingList = list(self._m600LayerList)

self._currentFilename = payload.get("path")

self._updateDisplay(UPDATE_DISPLAY_REASON_FRONTEND_CALL)
self._checkLayerExpressionValid()

Expand Down Expand Up @@ -1464,9 +1477,14 @@ def _storeLayerCountInMeta(self, fileLocation, selectedFilename, layerTotalCount


def _readHeightFromFileMeta(self, fileLocation, selectedFilename):
# layerFound = False
self._logger.info("Read total height from MetaFile")
metaDataDict = self._file_manager.get_metadata(fileLocation, selectedFilename)

# read only for currently selected filename and not for future files (upload during running print)
if (self._currentFilename == selectedFilename):
self._logger.info("Read total height from MetaFile")
metaDataDict = self._file_manager.get_metadata(fileLocation, selectedFilename)
else:
self._logger.info("Did NOT reading total height from MetaFile, because analyse was done for not selected file. Current: '"+self._currentFilename+"' Analyse for: '"+selectedFilename+"'")
return

# - read height from meta
if ("analysis" in metaDataDict):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ $(function () {
self.updateClock();
});

// Start/Show (if needed) clock after inital load
self.updateClock();

// self.origGetAdditionDataFunction = self.filesViewModel.getAdditionalData;
// self.filesViewModel.getAdditionalData = function(data){
// var additionDataAsHtml = "Layers: 123<br>" + self.origGetAdditionDataFunction(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
[current_height], [total_height], <br/>
[feedrate], [feedrate_g0], [feedrate_g1], [fanspeed], <br/>
[changefilamenttime_left], [estimated_changefilament_time], [changefilament_count], <br/>
[printer_state]
[printer_state], <br/>
[current_print_filename]
</code>
</div>
<br>
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.25.4"
plugin_version = "1.26.0"

# 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 307e3a4

Please sign in to comment.