From c62ccf27e15bf0485b9fa68a5b5b40ee49a18293 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 9 Jun 2023 16:41:11 +0200 Subject: [PATCH 1/2] Release sunrise 0.02, faster sinus and fix menu button --- apps/sunrise/ChangeLog | 1 + apps/sunrise/app.js | 6 ++++-- apps/sunrise/metadata.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/sunrise/ChangeLog b/apps/sunrise/ChangeLog index 7b83706bf..19e3bb33b 100644 --- a/apps/sunrise/ChangeLog +++ b/apps/sunrise/ChangeLog @@ -1 +1,2 @@ 0.01: First release +0.02: Faster sinus line and fix button to open menu diff --git a/apps/sunrise/app.js b/apps/sunrise/app.js index 30b344c56..2fa2a7502 100644 --- a/apps/sunrise/app.js +++ b/apps/sunrise/app.js @@ -177,6 +177,7 @@ function ypos (x) { let sunRiseX = 0; let sunSetX = 0; +const sinStep = 12; function drawSinuses () { let x = 0; @@ -187,14 +188,14 @@ function drawSinuses () { let y = oy; for (i = 0; i < w; i++) { x = i; - x2 = x + 6; + x2 = x + sinStep + 1; y2 = ypos(i); if (x == 0) { y = y2; } g.drawLine(x, y, x2, y2); y = y2; - i += 5; // no need to draw all steps + i += sinStep; // no need to draw all steps } // sea level line @@ -318,4 +319,5 @@ Bangle.on('tap', () => { }); renderScreen(); +Bangle.setUI("clock"); setInterval(renderScreen, 60 * 1000); diff --git a/apps/sunrise/metadata.json b/apps/sunrise/metadata.json index 61fe45520..f3012144a 100644 --- a/apps/sunrise/metadata.json +++ b/apps/sunrise/metadata.json @@ -2,7 +2,7 @@ "id": "sunrise", "name": "Sunrise", "shortName": "Sunrise", - "version": "0.01", + "version": "0.02", "type": "clock", "description": "Show sunrise and sunset times", "icon": "app.png", From 84bde38d89414868963b72d3e26b6ab227a0a62d Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 9 Jun 2023 16:58:51 +0200 Subject: [PATCH 2/2] Call setUI before loadWidgets --- apps/sunrise/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sunrise/app.js b/apps/sunrise/app.js index 2fa2a7502..57fb1c2dc 100644 --- a/apps/sunrise/app.js +++ b/apps/sunrise/app.js @@ -13,6 +13,8 @@ function loadLocation () { } } +Bangle.setUI("clock"); +Bangle.loadWidgets(); const latlon = loadLocation(); const lat = latlon.lat || 41.38; const lon = latlon.lon || 2.168; @@ -294,7 +296,6 @@ function renderScreen () { g.setBgColor(0, 0, 0); g.clear(); if (realTime) { - Bangle.loadWidgets(); Bangle.drawWidgets(); } drawGlow(); @@ -319,5 +320,4 @@ Bangle.on('tap', () => { }); renderScreen(); -Bangle.setUI("clock"); setInterval(renderScreen, 60 * 1000);