Skip to content

Commit

Permalink
Merge branch 'master' of github.com:espruino/BangleApps
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Feb 4, 2022
2 parents 9e0191c + 2d1731d commit 3be35ef
Show file tree
Hide file tree
Showing 27 changed files with 359 additions and 26 deletions.
1 change: 1 addition & 0 deletions apps/android/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
0.04: Android icon now goes to settings page with 'find phone'
0.05: Fix handling of message actions
0.06: Option to keep messages after a disconnect (default false) (fix #1186)
0.07: Include charging state in battery updates to phone
3 changes: 2 additions & 1 deletion apps/android/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@
};

// Battery monitor
function sendBattery() { gbSend({ t: "status", bat: E.getBattery() }); }
function sendBattery() { gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 }); }
NRF.on("connect", () => setTimeout(sendBattery, 2000));
Bangle.on("charging", sendBattery);
if (!settings.keep)
NRF.on("disconnect", () => require("messages").clearAll()); // remove all messages on disconnect
setInterval(sendBattery, 10*60*1000);
Expand Down
2 changes: 1 addition & 1 deletion apps/android/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "android",
"name": "Android Integration",
"shortName": "Android",
"version": "0.06",
"version": "0.07",
"description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
"icon": "app.png",
"tags": "tool,system,messages,notifications,gadgetbridge",
Expand Down
1 change: 1 addition & 0 deletions apps/gbridge/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@
0.24: tag HRM power requests to allow this to work alongside other widgets/apps (fix #799)
0.25: workaround call notification
Fix inflated step number
0.26: Include charging status in battery updates to phone
3 changes: 2 additions & 1 deletion apps/gbridge/PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ t can be one of "info", "warn", "error"
## report battery level

```
{ "t": "status", "bat": 30, "volt": 30 }
{ "t": "status", "bat": 30, "volt": 30, "chg": 0 }
```

* bat is in range 0 to 100
* volt is optional and should be greater than 0
* chg is optional and should be either 0 or 1 to indicate the watch is charging

## find phone

Expand Down
2 changes: 1 addition & 1 deletion apps/gbridge/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "gbridge",
"name": "Gadgetbridge",
"version": "0.25",
"version": "0.26",
"description": "(NOT RECOMMENDED) Displays Gadgetbridge notifications from Android. Please use the 'Android' Bangle.js app instead.",
"icon": "app.png",
"type": "widget",
Expand Down
3 changes: 2 additions & 1 deletion apps/gbridge/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
}

function sendBattery() {
gbSend({ t: "status", bat: E.getBattery() });
gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 });
}

// Send a summary of activity to Gadgetbridge
Expand All @@ -268,6 +268,7 @@

// Battery monitor
NRF.on("connect", () => setTimeout(sendBattery, 2000));
Bangle.on("charging", sendBattery);
setInterval(sendBattery, 10*60*1000);
sendBattery();
// Activity monitor
Expand Down
2 changes: 2 additions & 0 deletions apps/launch/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
After 10s of being locked, the launcher goes back to the clock screen
0.10: added in selectable font in settings including scalable vector font
0.11: Merge Bangle.js 1 and 2 launchers, again
0.12: Add an option to hide clocks from the app list (fix #1015)
Add /*LANG*/ tags for internationalisation
14 changes: 7 additions & 7 deletions apps/launch/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var s = require("Storage");
let fonts = g.getFonts();
var scaleval = 1;
var vectorval = 20;
var font = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
let settings = require('Storage').readJSON("launch.json", true) || {};
let settings = Object.assign({ showClocks: true }, s.readJSON("launch.json", true) || {});

if ("vectorsize" in settings) {
vectorval = parseInt(settings.vectorsize);
}
Expand All @@ -14,10 +14,10 @@ if ("font" in settings){
}
else{
font = settings.font;
scaleval = (font.split('x')[1])/20;
scaleval = (font.split("x")[1])/20;
}
}
var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || app.type=="clock" || !app.type));
var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type));
apps.sort((a,b)=>{
var n=(0|a.sortorder)-(0|b.sortorder);
if (n) return n; // do sortorder first
Expand Down Expand Up @@ -54,10 +54,10 @@ E.showScroller({
var app = apps[i];
if (!app) return;
if (!app.src || require("Storage").read(app.src)===undefined) {
E.showMessage("App Source\nNot found");
E.showMessage(/*LANG*/"App Source\nNot found");
setTimeout(drawMenu, 2000);
} else {
E.showMessage("Loading...");
E.showMessage(/*LANG*/"Loading...");
load(app.src);
}
}
Expand All @@ -72,7 +72,7 @@ if (process.env.HWVERSION==2) {
// 10s of inactivity goes back to clock
Bangle.setLocked(false); // unlock initially
var lockTimeout;
Bangle.on('lock', locked => {
Bangle.on("lock", locked => {
if (lockTimeout) clearTimeout(lockTimeout);
lockTimeout = undefined;
if (locked)
Expand Down
2 changes: 1 addition & 1 deletion apps/launch/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "launch",
"name": "Launcher",
"shortName": "Launcher",
"version": "0.11",
"version": "0.12",
"description": "This is needed to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.",
"icon": "app.png",
"type": "launch",
Expand Down
22 changes: 14 additions & 8 deletions apps/launch/settings.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
// make sure to enclose the function in parentheses
(function(back) {
let settings = require('Storage').readJSON('launch.json',1)||{};
let settings = Object.assign({ showClocks: true }, require("Storage").readJSON("launch.json", true) || {});

let fonts = g.getFonts();
function save(key, value) {
settings[key] = value;
require('Storage').write('launch.json',settings);
require("Storage").write("launch.json",settings);
}
const appMenu = {
'': {'title': 'Launcher Settings'},
'< Back': back,
'Font': {
/*LANG*/"": {"title": /*LANG*/"Launcher Settings"},
/*LANG*/"< Back": back,
/*LANG*/"Font": {
value: fonts.includes(settings.font)? fonts.indexOf(settings.font) : fonts.indexOf("12x20"),
min:0, max:fonts.length-1, step:1,wrap:true,
onchange: (m) => {save('font', fonts[m])},
onchange: (m) => {save("font", fonts[m])},
format: v => fonts[v]
},
'Vector font size': {
/*LANG*/"Vector font size": {
value: settings.vectorsize || 10,
min:10, max: 20,step:1,wrap:true,
onchange: (m) => {save('vectorsize', m)}
onchange: (m) => {save("vectorsize", m)}
},
/*LANG*/"Show clocks": {
value: settings.showClocks == true,
format: v => v ? /*LANG*/"Yes" : /*LANG*/"No",
onchange: (m) => {save("showClocks", m)}
}
};
E.showMenu(appMenu);
Expand Down
1 change: 1 addition & 0 deletions apps/lazybones/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.01: first release
45 changes: 45 additions & 0 deletions apps/lazybones/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Lazybones

'Warns when you have been sat still for too long.'

![](screenshot_lazybones2.png)
![](screenshot_lazybones.png)

- Spending too much time sat down is destructive to our health and fitness.
- Lazy bones checks the step count every minute and if this
has not changed after 26 minutes the buzzer will sound and a pop up
screen will show.
- It gives 3 warnings before giving up
- Standing up and walking around until the step counting threshold is reached will automatically dismiss the warning.
- When the warning is not displaying the apps is a simple clock
- The timer only goes off between the hours 9am to 9pm.
- The app is a basic proof of concept that can be used in other clocks
- A settings menu may be added in a future release


## Dedication

This is app is dedicated in memory of my friend, Huw Evans 1960-2019,
poet, writer, actor, archiologist, technical author, husband, father,
friend.

In May 2017, Huw Evans received a terminal cancer diagnosis. [Not
Long Now](https://www.youtube.com/watch?v=HD_Xysb6ZEA) is his
response to that diagnosis and the drastic shortening of his life
expectancy. Not Long Now is a one-man show, which uses poetry,
story-telling, puppetry and video to address one basic question:
given we are all going to die, how then shall we live?

## Why the Skull ?

![](lazybones.png)

The Skull is a [Memento
mori](https://en.wikipedia.org/wiki/Memento_mori) (Latin for
'remember that you [have to] die') is an artistic or symbolic trope
acting as a reminder of the inevitability of death.

Let us choose not to die from sitting too long.


Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http:https://forum.espruino.com/microcosms/1424/)
Loading

0 comments on commit 3be35ef

Please sign in to comment.