diff --git a/apps/backlite/ChangeLog b/apps/backlite/ChangeLog new file mode 100644 index 000000000..d8cc5d85f --- /dev/null +++ b/apps/backlite/ChangeLog @@ -0,0 +1 @@ +0.01: New app! (settings, boot.js). diff --git a/apps/backlite/README.md b/apps/backlite/README.md new file mode 100644 index 000000000..c76f08de7 --- /dev/null +++ b/apps/backlite/README.md @@ -0,0 +1,20 @@ +# BackLite +### This app needs the latest settings app update (v 0.80), to ensure that setting the brightness to `0` does not default to `1`. + +BackLite is an app which greatly conserves battery life by only turning the backlight on when you long press the button from a locked state. + +Modern watches have a dedicated button to turn the backlight on, so as not to waste battery in an already light environment. This app recreates that functionality for the Bangle.js, which only has one button. + +#### Warning: This app overwrites the LCD brightness setting in `Bangle.js LCD settings`. If it is changed, the app will basically lose functionality. It auto-fixes itself every boot, so if you change the brightness, just reboot :) +# Usage +When you unlock with a press of the button, or any other way you unlock the watch, the backlight will not turn on, as most of the time you are able to read it, due to the transreflective display on the Bangle.js 2. + +If you press and hold the button to unlock the watch (for around half a second), the backlight will turn on for 5 seconds - just enough to see what you need to see. After that, it will turn off again. + +Some apps like `Light Switch Widget` will prevent this app from working properly. +# Settings +`Brightness` - The LCD brightness when unlocked with a long press. +# Creator +RKBoss6 + +TODO: Add a setting for long press time, or light duration diff --git a/apps/backlite/boot.js b/apps/backlite/boot.js new file mode 100644 index 000000000..897b443b1 --- /dev/null +++ b/apps/backlite/boot.js @@ -0,0 +1,36 @@ +{ + let getSettings = function(){ + return Object.assign({ + // default values + brightness: 0.3, + + }, require('Storage').readJSON("BackLite.settings.json", true) || {}); + }; + + + //Set LCD to zero every reboot + let s = require("Storage").readJSON("setting.json", 1) || {}; + s.brightness = 0; + if (!("lcdTimeout" in s)) s.lcdTimeout = 5; // fallback so logic doesn't break + require("Storage").writeJSON("setting.json", s); + + const longPressTime=400; //(ms) + + Bangle.on('lock', function(isLocked) { + Bangle.setLCDBrightness(0); + + if (!isLocked) { + // Just unlocked — give a short delay and check if BTN1 is still pressed + setTimeout(() => { + if (digitalRead(BTN1)) { + //set brightness until. locked. + Bangle.setLCDBrightness(getSettings().brightness); + } else { + Bangle.setLCDBrightness(0); + } + }, longPressTime); // Slight delay to allow unlock to settle + } + }); + +} + diff --git a/apps/backlite/icon.png b/apps/backlite/icon.png new file mode 100644 index 000000000..1337ef8ac Binary files /dev/null and b/apps/backlite/icon.png differ diff --git a/apps/backlite/metadata.json b/apps/backlite/metadata.json new file mode 100644 index 000000000..65d5c7c02 --- /dev/null +++ b/apps/backlite/metadata.json @@ -0,0 +1,17 @@ +{ + "id": "backlite", + "name": "BackLite", + "version": "0.01", + "description": "Conserves battery life by turning the backlight on only on a long press of the button from a locked state. **Requires the latest settings update (v0.80)**", + "icon": "icon.png", + "type": "bootloader", + "tags": "system", + "readme": "README.md", + "supports": ["BANGLEJS2"], + "storage": [ + {"name":"backlite.boot.js","url":"boot.js"}, + {"name":"backlite.settings.js","url":"settings.js"} + + ], + "data": [{"name":"BackLite.settings.json"}] +} diff --git a/apps/backlite/settings.js b/apps/backlite/settings.js new file mode 100644 index 000000000..7ce709b61 --- /dev/null +++ b/apps/backlite/settings.js @@ -0,0 +1,25 @@ +(function(back) { + var FILE = "BackLite.settings.json"; + // Load settings + var settings = Object.assign({ + brightness: 0.3, + }, require('Storage').readJSON(FILE, true) || {}); + + function writeSettings() { + require('Storage').writeJSON(FILE, settings); + } + + // Show the menu + E.showMenu({ + "" : { "title" : "BackLite" }, + 'Brightness': { + value: 0.3|settings.brightness, + min: 0.1, max: 1, + step: 0.1, + onchange: v => { + settings.brightness = v; + writeSettings(); + } + }, + }); +}) diff --git a/apps/clkinfoclk/metadata.json b/apps/clkinfoclk/metadata.json index 8d676d0e0..0160b59d9 100644 --- a/apps/clkinfoclk/metadata.json +++ b/apps/clkinfoclk/metadata.json @@ -5,7 +5,7 @@ "icon": "app.png", "screenshots": [{"url":"screenshot.png"}], "type": "clkinfo", - "tags": "clkinfo", + "tags": "clkinfo,clock", "supports" : ["BANGLEJS2"], "storage": [ {"name":"clkinfoclk.clkinfo.js","url":"clkinfo.js"} diff --git a/apps/clkinfodist/ChangeLog b/apps/clkinfodist/ChangeLog new file mode 100644 index 000000000..2286a7f70 --- /dev/null +++ b/apps/clkinfodist/ChangeLog @@ -0,0 +1 @@ +0.01: New App! \ No newline at end of file diff --git a/apps/clkinfodist/app.png b/apps/clkinfodist/app.png new file mode 100644 index 000000000..84544fa86 Binary files /dev/null and b/apps/clkinfodist/app.png differ diff --git a/apps/clkinfodist/clkinfo.js b/apps/clkinfodist/clkinfo.js new file mode 100644 index 000000000..93cbe9fcd --- /dev/null +++ b/apps/clkinfodist/clkinfo.js @@ -0,0 +1,22 @@ +(function() { + let strideLength = (require("Storage").readJSON("myprofile.json",1)||{}).strideLength ?? 0.79, + lastSteps = 0; + function stepUpdateHandler() { distance.emit("redraw"); } + var distance = { + name : "Distance", + get : () => { let v = (Bangle.getHealthStatus("day").steps - lastSteps)*strideLength; return { + text : require("locale").distance(v,1), + img : atob("GBiBAAMAAAeAAA/AAA/AAA/gAA/gwAfh4AfD4APD4AOH4AAH4ADj4AHjwAHhwADgAAACAAAHgAAPAAAHAAgCEBgAGD///BgAGAgAEA==") + };}, + run : function() { + lastSteps = (lastSteps>=Bangle.getHealthStatus("day").steps) ? 0 : Bangle.getHealthStatus("day").steps; + this.emit("redraw"); + }, + show : function() { Bangle.on("step", stepUpdateHandler); stepUpdateHandler(); }, + hide : function() { Bangle.removeListener("step", stepUpdateHandler); } + }; + return { + name: "Bangle", + items: [ distance ] + }; +}) diff --git a/apps/clkinfodist/icon.png b/apps/clkinfodist/icon.png new file mode 100644 index 000000000..70a6d496a Binary files /dev/null and b/apps/clkinfodist/icon.png differ diff --git a/apps/clkinfodist/metadata.json b/apps/clkinfodist/metadata.json new file mode 100644 index 000000000..2a60547dd --- /dev/null +++ b/apps/clkinfodist/metadata.json @@ -0,0 +1,14 @@ +{ "id": "clkinfodist", + "name": "Clockinfo Distance", + "version":"0.01", + "description": "Uses the 'My Profile' app's Stride Length to calculate distance travelled based on step count. Tap to reset for measuring distances.", + "icon": "app.png", + "screenshots": [{"url":"screenshot.png"}], + "type": "clkinfo", + "tags": "clkinfo,distance,steps,outdoors,tool", + "dependencies": {"myprofile":"app"}, + "supports" : ["BANGLEJS2"], + "storage": [ + {"name":"clkinfodist.clkinfo.js","url":"clkinfo.js"} + ] +} diff --git a/apps/clkinfodist/screenshot.png b/apps/clkinfodist/screenshot.png new file mode 100644 index 000000000..9463e4064 Binary files /dev/null and b/apps/clkinfodist/screenshot.png differ diff --git a/apps/clock_info/ChangeLog b/apps/clock_info/ChangeLog index 8915a702e..702d78bf1 100644 --- a/apps/clock_info/ChangeLog +++ b/apps/clock_info/ChangeLog @@ -17,3 +17,5 @@ 0.16: Add BLE clkinfo entry 0.17: Fix BLE icon alignment and border on some clocks 0.18: Tweak BLE icon to add gap and ensure middle of B isn't filled +0.19: Fix Altitude ClockInfo after BLE added + Tapping Altitude now updates the reading \ No newline at end of file diff --git a/apps/clock_info/lib.js b/apps/clock_info/lib.js index 756a0463b..8f8f8c230 100644 --- a/apps/clock_info/lib.js +++ b/apps/clock_info/lib.js @@ -39,22 +39,23 @@ exports.load = function() { var hrm = 0; var alt = "--"; // callbacks (needed for easy removal of listeners) - function batteryUpdateHandler() { bangleItems[0].emit("redraw"); } - function stepUpdateHandler() { bangleItems[1].emit("redraw"); } + function batteryUpdateHandler() { bangleItems.find(i=>i.name=="Battery").emit("redraw"); } + function stepUpdateHandler() { bangleItems.find(i=>i.name=="Steps").emit("redraw"); } function hrmUpdateHandler(e) { if (e && e.confidence>60) hrm = Math.round(e.bpm); - bangleItems[2].emit("redraw"); + bangleItems.find(i=>i.name=="HRM").emit("redraw"); } function altUpdateHandler() { try { Bangle.getPressure().then(data=>{ if (!data) return; alt = Math.round(data.altitude) + "m"; - bangleItems[3].emit("redraw"); + bangleItems.find(i=>i.name=="Altitude").emit("redraw"); }); } catch (e) { print("Caught "+e+"\n in function altUpdateHandler in module clock_info"); - bangleItems[3].emit('redraw');} + bangleItems.find(i=>i.name=="Altitude").emit('redraw'); + } } // actual menu var menu = [{ @@ -120,7 +121,6 @@ exports.load = function() { }, }, { name: "BLE", - hasRange: false, isOn: () => { const s = NRF.getSecurityStatus(); return s.advertising || s.connected; @@ -156,6 +156,7 @@ exports.load = function() { min : 0, max : settings.maxAltitude, img : atob("GBiBAAAAAAAAAAAAAAAAAAAAAAACAAAGAAAPAAEZgAOwwAPwQAZgYAwAMBgAGBAACDAADGAABv///////wAAAAAAAAAAAAAAAAAAAA==") }), + run : function() { alt = "--"; this.emit("redraw"); altUpdateHandler(); }, show : function() { this.interval = setInterval(altUpdateHandler, 60000); alt = "--"; altUpdateHandler(); }, hide : function() { clearInterval(this.interval); delete this.interval; }, }); diff --git a/apps/clock_info/metadata.json b/apps/clock_info/metadata.json index fcdaef2d0..4123fbac4 100644 --- a/apps/clock_info/metadata.json +++ b/apps/clock_info/metadata.json @@ -1,7 +1,7 @@ { "id": "clock_info", "name": "Clock Info Module", "shortName": "Clock Info", - "version":"0.18", + "version":"0.19", "description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)", "icon": "app.png", "type": "module", diff --git a/apps/health/ChangeLog b/apps/health/ChangeLog index 167ee26df..99e2490c9 100644 --- a/apps/health/ChangeLog +++ b/apps/health/ChangeLog @@ -38,4 +38,5 @@ 0.33: Ensure readAllRecordsSince always includes the current day Speed improvements (put temporary functions in RAM where possible) 0.34: Fix readFullDatabase (was skipping first month of data) -0.35: Update boot/lib.min.js \ No newline at end of file +0.35: Update boot/lib.min.js +0.36: Fix Distance graphs that used '1*' to remove the suffix \ No newline at end of file diff --git a/apps/health/app.js b/apps/health/app.js index 6a461da2b..d3dda2e2f 100644 --- a/apps/health/app.js +++ b/apps/health/app.js @@ -32,7 +32,7 @@ function menuStepCount() { } function menuDistance() { - const distMult = 1*require("locale").distance(myprofile.strideLength, 2); // hackish: this removes the distance suffix, e.g. 'm' + const distMult = parseFloat(require("locale").distance(myprofile.strideLength, 2)); // this removes the distance suffix, e.g. 'm' E.showMenu({ "": { title:/*LANG*/"Distance" }, /*LANG*/"< Back": () => menuStepCount(), diff --git a/apps/health/metadata.json b/apps/health/metadata.json index b2ecb3e8b..36497c5ba 100644 --- a/apps/health/metadata.json +++ b/apps/health/metadata.json @@ -2,7 +2,7 @@ "id": "health", "name": "Health Tracking", "shortName": "Health", - "version": "0.35", + "version": "0.36", "description": "Logs health data and provides an app to view it", "icon": "app.png", "screenshots" : [ { "url":"screenshot.png" } ], diff --git a/apps/messagegui/app.js b/apps/messagegui/app.js index d3c67401d..7dcfec866 100644 --- a/apps/messagegui/app.js +++ b/apps/messagegui/app.js @@ -14,7 +14,7 @@ // a message require("messages").pushMessage({"t":"add","id":1575479849,"src":"WhatsApp","title":"My Friend","body":"Hey! How's everything going?",reply:1,negative:1}) -require("messages").pushMessage({"t":"add","id":1575479849,"src":"Skype","title":"My Friend","body":"Hey! How's everything going? This is a really really long message that is really so super long you'll have to scroll it lots and lots",positive:1,negative:1}) +require("messages").pushMessage({"t":"add","id":1575479850,"src":"Skype","title":"My Friend","body":"Hey! How's everything going? This is a really really long message that is really so super long you'll have to scroll it lots and lots",positive:1,negative:1}) require("messages").pushMessage({"t":"add","id":23232,"src":"Skype","title":"Mr. Bobby McBobFace","body":"Boopedy-boop",positive:1,negative:1}) require("messages").pushMessage({"t":"add","id":23233,"src":"Skype","title":"Thyttan test","body":"Nummerplåtsbelysning trodo",positive:1,negative:1}) require("messages").pushMessage({"t":"add","id":23234,"src":"Skype","title":"Thyttan test 2","body":"Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo",positive:1,negative:1}) diff --git a/apps/setting/ChangeLog b/apps/setting/ChangeLog index 03ee8db12..dafaef48c 100644 --- a/apps/setting/ChangeLog +++ b/apps/setting/ChangeLog @@ -88,3 +88,4 @@ of 'Select Clock' 0.77: Save altitude calibration when user exits via reset 0.78: Fix menu scroll restore on BangleJS1 0.79: Ensure that tapping on pressure/altitude doesn't cause a menu to display temporarily +0.80: Add option to set LCD brightness to 0, default brightness is now 0 as well. diff --git a/apps/setting/metadata.json b/apps/setting/metadata.json index e255a0dcb..c7ba12e09 100644 --- a/apps/setting/metadata.json +++ b/apps/setting/metadata.json @@ -1,7 +1,7 @@ { "id": "setting", "name": "Settings", - "version": "0.79", + "version": "0.80", "description": "A menu for setting up Bangle.js", "icon": "settings.png", "tags": "tool,system", diff --git a/apps/setting/settings.js b/apps/setting/settings.js index 45b971e32..777131b5e 100644 --- a/apps/setting/settings.js +++ b/apps/setting/settings.js @@ -1,3 +1,4 @@ + Bangle.loadWidgets(); Bangle.drawWidgets(); @@ -474,11 +475,11 @@ function LCDMenu() { Object.assign(lcdMenu, { /*LANG*/'LCD Brightness': { value: settings.brightness, - min: 0.1, + min : BANGLEJS2 ? 0 : 0.1, max: 1, step: 0.1, onchange: v => { - settings.brightness = v || 1; + settings.brightness = v ?? 1; updateSettings(); Bangle.setLCDBrightness(settings.brightness); } @@ -1077,4 +1078,4 @@ function showAltitude() { } // Show the main menu -pushMenu(mainMenu()); \ No newline at end of file +pushMenu(mainMenu()); diff --git a/apps/storageanalyzer/ChangeLog b/apps/storageanalyzer/ChangeLog index 2286a7f70..d2dcee110 100644 --- a/apps/storageanalyzer/ChangeLog +++ b/apps/storageanalyzer/ChangeLog @@ -1 +1,3 @@ -0.01: New App! \ No newline at end of file +0.01: New App! +0.02: Added pie chart for visualization, tweaked UI. +0.03: Fixed bug with total storage pie chart. diff --git a/apps/storageanalyzer/app.png b/apps/storageanalyzer/app.png deleted file mode 100644 index f204a5643..000000000 Binary files a/apps/storageanalyzer/app.png and /dev/null differ diff --git a/apps/storageanalyzer/custom.html b/apps/storageanalyzer/custom.html index 4b6c3879e..2adefd29a 100644 --- a/apps/storageanalyzer/custom.html +++ b/apps/storageanalyzer/custom.html @@ -3,67 +3,152 @@
- - + + + +