Skip to content

Commit

Permalink
Merge pull request #10 from doughoyt/Configurable-Temp-Max
Browse files Browse the repository at this point in the history
Add settings to allow custom 'max' temperature for hotend(s), bed, an…
  • Loading branch information
StefanCohen committed Sep 15, 2019
2 parents e637bfd + a7f55c5 commit f5b0e35
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
7 changes: 6 additions & 1 deletion octoprint_dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ def on_event(self, event, payload):

##~~ SettingsPlugin mixin
def get_settings_defaults(self):
return dict(gaugetype="circle")
return dict(
gaugetype="circle",
hotendTempMax="300",
bedTempMax="100",
chamberTempMax="50"
)

def get_template_configs(self):
return [ dict(dict(type="tab", custom_bindings=False),
Expand Down
21 changes: 21 additions & 0 deletions octoprint_dashboard/templates/dashboard_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@
</div>
</div>


<h4>{{ _('Temperature Gauge Maximums') }}</h4>
<div class="control-group">
<label class="control-label">{{ _('Hotend Max:')}}</label>
<div class="controls">
<input type="number" min="0" max="300" step="10" class="input-mini text-left" data-bind="value: settings.plugins.dashboard.hotendTempMax">
<span class="add-on">&deg;C</span>
</div>
<label class="control-label">{{ _('Bed Max:')}}</label>
<div class="controls">
<input type="number" min="0" max="300" step="10" class="input-mini text-left" data-bind="value: settings.plugins.dashboard.bedTempMax">
<span class="add-on">&deg;C</span>
</div>
<label class="control-label">{{ _('Chamber Max:')}}</label>
<div class="controls">
<input type="number" min="0" max="300" step="10" class="input-mini text-left" data-bind="value: settings.plugins.dashboard.chamberTempMax">
<span class="add-on">&deg;C</span>
</div>
</div>


</form>


12 changes: 6 additions & 6 deletions octoprint_dashboard/templates/dashboard_tab.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<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(), 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) }"/>
<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>
<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>
Expand All @@ -37,8 +37,8 @@
<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(), 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) }"/>
<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>
<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>
Expand All @@ -49,8 +49,8 @@
<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(), 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) }"/>
<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>
<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>
Expand Down

0 comments on commit f5b0e35

Please sign in to comment.