From d59db5ba381941c14abc0676c2fb174063a2e2d9 Mon Sep 17 00:00:00 2001 From: Marco Heiming Date: Tue, 11 Jan 2022 11:48:10 +0100 Subject: [PATCH 1/3] Show correct percentage values in circles --- apps.json | 2 +- apps/circlesclock/ChangeLog | 1 + apps/circlesclock/app.js | 13 ++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps.json b/apps.json index 02076497e..8d1e481a1 100644 --- a/apps.json +++ b/apps.json @@ -5097,7 +5097,7 @@ { "id": "circlesclock", "name": "Circles clock", "shortName":"Circles clock", - "version":"0.04", + "version":"0.05", "description": "A clock with circles for different data at the bottom in a probably familiar style", "icon": "app.png", "screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}], diff --git a/apps/circlesclock/ChangeLog b/apps/circlesclock/ChangeLog index ca1da6e21..86b77bb6f 100644 --- a/apps/circlesclock/ChangeLog +++ b/apps/circlesclock/ChangeLog @@ -5,3 +5,4 @@ Add step distance and weather Allow switching visibility of widgets Make circles and text slightly bigger +0.05: Show correct percentage values in circles diff --git a/apps/circlesclock/app.js b/apps/circlesclock/app.js index 91d4937c4..de7bc73f9 100644 --- a/apps/circlesclock/app.js +++ b/apps/circlesclock/app.js @@ -363,22 +363,21 @@ function radians(a) { } function drawGauge(cx, cy, percent, color) { - let offset = 30; - let end = 300; - var i = 0; - var r = radiusInner + 3; + const offset = 15; + const end = 345; + const r = radiusInner + 3; if (percent <= 0) return; if (percent > 1) percent = 1; - var startrot = -offset; - var endrot = startrot - ((end - offset) * percent) - 35; + const startrot = -offset; + const endrot = startrot - ((end - offset) * percent); g.setColor(color); const size = radiusOuter - radiusInner - 2; // draw gauge - for (i = startrot; i > endrot - size; i -= size) { + for (let i = startrot; i > endrot - size; i -= size) { x = cx + r * Math.sin(radians(i)); y = cy + r * Math.cos(radians(i)); g.fillCircle(x, y, size); From d12a415740bd5236d9d475551a9fac69e2bee62a Mon Sep 17 00:00:00 2001 From: Marco Heiming Date: Tue, 11 Jan 2022 13:52:19 +0100 Subject: [PATCH 2/3] Show humidity as weather circle data --- apps/circlesclock/README.md | 3 +++ apps/circlesclock/app.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/apps/circlesclock/README.md b/apps/circlesclock/README.md index 9aaa4bc8e..c3704e3d7 100644 --- a/apps/circlesclock/README.md +++ b/apps/circlesclock/README.md @@ -10,6 +10,9 @@ It can show the following information (this can be configured): * Heart rate (automatically updates when screen is on and unlocked) * Battery (including charging status and battery low warning) * Weather (requires [weather app](https://banglejs.com/apps/#weather)) + * Humidity as circle progress + * Temperature inside circle + * Condition as icon below circle ## Screenshots ![Screenshot dark theme](screenshot-dark.png) diff --git a/apps/circlesclock/app.js b/apps/circlesclock/app.js index de7bc73f9..822802afa 100644 --- a/apps/circlesclock/app.js +++ b/apps/circlesclock/app.js @@ -283,6 +283,7 @@ function drawWeather(w) { if (!w) w = getCirclePosition("weather"); const weather = getWeather(); const tempString = weather ? locale.temp(weather.temp - 273.15) : undefined; + const humidity = weather ? weather.hum : undefined; const code = weather ? weather.code : -1; // Draw rectangle background: @@ -292,6 +293,10 @@ function drawWeather(w) { g.setColor(colorGrey); g.fillCircle(w, h3, radiusOuter); + if (humidity >= 0) { + drawGauge(w, h3, humidity / 100, colorYellow); + } + g.setColor(colorBg); g.fillCircle(w, h3, radiusInner); From a29dbeedd3cf3b0084999fca59244d739bb0ee4b Mon Sep 17 00:00:00 2001 From: Marco Heiming Date: Tue, 11 Jan 2022 14:08:48 +0100 Subject: [PATCH 3/3] Update changelog --- apps/circlesclock/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/circlesclock/ChangeLog b/apps/circlesclock/ChangeLog index 86b77bb6f..5464a8103 100644 --- a/apps/circlesclock/ChangeLog +++ b/apps/circlesclock/ChangeLog @@ -6,3 +6,4 @@ Allow switching visibility of widgets Make circles and text slightly bigger 0.05: Show correct percentage values in circles + Show humidity as weather circle data