Skip to content

Commit 4bb0e47

Browse files
authored
Merge branch 'espruino:master' into funFacts
2 parents 4f9643b + e8aee92 commit 4bb0e47

File tree

213 files changed

+6824
-1099
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+6824
-1099
lines changed

apps/antonclk/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
0.10: Use Bangle.setUI({remove:...}) to allow loading the launcher without a full reset on 2v16
1515
0.11: Moved enhanced Anton clock to 'Anton Clock Plus' and stripped this clock back down to make it faster for new users (270ms -> 170ms)
1616
Modified to avoid leaving functions defined when using setUI({remove:...})
17+
0.12: Pass in `redraw` to allow `Bangle.uiRedraw()` to redraw the clock

apps/antonclk/app.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/antonclk/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "antonclk",
33
"name": "Anton Clock",
4-
"version": "0.11",
4+
"version": "0.12",
55
"description": "A simple clock using the bold Anton font. See `Anton Clock Plus` for an enhanced version",
66
"icon": "app.png",
77
"screenshots": [{"url":"screenshot.png"}],

apps/antonclkplus/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
0.10: Use Bangle.setUI({remove:...}) to allow loading the launcher without a full reset on 2v16
1515
Modified to avoid leaving functions defined when using setUI({remove:...})
1616
0.11: Minor code improvements
17+
0.12: Pass in `redraw` to allow `Bangle.uiRedraw()` to redraw the clock

apps/antonclkplus/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ Bangle.setUI({
231231
drawTimeout = undefined;
232232
delete Graphics.prototype.setFontAnton;
233233
delete Graphics.prototype.setFontAntonSmall;
234-
}});
234+
},
235+
redraw: draw,
236+
});
235237
// Load widgets
236238
Bangle.loadWidgets();
237239
Bangle.drawWidgets();

apps/antonclkplus/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "antonclkplus",
33
"name": "Anton Clock Plus",
44
"shortName": "Anton Clock+",
5-
"version": "0.11",
5+
"version": "0.12",
66
"description": "A clock using the bold Anton font, optionally showing seconds and date in ISO-8601 format.",
77
"readme":"README.md",
88
"icon": "app.png",

apps/backlite/ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
0.01: New app! (settings, boot.js).
2+
0.02: Fix settings defaulting brightness to 0

apps/backlite/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# BackLite
2+
### This app needs the latest settings app update (v 0.80), to ensure that setting the brightness to `0` does not default to `1`.
3+
4+
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.
5+
6+
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.
7+
8+
#### 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 :)
9+
# Usage
10+
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.
11+
12+
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.
13+
14+
Some apps like `Light Switch Widget` will prevent this app from working properly.
15+
# Settings
16+
`Brightness` - The LCD brightness when unlocked with a long press.
17+
# Creator
18+
RKBoss6
19+
20+
TODO: Add a setting for long press time, or light duration

apps/backlite/boot.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
let getSettings = function(){
3+
return Object.assign({
4+
// default values
5+
brightness: 0.3,
6+
7+
}, require('Storage').readJSON("BackLite.settings.json", true) || {});
8+
};
9+
10+
11+
//Set LCD to zero every reboot
12+
let s = require("Storage").readJSON("setting.json", 1) || {};
13+
s.brightness = 0;
14+
require("Storage").writeJSON("setting.json", s);
15+
//remove large settings object from memory
16+
delete s;
17+
const longPressTime=400; //(ms)
18+
19+
Bangle.on('lock', function(isLocked) {
20+
Bangle.setLCDBrightness(0);
21+
22+
if (!isLocked) {
23+
// Just unlocked — give a short delay and check if BTN1 is still pressed
24+
setTimeout(() => {
25+
if (digitalRead(BTN1)) {
26+
//set brightness until. locked.
27+
Bangle.setLCDBrightness(getSettings().brightness);
28+
} else {
29+
Bangle.setLCDBrightness(0);
30+
}
31+
}, longPressTime); // Slight delay to allow unlock to settle
32+
}
33+
});
34+
35+
}
36+

apps/backlite/icon.png

1.44 MB
Loading

0 commit comments

Comments
 (0)