Skip to content

Commit

Permalink
Bug fixes and minor enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
sco01 committed Sep 15, 2019
1 parent f5b0e35 commit b028090
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
14 changes: 10 additions & 4 deletions octoprint_dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ def on_after_startup(self):
self._logger.info("Dashboard started")

def on_event(self, event, payload):
if event == "DisplayLayerProgress_layerChanged" or event == "DisplayLayerProgress_progressChanged":
#self._logger.info(payload.get('currentLayer'))
self._plugin_manager.send_plugin_message(self._identifier, dict(totalLayer=payload.get('totalLayer'),
currentLayer=payload.get('currentLayer'),
if event == "DisplayLayerProgress_layerChanged" or event == "DisplayLayerProgress_progressChanged" or event == "DisplayLayerProgress_fanspeedChanged":
newCurrentLayer = 0
newTotalLayer = 0
#self._logger.info("Layer: " + payload.get('currentLayer'))
if payload.get('totalLayer').isdigit():
newTotalLayer = int(payload.get('totalLayer')) + 1 # Because DisplayLayerProgress is base 0
if payload.get('currentLayer').isdigit():
newCurrentLayer = int(payload.get('currentLayer')) + 1
self._plugin_manager.send_plugin_message(self._identifier, dict(totalLayer=newTotalLayer,
currentLayer=newCurrentLayer,
currentHeight=payload.get('currentHeight'),
totalHeightWithExtrusion=payload.get('totalHeightWithExtrusion'),
feedrate=payload.get('feedrate'),
Expand Down
10 changes: 5 additions & 5 deletions octoprint_dashboard/static/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ $(function() {
self.displaylayerprogressViewModel = parameters[5];


self.totalLayer = ko.observable(0);
self.currentLayer = ko.observable(0);
self.totalLayer = ko.observable("-");
self.currentLayer = ko.observable("-");
self.currentHeight = ko.observable("-");
self.totalHeightWithExtrusion = ko.observable("-");
self.feedrate = ko.observable("-");
Expand All @@ -32,16 +32,16 @@ $(function() {
self.DisplayLayerProgressAvailable = function() {
if (self.settingsViewModel.settings.plugins.DisplayLayerProgress)
return;
else return "Can't get stats from <a href='https://plugins.octoprint.org/plugins/DisplayLayerProgress/''>DisplayLayerprogress</a>. Is it installed, enabled and on the latest version?";
else return "Can't get stats from <a href='https://plugins.octoprint.org/plugins/DisplayLayerProgress/' target='_blank'>DisplayLayerprogress</a>. Is it installed, enabled and on the latest version?";
}

//Events from displaylayerprogress Plugin
self.onDataUpdaterPluginMessage = function(plugin, data) {
if (plugin != "dashboard") {
return;
}
if (data.totalLayer) { self.totalLayer( parseInt(data.totalLayer) + 1); }
if (data.currentLayer) { self.currentLayer(parseInt(data.currentLayer) + 1); }
if (data.totalLayer) { self.totalLayer(data.totalLayer); }
if (data.currentLayer) { self.currentLayer(data.currentLayer); }
if (data.currentHeight) { self.currentHeight(data.currentHeight); }
if (data.totalHeightWithExtrusion) { self.totalHeightWithExtrusion(data.totalHeightWithExtrusion); }
if (data.feedrate) { self.feedrate(data.feedrate); }
Expand Down
20 changes: 10 additions & 10 deletions octoprint_dashboard/templates/dashboard_tab.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<img class="dashboardIcon" title="Hotend temp (target temp)" src="/plugin/dashboard/static/img/hotend-icon.png"></img>
<svg xmlns="http://www.w3.org/2000/svg" height="120" width="120" viewBox="0 0 200 200">
<path class="bg" stroke="#ccc" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none"/>
<path class="dashboardGauge" stroke="#09c" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': $parent.formatTempOffset(actual(), $parent.settingsViewModel.settings.plugins.dashboard.hotendTempMax()) }"/>
<path class="target" stroke="gray" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': $parent.formatTempOffset(target(), $parent.settingsViewModel.settings.plugins.dashboard.hotendTempMax()) }"/>
<text class="dashboardGauge" font-size="30" x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: actual() + '°C'"></text>
<path class="dashboardGauge" stroke="#09c" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': $parent.formatTempOffset(actual(), 300) }"/>
<path class="target" stroke="gray" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': $parent.formatTempOffset(target(), 300) }"/>
<text class="dashboardGauge" font-size="30" x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: Math.round(actual()) + '°C'"></text>
<text class="dashboardGauge" font-size="20" x="50%" y="65%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: name()"></text>
<text class="dashboardGauge" font-size="20" x="50%" y="85%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: 'Target: ' + target() + '°C' "></text>
</svg>
Expand All @@ -37,9 +37,9 @@
<img class="dashboardIcon" title="Bed temp (target temp)" src="/plugin/dashboard/static/img/bed-icon.png"></img>
<svg xmlns="http://www.w3.org/2000/svg" height="120" width="120" viewBox="0 0 200 200">
<path class="bg" stroke="#ccc" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none"/>
<path class="dashboardGauge" stroke="#09c" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': formatTempOffset(temperatureModel.bedTemp.actual(), settingsViewModel.settings.plugins.dashboard.bedTempMax()) }"/>
<path class="target" stroke="gray" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': formatTempOffset(temperatureModel.bedTemp.target(), settingsViewModel.settings.plugins.dashboard.bedTempMax()) }"/>
<text class="dashboardGauge" font-size="30" x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: temperatureModel.bedTemp.actual() + '°C'"></text>
<path class="dashboardGauge" stroke="#09c" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': formatTempOffset(temperatureModel.bedTemp.actual(), 300) }"/>
<path class="target" stroke="gray" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': formatTempOffset(temperatureModel.bedTemp.target(), 300) }"/>
<text class="dashboardGauge" font-size="30" x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: Math.round(temperatureModel.bedTemp.actual()) + '°C'"></text>
<text class="dashboardGauge" font-size="20" x="50%" y="85%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: 'Target: ' + temperatureModel.bedTemp.target() + '°C' "></text>
</svg>
</div>
Expand All @@ -49,16 +49,16 @@
<img class="dashboardIcon" title="Chamber temp (target temp)" src="/plugin/dashboard/static/img/chamber-icon.png"></img>
<svg xmlns="http://www.w3.org/2000/svg" height="120" width="120" viewBox="0 0 200 200">
<path class="bg" stroke="#ccc" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none"/>
<path class="dashboardGauge" stroke="#09c" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': formatTempOffset(temperatureModel.chamberTemp.actual(), settingsViewModel.settings.plugins.dashboard.chamberTempMax()) }"/>
<path class="target" stroke="gray" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': formatTempOffset(temperatureModel.chamberTemp.target(), settingsViewModel.settings.plugins.dashboard.chamberTempMax()) }"/>
<text class="dashboardGauge" font-size="30" x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: temperatureModel.chamberTemp.actual() + '°C'"></text>
<path class="dashboardGauge" stroke="#09c" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': formatTempOffset(temperatureModel.chamberTemp.actual(), 300) }"/>
<path class="target" stroke="gray" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none" stroke-dasharray="350" data-bind="attr: { 'stroke-dashoffset': formatTempOffset(temperatureModel.chamberTemp.target(), 300) }"/>
<text class="dashboardGauge" font-size="30" x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: Math.round(temperatureModel.chamberTemp.actual()) + '°C'"></text>
<text class="dashboardGauge" font-size="20" x="50%" y="85%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="html: 'Target: ' + temperatureModel.chamberTemp.target() + '°C' "></text>
</svg>
</div>

<!-- Fan Speed -->
<div class="dashboardGridItem" data-bind="visible: temperatureModel.isOperational()">
<img class="dashboardIcon" title="Bed temp (target temp)" src="/plugin/dashboard/static/img/fan-icon.png"></img>
<img class="dashboardIcon" title="Fan Speed" src="/plugin/dashboard/static/img/fan-icon.png"></img>
<svg xmlns="http://www.w3.org/2000/svg" height="120" width="120" viewBox="0 0 200 200">
<text class="dashboardGauge" font-size="30" x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" fill="#08c" data-bind="attr: { title: 'Fan Speed' }, html: fanspeed"></text>
<path class="bg" stroke="#ccc" d="M41 149.5a77 77 0 1 1 117.93 0" fill="none"/>
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 = "OctoPrint-Dashboard"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "1.0.0"
plugin_version = "1.1.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 b028090

Please sign in to comment.