From da0336eeeb0b9b111cd4b042b6ac198778acf18e Mon Sep 17 00:00:00 2001 From: noobejby Date: Sun, 10 Nov 2024 18:32:24 +0100 Subject: [PATCH 1/2] version 0.02 --- apps/bttfclock/ChangeLog | 3 ++- apps/bttfclock/README.md | 9 +++++---- apps/bttfclock/app.js | 26 ++++++++++++++++++-------- apps/bttfclock/metadata.json | 2 +- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/apps/bttfclock/ChangeLog b/apps/bttfclock/ChangeLog index c9fd425102..cb16ec659c 100644 --- a/apps/bttfclock/ChangeLog +++ b/apps/bttfclock/ChangeLog @@ -1 +1,2 @@ -0.01: Back to the future clock first version \ No newline at end of file +0.01: Back to the future clock first version. +0.02: Added more icons to the status field. Made it posible to custemize the step goal thrue the Health Tracking app. \ No newline at end of file diff --git a/apps/bttfclock/README.md b/apps/bttfclock/README.md index 1e46b97b3c..3eb162ce81 100644 --- a/apps/bttfclock/README.md +++ b/apps/bttfclock/README.md @@ -8,23 +8,24 @@ A watchface inspierd by Health Tracking app defult is 10000 - Bluetooth connected icon +- Alarm icon +- Notification icon ## Screenshots Clock:
## Usage +Install it and enjoy ## Links diff --git a/apps/bttfclock/app.js b/apps/bttfclock/app.js index a23e06edf6..792c2d62f7 100644 --- a/apps/bttfclock/app.js +++ b/apps/bttfclock/app.js @@ -11,14 +11,18 @@ const stepGoalBatTextY = 100; const stepGoalBatdataY = stepGoalBatTextY+19; const statusTextY = 140; const statusDataY = statusTextY+19; -let stepGoal = 7000; +let stepGoal = (require("Storage").readJSON("health.json",1)||10000).stepGoal; let steps = 0; +let alarmStatus = (require('Storage').readJSON('sched.json',1)||[]).some(alarm=>alarm.on); -let bOn = require("heatshrink").decompress(atob("iEQwYROg3AAokYAgUMg0DAoUBwwFDgE2CIYdHAogREDoopFGoodGABI=")); +const bluetoothOnIcon = require("heatshrink").decompress(atob("iEQwYROg3AAokYAgUMg0DAoUBwwFDgE2CIYdHAogREDoopFGoodGABI=")); -let bOff = require("heatshrink").decompress(atob("iEQwYLIgwFF4ADBgYFBjAKCsEGBAIABhgFEgOA7AdDmApKmwpCC4OGFIYjFGoVgIIkMEZAAD")); +const bluetoothOffIcon = require("heatshrink").decompress(atob("iEQwYLIgwFF4ADBgYFBjAKCsEGBAIABhgFEgOA7AdDmApKmwpCC4OGFIYjFGoVgIIkMEZAAD")); +const alarmIcon = require("heatshrink").decompress(atob("iEQyBC/AA3/8ABBB7INHA4YLLDqIHVApJRJCZodNCJ4dPHqqPJGp4RLOaozZT8btLF64hJFJpFbAEYA=")); + +const notificationIcon = require("heatshrink").decompress(atob("iEQyBC/AB3/8ABBD+4bHEa4VJD6YTNEKIf/D/rTDAJ7jTADo5hK+IA==")); //the following 2 sections are used from waveclk to schedule minutely updates @@ -187,12 +191,17 @@ function draw(){ g.drawString(bat, batDrawX, stepGoalBatdataY); //status - var b = bOff; + var b = bluetoothOffIcon; if (NRF.getSecurityStatus().connected){ - b = bOn; + b = bluetoothOnIcon; + } + g.drawImage(b, 62, statusDataY-1); + if (alarmStatus){ + g.drawImage(alarmIcon, 78, statusDataY-1); + } + if (require("Storage").read("messages.json")!==undefined){ + g.drawImage(notificationIcon, 94, statusDataY-1); } - g.drawImage(b, 64, statusDataY); - g.reset(); g.setBgColor(0,0,0); @@ -211,7 +220,6 @@ function draw(){ */ g.setTheme({bg:"#000",fg:"#fff",dark:true}).clear(); //draw(); - //the following section is from waveclk Bangle.on('lcdPower',on=>{ if (on) { @@ -221,6 +229,8 @@ Bangle.on('lcdPower',on=>{ drawTimeout = undefined; } }); + + Bangle.setUI("clock"); // Load widgets, but don't show them Bangle.loadWidgets(); diff --git a/apps/bttfclock/metadata.json b/apps/bttfclock/metadata.json index 01c885318e..3923fcac57 100644 --- a/apps/bttfclock/metadata.json +++ b/apps/bttfclock/metadata.json @@ -1,7 +1,7 @@ { "id": "bttfclock", "name": "Back To The Future", - "version": "0.01", + "version": "0.02", "description": "The watch of Marty McFly", "readme": "README.md", "icon": "app.png", From f4be9f4d1ef4ec92520ab60eb2c46b15f80daf2f Mon Sep 17 00:00:00 2001 From: noobejby Date: Sun, 10 Nov 2024 21:11:36 +0100 Subject: [PATCH 2/2] Better message notification --- apps/bttfclock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/bttfclock/app.js b/apps/bttfclock/app.js index 792c2d62f7..c14e903fa7 100644 --- a/apps/bttfclock/app.js +++ b/apps/bttfclock/app.js @@ -199,7 +199,7 @@ function draw(){ if (alarmStatus){ g.drawImage(alarmIcon, 78, statusDataY-1); } - if (require("Storage").read("messages.json")!==undefined){ + if ((require('Storage').readJSON('messages.json',1)||[]).some(messag=>messag.new==true)){ g.drawImage(notificationIcon, 94, statusDataY-1); }