Skip to content

Commit

Permalink
More precise temp conversions as rounding errors made granular thermo…
Browse files Browse the repository at this point in the history
…stat controls difficult. Bump version in prep of new package
  • Loading branch information
imbrianj committed Jan 10, 2018
1 parent 4e6556c commit 0448208
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cache/version.txt
@@ -1 +1 @@
1515464995205
1515546199655
4 changes: 2 additions & 2 deletions js/combo.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/sharedUtil.js
Expand Up @@ -231,14 +231,14 @@
* Accept a temperature in fahrenheit and convert it to celsius.
*/
fToC : function (f) {
return Math.round((f - 32) / 1.8);
return Math.round(10 * ((f - 32) / 1.8)) / 10;
},

/**
* Accept a temperature in celsius and convert it to fahrenheit.
*/
cToF : function (c) {
return Math.round((c * 1.8) + 32);
return Math.round(10 * ((c * 1.8) + 32)) / 10;
},
};
})(typeof exports === 'undefined' ? this.SB : exports);
4 changes: 2 additions & 2 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "switchboard-automation",
"description": "Universal Remote Controller powered by Node.js",
"version": "0.2.0",
"version": "0.2.1",
"author": "Brian J.",
"contributors": [
"Akshay Patel"
Expand All @@ -15,7 +15,7 @@
"switchBoard": "bin/switchBoard"
},
"engines": {
"node": ">=0.9.0"
"node": ">=0.10.0"
},
"preferGlobal": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/devices/monoPrice3dPrinter/controller.js
Expand Up @@ -63,7 +63,7 @@ exports.monoPrice3dPrinterControllerTest = {
}, 'Parse through printer data response');
test.deepEqual(testMonoPrice3dPrinterFData, { extruderTemp : 374,
extruderTarget : 383,
bedTemp : 84,
bedTemp : 84.2,
bedTarget : 0,
percent : 7
}, 'Parse through printer data response');
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/devices/weather/controller.js
Expand Up @@ -91,10 +91,10 @@ exports.weatherControllerTest = {
test.strictEqual(results[1].high, 55);
test.strictEqual(results[1].low, 40);

test.strictEqual(metricResults[0].high, 14);
test.strictEqual(metricResults[0].low, 7);
test.strictEqual(metricResults[1].high, 13);
test.strictEqual(metricResults[1].low, 4);
test.strictEqual(metricResults[0].high, 14.4);
test.strictEqual(metricResults[0].low, 6.7);
test.strictEqual(metricResults[1].high, 12.8);
test.strictEqual(metricResults[1].low, 4.4);

test.done();
}
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/lib/sharedUtil.js
Expand Up @@ -137,9 +137,9 @@ exports.sharedUtilTest = {

var util = require(__dirname + '/../../../lib/sharedUtil').util;

test.strictEqual(util.cToF(0), 32, 'Freezing point');
test.strictEqual(util.cToF(100), 212, 'Boiling point');
test.strictEqual(util.cToF(24), 75, 'A nice day');
test.strictEqual(util.cToF(0), 32, 'Freezing point');
test.strictEqual(util.cToF(100), 212, 'Boiling point');
test.strictEqual(util.cToF(24), 75.2, 'A nice day');

test.done();
},
Expand Down

0 comments on commit 0448208

Please sign in to comment.