diff --git a/apps.json b/apps.json index b4ff19d42..ffccf8ac4 100644 --- a/apps.json +++ b/apps.json @@ -5026,24 +5026,38 @@ ] }, { "id": "circlesclock", - "name": "Circles clock", - "shortName":"Circles clock", - "version":"0.02", - "description": "A clock with circles for different data at the bottom in a probably familiar style", - "icon": "app.png", - "dependencies": {"widpedom":"app"}, - "type": "clock", - "tags": "clock", - "supports" : ["BANGLEJS2"], - "allow_emulator":true, - "readme": "README.md", - "storage": [ - {"name":"circlesclock.app.js","url":"app.js"}, - {"name":"circlesclock.img","url":"app-icon.js","evaluate":true}, - {"name":"circlesclock.settings.js","url":"settings.js"} - ], - "data": [ - {"name":"circlesclock.json"} - ] - } + "name": "Circles clock", + "shortName":"Circles clock", + "version":"0.02", + "description": "A clock with circles for different data at the bottom in a probably familiar style", + "icon": "app.png", + "dependencies": {"widpedom":"app"}, + "type": "clock", + "tags": "clock", + "supports" : ["BANGLEJS2"], + "allow_emulator":true, + "readme": "README.md", + "storage": [ + {"name":"circlesclock.app.js","url":"app.js"}, + {"name":"circlesclock.img","url":"app-icon.js","evaluate":true}, + {"name":"circlesclock.settings.js","url":"settings.js"} + ], + "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} + ] + } ] diff --git a/apps/ltherm/app.js b/apps/ltherm/app.js new file mode 100644 index 000000000..7accae2ed --- /dev/null +++ b/apps/ltherm/app.js @@ -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(); diff --git a/apps/ltherm/icon.js b/apps/ltherm/icon.js new file mode 100644 index 000000000..4f3cc4b0a --- /dev/null +++ b/apps/ltherm/icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwhC/AH4AChGIxGAC6eIAQgARFgUIC9ReCAYJgSC7BHDF6gUBC6ovWI/5Hga/6P/ABsCkABDC/4XxkQXDkQuSAQwXPDQkAC6BBCkQDDC6MCmczFoIXQCQQXBDgQXP2EA2YXBncAhYXR3YXB3YXRCQWznYcCC6ICBAYYXPhYrBApAwPFyQqCIoYuRLwZgDAH4A/")) diff --git a/apps/ltherm/readme.md b/apps/ltherm/readme.md new file mode 100644 index 000000000..b68cb1fc1 --- /dev/null +++ b/apps/ltherm/readme.md @@ -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. diff --git a/apps/ltherm/thermf.png b/apps/ltherm/thermf.png new file mode 100644 index 000000000..bb33cb939 Binary files /dev/null and b/apps/ltherm/thermf.png differ