Skip to content

Commit

Permalink
Fixed issue with layer graph data
Browse files Browse the repository at this point in the history
  • Loading branch information
sco01 committed Oct 8, 2019
1 parent 070bb35 commit a785f04
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions octoprint_dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ def send_notifications(self):

def on_event(self, event, payload):
if event == "DisplayLayerProgress_layerChanged" or event == "DisplayLayerProgress_fanspeedChanged" or event == "DisplayLayerProgress_heightChanged":
if payload.get('lastLayerDurationInSeconds') != "-" and int(payload.get('lastLayerDurationInSeconds')) > 0:
self.layer_times.append(payload.get('lastLayerDurationInSeconds'))
self.layer_labels.append(int(payload.get('currentLayer')) - 1)
self._plugin_manager.send_plugin_message(self._identifier, dict(totalLayer=payload.get('totalLayer'),
currentLayer=payload.get('currentLayer'),
currentHeight=payload.get('currentHeight'),
Expand All @@ -111,6 +108,13 @@ def on_event(self, event, payload):
averageLayerDuration=payload.get('averageLayerDuration'),
averageLayerDurationInSeconds=payload.get('averageLayerDurationInSeconds')))

if event == "DisplayLayerProgress_layerChanged" and payload.get('lastLayerDurationInSeconds') != "-" and int(payload.get('lastLayerDurationInSeconds')) > 0:
#Update the layer graph data
self.layer_times.append(payload.get('lastLayerDurationInSeconds'))
self.layer_labels.append(int(payload.get('currentLayer')) - 1)



if event == "PrintStarted":
del self.layer_times[:]
del self.layer_labels[:]
Expand Down

0 comments on commit a785f04

Please sign in to comment.