Skip to content

Commit

Permalink
Merge pull request #1 from StefanCohen/master
Browse files Browse the repository at this point in the history
Sync my old fork to the latest version of StefanCohen's version
  • Loading branch information
spiff72 committed May 18, 2020
2 parents b285ddb + d9a8049 commit 2cb5c73
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
7 changes: 5 additions & 2 deletions octoprint_dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ class DashboardPlugin(octoprint.plugin.SettingsPlugin,
def psUtilGetStats(self):
temp_sum = 0
thermal = psutil.sensors_temperatures(fahrenheit=False)
if "cpu-thermal" in thermal:
if "cpu-thermal" in thermal: #RPi
self.cpu_temp = int(round((thermal["cpu-thermal"][0][1])))
elif 'coretemp' in thermal:
elif 'soc_thermal' in thermal: #BananaPi
self.cpu_temp=int(round(float(thermal['soc_thermal'][0][1])*1000))
elif 'coretemp' in thermal: #Intel
for temp in range(0,len(thermal["coretemp"]),1):
temp_sum = temp_sum+thermal["coretemp"][temp][1]
self.cpu_temp = int(round(temp_sum / len(thermal["coretemp"])))
Expand Down Expand Up @@ -108,6 +110,7 @@ def get_settings_defaults(self):
showProgress=True,
showLayerProgress=False,
hideHotend=False,
supressDlpWarning=False,
showFullscreen=True,
showFilament=True,
showLayerGraph=False,
Expand Down
10 changes: 7 additions & 3 deletions octoprint_dashboard/static/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ $(function () {
self.DisplayLayerProgressAvailable = function () {
if (self.settingsViewModel.settings.plugins.DisplayLayerProgress)
return true;
else if (self.settingsViewModel.settings.plugins.dashboard.supressDlpWarning())
return true;
else {
printerDisplay = new PNotify({
title: 'Dashboard',
Expand Down Expand Up @@ -458,11 +460,13 @@ $(function () {
if (target == 0) {
return "#08c";
}
else if (target > 0) {
if (actual < target - self.settingsViewModel.settings.plugins.dashboard.targetTempDeviation()) {
else if (parseInt(target) > 0) {
if (parseInt(actual) < parseInt(target) - parseInt(self.settingsViewModel.settings.plugins.dashboard.targetTempDeviation()) ) {
//console.log("Less than set temp!");
return "#08c"; //blue
}
else if (actual > target + self.settingsViewModel.settings.plugins.dashboard.targetTempDeviation()) {
else if (parseInt(actual) > parseInt(target) + parseInt(self.settingsViewModel.settings.plugins.dashboard.targetTempDeviation()) ) {
//console.log("Above set temp!");
return "#ff3300"; //red
}
else return "#28b623"; //green
Expand Down
8 changes: 5 additions & 3 deletions octoprint_dashboard/templates/dashboard_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
<input type="checkbox" data-bind="checked: settings.plugins.dashboard.hideHotend">
</label>
</div>
<div >
<label class="checkbox">{{ _('Supress DLP warning messages') }}
<input type="checkbox" data-bind="checked: settings.plugins.dashboard.supressDlpWarning">
</label>
</div>
</div>

<legend>{{ _('CPU Temperature warning thresholds') }}</legend>
Expand All @@ -130,9 +135,6 @@
</div>
</div>




</form>


2 changes: 1 addition & 1 deletion octoprint_dashboard/templates/dashboard_tab.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
</div>

<!-- Warning if DisplayLayerProgress is not installed -->
<div class="dashboardGridItem" data-bind="visible: !DisplayLayerProgressAvailable()">
<div class="dashboardGridItem" data-bind="visible: !DisplayLayerProgressAvailable() && !settingsViewModel.settings.plugins.dashboard.supressDlpWarning()">
<span class="dashboardSmall" id="warn" style="color: red;">Warning! Can't get stats from <a href='https://plugins.octoprint.org/plugins/DisplayLayerProgress/' target='_blank'>DisplayLayerProgress</a>. Is it installed?</span>
<br/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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.11.4"
plugin_version = "1.12.1"

# 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 2cb5c73

Please sign in to comment.