Always show actual received from printer instead of off

Regardless how cold the temperature is, display it in the table. Some
people otherwise seem to think that OctoPrint "can't handle"
temperatures below 10°C and will blame it for MINTEMP errors triggered
in the firmware.
This commit is contained in:
Gina Häußge committed 2018-12-06 11:49:23 +01:00
1 parent 5af5cbbb37
commit f4f7c87640
3 files changed
+14 -7

No files matched your search

+4 -4
View File
@@ -574,15 +574,15 @@ function formatFilament(filament) {
return _.sprintf(result, {length: filament["length"] / 1000, volume: filament["volume"]});
}
function cleanTemperature(temp) {
function cleanTemperature(temp, offThreshold) {
if (temp === undefined || !_.isNumber(temp)) return "-";
if (temp < 10) return gettext("off");
if (offThreshold !== undefined && temp < offThreshold) return gettext("off");
return temp;
}
function formatTemperature(temp, showF) {
function formatTemperature(temp, showF, offThreshold) {
if (temp === undefined || !_.isNumber(temp)) return "-";
if (temp < 10) return gettext("off");
if (offThreshold !== undefined && temp < offThreshold) return gettext("off");
if (showF) {
return _.sprintf("%.1f&deg;C (%.1f&deg;F)", temp, temp * 9 / 5 + 32);
} else {
@@ -401,7 +401,7 @@ $(function() {
}
var actualTemp = actuals && actuals.length ? formatTemperature(actuals[actuals.length - 1][1], showFahrenheit) : "-";
var targetTemp = targets && targets.length ? formatTemperature(targets[targets.length - 1][1], showFahrenheit) : "-";
var targetTemp = targets && targets.length ? formatTemperature(targets[targets.length - 1][1], showFahrenheit, 1) : "-";
data.push({
label: gettext("Actual") + " " + heaterOptions[type].name + ": " + actualTemp,
@@ -703,7 +703,14 @@ $(function() {
self._replaceLegendLabel = function(index, series, value, emph) {
var showFahrenheit = self._shallShowFahrenheit();
var temp = formatTemperature(value, showFahrenheit);
var temp;
if (index % 2 === 0) {
// actual series
temp = formatTemperature(value, showFahrenheit);
} else {
// target series
temp = formatTemperature(value, showFahrenheit, 1);
}
if (emph) {
temp = "<em>" + temp + "</em>";
}
@@ -25,7 +25,7 @@
<form class="form-inline" style="margin:0" data-bind="submit: function(element) { $root.setTarget($data, element) }">
<div class="input-prepend input-append">
<button type="button" class="btn btn-input-dec" data-bind="click: $root.decrementTarget, enable: $root.isOperational() && $root.loginState.isUser()" title="{{ _('Fine adjust: -1°C') }}"><i class="fa fa-minus"></i></button>
<input type="number" min="0" max="999" class="input-mini input-nospin" style="width: 30px" data-bind="attr: {placeholder: cleanTemperature(target())}, value: newTarget, valueUpdate: 'input', enable: $root.isOperational() && $root.loginState.isUser(), event: { focus: function(d, e) {$root.handleFocus(e, 'target', $data) } }">
<input type="number" min="0" max="999" class="input-mini input-nospin" style="width: 30px" data-bind="attr: {placeholder: cleanTemperature(target(), 1)}, value: newTarget, valueUpdate: 'input', enable: $root.isOperational() && $root.loginState.isUser(), event: { focus: function(d, e) {$root.handleFocus(e, 'target', $data) } }">
<span class="add-on">&deg;C</span>
<button type="button" class="btn btn-input-inc" data-bind="click: $root.incrementTarget, enable: $root.isOperational() && $root.loginState.isUser()" title="{{ _('Fine adjust: +1°C') }}"><i class="fa fa-plus"></i></button>
</div>