Merge branch 'elrod16-master'

pull/1128/head
Gordon Williams 2021-12-17 14:08:17 +00:00
commit f553267a64
5 changed files with 63 additions and 20 deletions

View File

@ -5045,5 +5045,19 @@
"data": [
{"name":"circlesclock.json"}
]
},
{
"id": "ltherm",
"name": "Localized Thermometer",
"version": "0.01",
"description": "Displays the current temperature in localized units.",
"icon": "thermf.png",
"tags": "tool",
"supports": ["BANGLEJS2"],
"allow_emulator": true,
"storage": [
{"name":"ltherm.app.js","url":"app.js"},
{"name":"ltherm.img","url":"icon.js","evaluate":true}
]
}
]

25
apps/ltherm/app.js Normal file
View File

@ -0,0 +1,25 @@
function drawTemperature() {
g.reset(1).clearRect(0,24,g.getWidth(),g.getHeight());
g.setFont("6x8",2).setFontAlign(0,0);
var x = g.getWidth()/2;
var y = g.getHeight()/2 + 10;
g.drawString("Temp", x, y - 45);
g.setFontVector(70).setFontAlign(0,0);
var h = E.getTemperature();
if (avg.length < 10) {
avg[avg.length] = h;
} else {
avg.shift();
avg[avg.length] = h;
h = ((avg[0] + avg[1] + avg[2] + avg[3] + avg[4] + avg[5] + avg[6] + avg[7] + avg[8] + avg[9]) / 10);
}
var t = require('locale').temp(h);
g.drawString(t, x, y);
}
const avg = [];
setInterval(function() {
drawTemperature();
}, 2000);
E.showMessage("Loading...");
Bangle.loadWidgets();
Bangle.drawWidgets();

1
apps/ltherm/icon.js Normal file
View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwhC/AH4AChGIxGAC6eIAQgARFgUIC9ReCAYJgSC7BHDF6gUBC6ovWI/5Hga/6P/ABsCkABDC/4XxkQXDkQuSAQwXPDQkAC6BBCkQDDC6MCmczFoIXQCQQXBDgQXP2EA2YXBncAhYXR3YXB3YXRCQWznYcCC6ICBAYYXPhYrBApAwPFyQqCIoYuRLwZgDAH4A/"))

3
apps/ltherm/readme.md Normal file
View File

@ -0,0 +1,3 @@
# Thermometer
Localized Bangle.js 2 thermometer app. It also starts maintaining an average of the temperature to help lower the margin of error after 10 consecutive readings; due to the low quality die-thermometer.

BIN
apps/ltherm/thermf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB