1
0
Fork 0

use locale for temp

master
Gordon Williams 2020-11-18 10:27:11 +00:00
parent afb6ab3669
commit 3110d6df4f
1 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,5 @@
var readings;
var failures = 0;
function displayInfo(reading) {
g.reset(1).setColor(1,0,0);
@ -18,7 +20,11 @@ function displayInfo(reading) {
g.drawString(reading.color, g.getWidth()*3/4, 24+40);
g.setFontVector(34);
g.setFontAlign(0,-1);
g.drawString(reading.F.toFixed(1),g.getWidth()/2,120);
// we can't use locale directly as it currently is just to the nearest degree
var temp = reading.C.toFixed(1)+"°C";
if (require("locale").temp(0).endsWith("F")) // check locale
temp = reading.F.toFixed(1)+"°F";
g.drawString(temp,g.getWidth()/2,120);
g.drawString(reading.gravity,g.getWidth()/2,180);
}
g.flip();
@ -39,8 +45,6 @@ var TILT_DEVICES = {
'a495bb70c5b14b44b5121370f02d74de': 'Yellow',
};
var failures = 0;
function takeReading() {
// scan for 5 seconds max
NRF.setScan(function(device) {