Merge branch 'master' of github.com:espruino/BangleApps

master
Gordon Williams 2021-12-01 12:06:47 +00:00
commit adca628e2c
72 changed files with 1268 additions and 37 deletions

164
apps.json
View File

@ -448,6 +448,27 @@
{"name":"matrixclock.img","url":"matrixclock-icon.js","evaluate":true}
]
},
{
"id": "mandlebrotclock",
"name": "Mandlebrot Clock",
"version": "0.01",
"description": "A mandlebrot set themed clock cool",
"icon": "mandlebrotclock.png",
"screenshots": [{ "url": "screenshot_mandlebrotclock.png" }],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"readme": "README.md",
"allow_emulator": true,
"storage": [
{ "name": "mandlebrotclock.app.js", "url": "mandlebrotclock.js" },
{
"name": "mandlebrotclock.img",
"url": "mandlebrotclock-icon.js",
"evaluate": true
}
]
},
{
"id": "imgclock",
"name": "Image background clock",
@ -664,7 +685,7 @@
{
"id": "gpsrec",
"name": "GPS Recorder",
"version": "0.25",
"version": "0.26",
"description": "Application that allows you to record a GPS track. Can run in background",
"icon": "app.png",
"tags": "tool,outdoors,gps,widget",
@ -683,7 +704,7 @@
"id": "recorder",
"name": "Recorder (BETA)",
"shortName": "Recorder",
"version": "0.03",
"version": "0.04",
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
"icon": "app.png",
"tags": "tool,outdoors,gps,widget",
@ -851,7 +872,7 @@
"id": "widbatpc",
"name": "Battery Level Widget (with percentage)",
"shortName": "Battery Widget",
"version": "0.13",
"version": "0.14",
"description": "Show the current battery level and charging status in the top right of the clock, with charge percentage",
"icon": "widget.png",
"type": "widget",
@ -4085,9 +4106,10 @@
"id": "pastel",
"name": "Pastel Clock",
"shortName": "Pastel",
"version": "0.07",
"description": "A Configurable clock with custom fonts and background",
"version": "0.08",
"description": "A Configurable clock with custom fonts and background. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times",
"icon": "pastel.png",
"dependencies": {"mylocation":"app"},
"screenshots": [{"url":"screenshot_pastel.png"}],
"type": "clock",
"tags": "clock",
@ -4412,7 +4434,7 @@
"shortName": "AuthWatch",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"version": "0.01",
"version": "0.02",
"description": "Google Authenticator compatible tool.",
"tags": "tool",
"interface": "interface.html",
@ -4457,6 +4479,23 @@
{"name":"timecal.app.js","url":"timecal.app.js"}
]
},
{
"id": "a_clock_timer",
"name": "A Clock with Timer",
"version": "0.01",
"description": "A Clock with Timer, Map and Time Zones",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"allow_emulator": true,
"readme": "README.md",
"storage": [
{"name":"a_clock_timer.app.js","url":"app.js"},
{"name":"a_clock_timer.img","url":"app-icon.js","evaluate":true}
]
},
{
"id":"intervalTimer",
"name":"Interval Timer",
@ -4488,5 +4527,118 @@
{"name":"93dub.app.js","url":"app.js"},
{"name":"93dub.img","url":"app-icon.js","evaluate":true}
]
},
{ "id": "poweroff",
"name": "Poweroff",
"shortName":"Poweroff",
"version":"0.01",
"description": "Simple app to power off your Bangle.js",
"icon": "app.png",
"tags": "poweroff, shutdown",
"supports" : ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"poweroff.app.js","url":"app.js"},
{"name":"poweroff.img","url":"app-icon.js","evaluate":true}
]
},
{
"id": "sensible",
"name": "SensiBLE",
"shortName": "SensiBLE",
"version": "0.02",
"description": "Collect, display and advertise real-time sensor data.",
"icon": "sensible.png",
"type": "app",
"tags": "tool,sensors",
"supports" : [ "BANGLEJS2" ],
"allow_emulator": true,
"readme": "README.md",
"storage": [
{ "name": "sensible.app.js", "url": "sensible.js" },
{ "name": "sensible.img", "url": "sensible-icon.js", "evaluate": true }
]
},
{
"id": "widbars",
"name": "Bars Widget",
"version": "0.01",
"description": "Display several measurements as vertical bars.",
"icon": "icon.png",
"screenshots": [{"url":"screenshot.png"}],
"readme": "README.md",
"type": "widget",
"tags": "widget",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"widbars.wid.js","url":"widget.js"}
]
},
{
"id":"a_speech_timer",
"name":"A Speech Timer",
"icon": "app.png",
"version":"1.00",
"description": "A timer designed to help keeping your speeches and presentations to time.",
"tags": "tool,timer",
"readme":"README.md",
"supports":["BANGLEJS2"],
"storage": [
{"name":"a_speech_timer.app.js","url":"app.js"},
{"name":"a_speech_timer.img","url":"app-icon.js","evaluate":true}
]
},
{
"id": "sensible",
"name": "SensiBLE",
"shortName": "SensiBLE",
"version": "0.02",
"description": "Collect, display and advertise real-time sensor data.",
"icon": "sensible.png",
"type": "app",
"tags": "tool,sensors",
"supports" : [ "BANGLEJS2" ],
"allow_emulator": true,
"readme": "README.md",
"storage": [
{ "name": "sensible.app.js", "url": "sensible.js" },
{ "name": "sensible.img", "url": "sensible-icon.js", "evaluate": true }
]
},
{ "id": "mylocation",
"name": "My Location",
"shortName":"My Location",
"icon": "mylocation.png",
"type": "app",
"screenshots": [{"url":"screenshot_1.png"}],
"version":"0.01",
"description": "Sets and stores the lat and long of your preferred City or it can be set from the GPS. mylocation.json can be used by other apps that need your main location lat and lon. See README",
"readme": "README.md",
"tags": "tool,utility",
"supports": ["BANGLEJS", "BANGLEJS2"],
"storage": [
{"name":"mylocation.app.js","url":"mylocation.app.js"},
{"name":"mylocation.img","url":"mylocation.icon.js","evaluate": true }
],
"data": [
{"name":"mylocation.json"}
]
},
{
"id": "pebble",
"name": "Pebble Clock",
"shortName": "Pebble",
"version": "0.01",
"description": "A pebble style clock to keep the rebellion going",
"readme": "README.md",
"icon": "pebble.png",
"screenshots": [{"url":"pebble_screenshot.png"}],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"storage": [
{"name":"pebble.app.js","url":"pebble.app.js"},
{"name":"pebble.img","url":"pebble.icon.js","evaluate":true}
]
}
]

View File

@ -0,0 +1 @@
0.01: Beta version for Bangle 2 (2021/11/28)

View File

@ -0,0 +1,15 @@
# A Clock with Timer, Map and Time Zones
* Works with Bangle 2
* Timer
* Right tap: start/increase by 10 minutes; Left tap: decrease by 5 minutes
* Short buzz at T-30, T-20, T-10 ; Double buzz at T
* Other time zones
* Currently hardcoded to Paris and Tokyo (this will be customizable in a future version)
* World Map
* The yellow line shows the position of the sun
![](screenshot.png)
## Creator
[@alainsaas](https://github.com/alainsaas)

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwgP/AAnAnEH4Ef+eAiEDAoPDz+T/ff/+T3+T/VAj8z/0f4VP51zDoX/5Hzz/z//f5EBAoP+r4FBFIgPBAAP4v5AFABPvrwSB0YFBrtX/+nCI3u/+vhFhh/q/f/9Fhu4NB187v3n/fvCIf/CIIAFRIUB8EAg3QgJmB4H/iAEB//+/lggqUC//wi4FB8AHBj4FB+H/wEzBgPg/0AkE3BIP8gE8n4VBGIN/IAPAsEA//8v6OBAoUjgEIAoPwkMATIN//BQBgfgg/wAoMH/EHEwILB/gNBgFgAocByEB/ED9AoCAoPAgE4gHwgeAgOYgAVBAoMYAoKECAoIVBAoIfBoCRCAAw="))

129
apps/a_clock_timer/app.js Normal file
View File

@ -0,0 +1,129 @@
// assets
function getImg() {
return require("heatshrink").decompress(atob("2FRgP/ABnxBRP5BJH+gEfBZHghnAv4JFmA+Bj0PBIn3//4h3An4oDAQJWEEIf8AwMEuFOCofAh/QjAWEg4VEwEAnw2DDoKEHEYPwAoUBmgrDhgUHS4XgAwUD/gVC/g+FAAZgEwEf4YqC/EQFQ4NDFgV/4Z3C/EcCo1974VCLAV/V4d7Co9/Co0PCoX+vk4Ko/HCosCRYX5nwTFkEAr/nCokICoL+B/aCGCoMHCoq3EdoraGCosPz4HBcILEJCocBwEHOwQrIgQrHgoHCFYMEgwVJYoMBsEnCofAnkMNQJXH4D4EbQMPkF/xwrEj+/HIkAoAVDj8QueHCoorDCoUDLwd96J0BKwgrHh4VDv+9CosDx6QCCo4HB//8VwvvXgQVDJIYSBCo/sBwaZBgF/NoYVHgH8V4qYDAwUYlAVFEYbFDDgwAGConogf9Zg8DCpP4cIh0Dg0BGAgVE+gVIgUA+AVI+wVE/xAEh5HDEgn+CpEAbgJCCHQoVBn4VJ/ED4ANDAAQVJ4EPPQPAt4VF4BeDColgj/8h/gFYwJBCpF//k//ANDCAYVIcgP+CpH/54VHCAIVB/4VIwYECCocIAwIVBx4VG9+AMITbCYAYJB34VG/UAj4VI7/9Cgw9CJYXAmBtDMAQsIfYhvCCofyvywGB4QFFgYGC/d+agYVLSgf8+ArG/APBD4QVBgh0CAwNwv/fCo4PCCo94s7VDCohnDAoI7Enlv8BZECoRCDAggAB3/3/gzDMAIVFY4IVE4IPBOoZ9DCpXwCoMvCqKxB//3bYywD4BtFAAPfDooVFFYIVGw4VFB4KZFngNE/uPCovgFYgEBuK+Fg4zFCoIrFCovwgQVF+AVFgPxEYzFEbgQVD4EDCoozBYogVCgYVE8bpGCo4HDCoPzBgoVIL4fAg4MGgAIHCofgCszND8BOHK4x2BCofwXgv4h6vGCps/Co6uDAA/7RgIjDDwTaDABPA//9FaAtDCop0FC5YVDLwoAH8//94GD/wVNCYKNECpwPBQggVPNggVBNp4VFFZwAGCquHCqnzCB4"));
}
var IMAGEWIDTH = 176;
var IMAGEHEIGHT = 81;
Graphics.prototype.setFontMichroma36 = function() {
g.setFontCustom(atob("AAAAAAAAAAAAAAAAeAAAAAeAAAAAeAAAAAeAAAAAAAAAAAAAAAAAAAAAAAGAAAAA+AAAAD+AAAAP+AAAA/8AAAD/wAAAf/AAAB/4AAAH/gAAAf+AAAB/4AAAH/gAAAf+AAAAfwAAAAfAAAAAcAAAAAAAAAAAAAAAAAAAAAAAA///AAD///wAH///4AP///8APwAD+APAAAeAeAAAeAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAeAPAAAeAPwAD+AP///8AH///4AD///wAA///AAAAAAAAAAAAAAAAAAAAAEAAAAAOAAAAAfAAAAA+AAAAB8AAAAD8AAA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YYxhzGHMYcxhzGHOYYZhh3uDP4AeAAAEAA4ADgAOAI4DjgeODw4eDjgOcA7gD8APgA8AAAAAAAAAA58H/4bxjmGMYcxhzGHMYcxhzGHOYYbxh/+DnwAAAAADxgfnBnOOMYwxjDHMMcwxzDHMMY4xhjOH/4P/AAAAAABnAGcAAA"), 46, atob("BAgQCBAQEBAQEBAQBA=="), 16+(scale<<8)+(1<<16));
};
// timer
var timervalue = 0;
var istimeron = false;
var timertick;
Bangle.on('touch',t=>{
if (t == 1) {
Bangle.buzz(30);
if (timervalue < 5*60) { timervalue = 1 ; }
else { timervalue -= 5*60; }
}
else if (t == 2) {
Bangle.buzz(30);
if (!istimeron) {
istimeron = true;
timertick = setInterval(countDown, 1000);
}
timervalue += 60*10;
}
});
function timeToString(duration) {
var hrs = ~~(duration / 3600);
var mins = ~~((duration % 3600) / 60);
var secs = ~~duration % 60;
var ret = "";
if (hrs > 0) {
ret += "" + hrs + ":" + (mins < 10 ? "0" : "");
}
ret += "" + mins + ":" + (secs < 10 ? "0" : "");
ret += "" + secs;
return ret;
}
function countDown() {
timervalue--;
g.reset().clearRect(0, 76, 44+44, g.getHeight()/2+6);
g.setFontAlign(0, -1, 0);
g.setFont("6x8").drawString("Timer", 44, g.getHeight()/2-20);
g.setFont("Michroma16").drawString(timeToString(timervalue), 44, g.getHeight()/2-10);
if (timervalue <= 0) {
istimeron = false;
clearInterval(timertick);
Bangle.buzz().then(()=>{
return new Promise(resolve=>setTimeout(resolve, 500));
}).then(()=>{
return Bangle.buzz(1000);
});
}
else
if ((timervalue <= 30) && (timervalue % 10 == 0)) { Bangle.buzz(); }
}
function showWelcomeMessage() {
g.reset().clearRect(0, 76, 44+44, g.getHeight()/2+6);
g.setFontAlign(0, 0).setFont("6x8");
g.drawString("Touch right to", 44, 80);
g.drawString("start timer", 44, 88);
setTimeout(function(){ g.reset().clearRect(0, 76, 44+44, g.getHeight()/2+6); }, 8000);
}
// time
var drawTimeout;
function getGmt() {
var d = new Date();
var gmt = new Date(d.getTime() + d.getTimezoneOffset() * 60 * 1000);
return gmt;
}
function getTimeFromTimezone(offset) {
return new Date(getGmt().getTime() + offset * 60 * 60 * 1000);
}
function queueNextDraw() {
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
}
function draw() {
g.reset().clearRect(0,24,g.getWidth(),g.getHeight()-IMAGEHEIGHT);
g.drawImage(getImg(),0,g.getHeight()-IMAGEHEIGHT);
var x_sun = 176 - (getGmt().getHours() / 24 * 176 + 4);
g.setColor('#ff0').drawLine(x_sun, g.getHeight()-IMAGEHEIGHT, x_sun, g.getHeight());
g.reset();
var locale = require("locale");
var date = new Date();
g.setFontAlign(0,0);
g.setFont("Michroma36").drawString(locale.time(date,1), g.getWidth()/2, 46);
g.setFont("6x8");
g.drawString(locale.date(new Date(),1), 125, 68);
g.drawString("PAR "+locale.time(getTimeFromTimezone(1),1), 125, 80);
g.drawString("TYO "+locale.time(getTimeFromTimezone(9),1), 125, 88);
queueNextDraw();
}
// init
g.setTheme({bg:"#fff",fg:"#000",dark:false}).clear();
draw();
Bangle.setUI("clock");
Bangle.loadWidgets();
Bangle.drawWidgets();
showWelcomeMessage();

BIN
apps/a_clock_timer/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1 @@
1.00: Release (2021/12/01)

View File

@ -0,0 +1,16 @@
# A Speech Timer
* A timer designed to help keeping your speeches and presentations to time
* Vibrates 1-2-3 times and changes screen color within the target time range.
* Example for a 5 to 7 minutes speech: vibrates once at 5:00 (green), twice at 6:00 (yellow), thrice at 7:00 (red).
* Use the buttons to start a timer
* Swipe left or right to choose different target times
* Touching the timer on the upper part of the screen locks (or unlocks) the buttons to prevent accidental changes
![](screenshot0.png)
![](screenshot1.png)
![](screenshot2.png)
![](screenshot3.png)
## Creator
[@alainsaas](https://github.com/alainsaas)

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwgP//kAj//AAP5/+PApH7//PAonvAoXzAonj//nApHggEHAoWAgA5BAAJCCAoU/IYIFCv///w0CAonrv/HAoXLv+DAogLFgPeAoV+nlOAoV4/8+AoV79+eFIVzAof7u/v5xBCs4FL84FE//O74FBu4FB64FD73TAoNz/+eAoV5IIIFCvl8vwFCv8A/wFDO4IFFFIQFCGoSVFUIqtDh65D/1vYof+Y4LLDw7dD/0ndIYRCeoQFC/P/z/+i///oFBGoX8gEfAgI="))

173
apps/a_speech_timer/app.js Normal file
View File

@ -0,0 +1,173 @@
Graphics.prototype.setFontMichroma36 = function() {
g.setFontCustom(atob("AAAAAAAAAAAAAAAAeAAAAAeAAAAAeAAAAAeAAAAAAAAAAAAAAAAAAAAAAAGAAAAA+AAAAD+AAAAP+AAAA/8AAAD/wAAAf/AAAB/4AAAH/gAAAf+AAAB/4AAAH/gAAAf+AAAAfwAAAAfAAAAAcAAAAAAAAAAAAAAAAAAAAAAAA///AAD///wAH///4AP///8APwAD+APAAAeAeAAAeAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAeAPAAAeAPwAD+AP///8AH///4AD///wAA///AAAAAAAAAAAAAAAAAAAAAEAAAAAOAAAAAfAAAAA+AAAAB8AAAAD8AAAAH4AAAAPwAAAAPgAAAAfAAAAAf///+Af///+Af///+Af///+AAAAAAAAAAAAAAAAAAAAAAAAAA/Af+AD/A/+AH/B/+AP/D/+APwD4eAPADweAfADweAeADweAeADweAeADweAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAPgeAeAPAeAeAPAeAeAPAeAeAPAeAfAPAeAPw/AeAP/+AeAH/+AeAD/8AeAB/wAOAAAAAAAAAAAAAAAAAAAAAAA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P///+AP//A+AfB+AeAeA+AeAeA+APAeA+APAeA+APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA+APAeA+APAeA+APAeA+AOAeA+AeAPh/A+AP///+AP/3/8AH/3/8AB/D/wAAAA/AAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAD/4HAAH/8HwAP/+H4AP5/H8AfAfA8AeAPAeAeAPAeAeAPAeAeAHgfAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHAPAeAPAOAeAPAeAPAPAeAPwfB+AP///8AH///4AD///wAA///AAAAAAAAAAAAAAAAAAAAAAAAAAAB8DwAAB8HwAAB8HwAAB8DwAAAAAAAAAAAAA"), 46, atob("CBIkESMjJCMjIyMjCA=="), 36+(1<<8)+(1<<16));
};
Graphics.prototype.setFontMichroma16 = function(scale) {
g.setFontCustom(atob("AAAAGAAYAAAAGAB4A/APwD4AeADgAAAAAAA/8H/4YBjAGMAcwBzAHMAcwBzAHMAYYBh/+D/wAAAAABgAOABwAGAA//h/+AAAAAA4+Hn4YZjhmMOYw5jDmMMYwxjDGOMYYxh/GD4YAAAAADBwcHhgGOAYwBzHHMccxxzHHMcc5xhnGH/4PfAAAAAAAOAB4APgB2AGYAxgHGA4YDBgYGD/+P/4AOAAYAAAAAD+cP547BjsGOwc7BzsHOwc7BzsHOwY7zjv+APgAAAAAD/wf/hmGOYYxhzGHMYcxhzGHOYYZhh3uDP4AeAAAEAA4ADgAOAI4DjgeODw4eDjgOcA7gD8APgA8AAAAAAAAAA58H/4bxjmGMYcxhzGHMYcxhzGHOYYbxh/+DnwAAAAADxgfnBnOOMYwxjDHMMcwxzDHMMY4xhjOH/4P/AAAAAABnAGcAAA"), 46, atob("BAgQCBAQEBAQEBAQBA=="), 16+(scale<<8)+(1<<16));
};
function timeToString(duration) {
var hrs = ~~(duration / 3600);
var mins = ~~((duration % 3600) / 60);
var secs = ~~duration % 60;
var ret = "";
if (hrs > 0) {
ret += "" + hrs + ":" + (mins < 10 ? "0" : "");
}
ret += "" + mins + ":" + (secs < 10 ? "0" : "");
ret += "" + secs;
return ret;
}
var newtimer_left_from = 60;
var newtimer_left_to = 2*60;
var newtimer_right_from = 5*60;
var newtimer_right_to = 7*60;
var current_from = 5*60;
var current_mid = 6*60;
var current_to = 7*60;
var current_value = 0;
var timerinterval;
var istimeron = false;
var islocked = false;
function countDown() {
current_value++;
draw();
if (current_value == current_from) {
Bangle.buzz(500);
} else if (current_value == current_mid) {
Bangle.buzz(400).then(()=>{
return new Promise(resolve=>setTimeout(resolve, 800));
}).then(()=>{
return Bangle.buzz(500);
});
} else if (current_value == current_to) {
Bangle.buzz(300).then(()=>{
return new Promise(resolve=>setTimeout(resolve, 600));
}).then(()=>{
Bangle.buzz(300).then(()=>{
return new Promise(resolve=>setTimeout(resolve, 600));
}).then(()=>{
return Bangle.buzz(500);
});
});
}
}
Bangle.on('touch',(touchside, touchdata)=>{
if (!islocked && istimeron && touchdata.y > (100+10)) {
Bangle.buzz(40);
istimeron = false;
clearInterval(timerinterval);
} else if (touchdata.y > 24 && touchdata.y < (100-10)) {
Bangle.buzz(40);
islocked = !islocked;
} else if (!islocked && touchdata.y > (100+10) && touchdata.x > 88 + 10) {
Bangle.buzz(40);
current_from = newtimer_right_from;
current_to = newtimer_right_to;
current_mid = (current_from + current_to) / 2;
current_value = 0;
if (timerinterval) clearInterval(timerinterval);
timerinterval = setInterval(countDown, 1000);
istimeron = true;
} else if (!islocked && touchdata.y > (100+10) && touchdata.x < 88 - 10) {
Bangle.buzz(40);
current_from = newtimer_left_from;
current_to = newtimer_left_to;
current_mid = (current_from + current_to) / 2;
current_value = 0;
if (timerinterval) clearInterval(timerinterval);
timerinterval = setInterval(countDown, 1000);
istimeron = true;
}
showInstructions = false;
draw();
});
Bangle.on('swipe',(swiperight, swipedown)=>{
console.log(swiperight);
console.log(swipedown);
if (swiperight == -1) {
if (newtimer_left_from >= 60) {
newtimer_left_from += 60;
newtimer_left_to += 60;
} else { // special case for 0:30 to 1:00
newtimer_left_from = 60;
newtimer_left_to = 120;
}
newtimer_right_from += 60;
newtimer_right_to += 60;
draw();
} else if (swiperight == 1) {
if (newtimer_left_from > 60) {
newtimer_left_from -= 60;
newtimer_left_to -= 60;
} else { // special case for 0:30 to 1:00
newtimer_left_from = 30;
newtimer_left_to = 60;
}
if (newtimer_right_from > 120) {
newtimer_right_from -= 60;
newtimer_right_to -= 60;
}
draw();
}
});
var drawTimeout;
var showInstructions = true;
function draw() {
g.reset();
if (current_value >= current_to) { g.setBgColor("#F00"); }
else if (current_value >= current_mid) { g.setBgColor("#FF0"); }
else if (current_value >= current_from) { g.setBgColor("#8F8"); }
g.clearRect(0,24,176,176);
g.reset();
g.setFontAlign(0, 0);
g.setFont("Michroma36").drawString(timeToString(current_value), 88, 62);
g.setFont("HaxorNarrow7x17");
g.drawString(timeToString(current_from), 44, 62+26);
g.drawString(timeToString(current_mid), 88, 62+26);
g.drawString(timeToString(current_to), 132, 62+26);
if (current_value >= current_from) { g.drawRect(44-1,62+26+9,44+1,62+26+9+1); }
if (current_value >= current_mid) { g.drawRect(88-1,62+26+9,88+1,62+26+9+1); }
if (current_value >= current_to) { g.drawRect(132-1,62+26+9,132+1,62+26+9+1); }
if (showInstructions) {
g.setFont("6x8").drawString("Tapping timer locks buttons", 88, 100+5);
g.setFont("6x8").drawString("<= Swipe to change time =>", 88, 168);
}
g.setColor(islocked ? "#444" : "#000");
g.setFont("Michroma16");
g.drawString(timeToString(newtimer_left_from), 44, 138-9);
g.drawString(timeToString(newtimer_left_to), 44, 138+9);
g.drawString(timeToString(newtimer_right_from), 132, 138-9);
g.drawString(timeToString(newtimer_right_to), 132, 138+9);
g.drawRect(0+8,138-24, 88-9+1, 138+22+1);
g.drawRect(0+8,138-24, 88-9, 138+22);
g.drawRect(88+8,138-24, 176-10+1, 138+22+1);
g.drawRect(88+8,138-24, 176-10, 138+22);
}
require("FontHaxorNarrow7x17").add(Graphics);
g.clear();
Bangle.loadWidgets();
Bangle.drawWidgets();
draw();

BIN
apps/a_speech_timer/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1 +1,2 @@
0.02: Fix JSON save format
0.01: First release

View File

@ -8,6 +8,7 @@ const algos = {
};
var tokens = require("Storage").readJSON("authentiwatch.json", true) || [];
tokens = tokens.data;
// QR Code Text
//
@ -257,7 +258,8 @@ function onSwipe(e) {
}
if (e == -1 && state.curtoken != -1 && tokens[state.curtoken].period <= 0) {
tokens[state.curtoken].period--;
require("Storage").writeJSON("authentiwatch.json", tokens);
let save={data:tokens,count:tokens.length};
require("Storage").writeJSON("authentiwatch.json", save);
state.nextTime = 0;
state.hide = 2;
draw();

View File

@ -322,7 +322,8 @@ function loadTokens() {
Puck.eval(`require('Storage').read(${JSON.stringify('authentiwatch.json')})`,data=>{
Util.hideModal();
try {
tokens = JSON.parse(data);
let load = JSON.parse(data);
tokens = load.data;
updateTokens();
} catch {
tokens = [];
@ -333,7 +334,8 @@ function loadTokens() {
*/
function saveTokens() {
Util.showModal('Saving...');
Puck.write(`\x10require('Storage').write(${JSON.stringify('authentiwatch.json')},${JSON.stringify(tokens)})\n`,()=>{
let save={data:tokens,count:tokens.length};
Puck.write(`\x10require('Storage').write(${JSON.stringify('authentiwatch.json')},${JSON.stringify(save)})\n`,()=>{
Util.hideModal();
});
}

View File

@ -27,3 +27,4 @@
0.23: Fix issue where tracks wouldn't record when running from OpenStMap if a period hadn't been set up first
0.24: Better support for Bangle.js 2, avoid widget area for Graphs, smooth graphs more
0.25: Fix issue where if Bangle.js 2 got a GPS fix but no reported time, errors could be caused by the widget (fix #935)
0.26: Multiple bugfixes

View File

@ -249,10 +249,10 @@ function plotTrack(info) {
g.fillCircle(ox,oy,5);
if (info.qOSTM) g.setColor(0, 0, 0);
else g.setColor(1,1,1);
g.drawString(require("locale").distance(dist),120,220);
g.drawString(require("locale").distance(dist),g.getWidth() / 2, g.getHeight() - 20);
g.setFont("6x8",2);
g.setFontAlign(0,0,3);
g.drawString("Back",230,200);
g.drawString("Back",g.getWidth() - 10, g.getHeight() - 40);
setWatch(function() {
viewTrack(info.fn, info);
}, global.BTN3||BTN1);
@ -330,13 +330,13 @@ function plotGraph(info, style) {
height: g.getHeight()-(24+8),
axes : true,
gridy : grid,
gridx : 50,
gridx : infn.length / 3,
title: title,
xlabel : x=>Math.round(x*dur/(60*infn.length))+" min" // minutes
});
g.setFont("6x8",2);
g.setFontAlign(0,0,3);
g.drawString("Back",230,200);
g.drawString("Back",g.getWidth() - 10, g.getHeight() - 40);
setWatch(function() {
viewTrack(info.fn, info);
}, global.BTN3||BTN1);

View File

@ -0,0 +1,2 @@
0.01: Initial Release

View File

@ -0,0 +1,9 @@
# Mandlebrot Clock
A simple clock themed on the mandlebrot set.
Written by [James Milner](https://www.github.com/jameslmilner)
![](app.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwxH+vdvwMzq8CrGCwVewNRluCxAHBAAOsxAAB1gAD1oBB2fWAAPO1mBGZIvCrECq4bBglYmglBGgIxBFQItDFQQsC2es6/XF4OrwOsqwvIt4vBxFdgder0uwUoLQRXE1oqB1nQ1nW2RbCA4PW6HP52rF5d7KoKNBmcDIYIzBrBaB1vPFAOz2RVB1ml54qB1fQFwQvB5+kwSQJWIQoExAFBRYaBB0pVCQYRiB0wDC1erFoPO5ul02sF5QnBAAYFBwbkF0ul1eIAQOqOwLlBIwL7BGIOkAANvxErF49dF4dYGoJfBLoIwD6AfBEgJbBwIEBqwGBqw4BU4Osvd1uteSBDiEFIKLDdQey6ytBE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QfgLYBEYIABNoNWljjCHgNeBgWr63W2QvBxOJBIWr54uCYgL0BLAIsCBIIKB1T+BVwN8WAJcBNQIABIgQGB1fX2RdBXoOJFQWzSIOz1uzAoIwBFgXX2ZHBOIRDCWAOBRgQtC53P1OB0wlBMgQuBdwQAF1oxBEwI7B1p0CBgIIBAAPP0mBcgNWBYOkBYbfB6wtCxCaFGYQKBAoQvBOQIACHoey2ey6D2D0uC0yIBLIILB0pJBEIU6wU0FQbEBF4hnFA4ZlBNoRhCGAJYBHYSKD1eyEYJfBrxfCAwNeAILVBwZZExIABGATNCGARvBCoIMBFwJzDAIderFYwWJsgyBCoI1BAYIABF4QeBL4IvDOIIvDL4PPBYIuCKQQRBEAWsrE0AocQAQJpBGgRNCIQIECCQQzD6Gr0qMBbwYADJ4ZUBl1YBAVelwpBNIQDBFIImCl2CagIVBAATkC5/WFwhLFFoMtwM0E4MtltevggBgcDwITCrEzxEulz5CDgNkMIer6GyLogsCwWmI4MzrFXGAMEA=="))

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -0,0 +1 @@
0.01: First release

41
apps/mylocation/README.md Normal file
View File

@ -0,0 +1,41 @@
# My Location
*Sets and stores GPS lat and lon of your preferred city*
* Select one of the preset Cities or setup through the GPS
* Other Apps can read this information to do calculations based on location
* When the City shows ??? it means the location has been set through the GPS
## Example Code
const LOCATION_FILE = "mylocation.json";
let location;
// requires the myLocation app
function loadLocation() {
location = require("Storage").readJSON(LOCATION_FILE,1)||{"lat":51.5072,"lon":0.1276,"location":"London"};
}
## Screenshots
### Select one of the Preset Cities
* The presets are London, Newcastle, Edinburgh, Paris, New York, Tokyo
![](screenshot_1.png)
### Or select 'Set By GPS' to start the GPS
![](screenshot_2.png)
### While the GPS is running you will see:
![](screenshot_3.png)
### When a GPS fix is received you will see:
![](screenshot_4.png)
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)

View File

@ -0,0 +1,75 @@
Bangle.loadWidgets();
Bangle.drawWidgets();
const SETTINGS_FILE = "mylocation.json";
let settings;
// initialize with default settings...
let s = {
'lat': 51.5072,
'lon': 0.1276,
'location': "London"
}
function loadSettings() {
settings = require('Storage').readJSON(SETTINGS_FILE, 1) || s;
}
function save() {
settings = s
require('Storage').write(SETTINGS_FILE, settings)
}
const locations = ["London", "Newcastle", "Edinburgh", "Paris", "New York", "Tokyo","???"];
const lats = [51.5072 ,54.9783 ,55.9533 ,48.8566 ,40.7128 ,35.6762, 0.0];
const lons = [-0.1276 ,-1.6178 ,-3.1883 ,2.3522 , -74.0060 ,139.6503, 0.0];
function setFromGPS() {
Bangle.on('GPS', (gps) => {
//console.log(".");
if (gps.fix === 0) return;
//console.log("fix from GPS");
s = {'lat': gps.lat, 'lon': gps.lon, 'location': '???' }
Bangle.buzz(1500); // buzz on first position
Bangle.setGPSPower(0);
save();
Bangle.setUI("updown", ()=>{ load() });
E.showPrompt("Location has been saved from the GPS fix",{
title:"Location Saved",
buttons : {"OK":1}
}).then(function(v) {
load(); // load default clock
});
});
Bangle.setGPSPower(1);
E.showMessage("Waiting for GPS fix. Place watch in the open. Could take 10 minutes. Long press to abort", "GPS Running");
Bangle.setUI("updown", undefined);
}
function showMainMenu() {
console.log("showMainMenu");
const mainmenu = {
'': { 'title': 'My Location' },
'<Back': ()=>{ load(); },
'City': {
value: 0 | locations.indexOf(s.location),
min: 0, max: 6,
format: v => locations[v],
onchange: v => {
if (v != 6) {
s.location = locations[v];
s.lat = lats[v];
s.lon = lons[v];
save();
}
}
},
'Set From GPS': ()=>{ setFromGPS(); }
}
return E.showMenu(mainmenu);
}
loadSettings();
showMainMenu();

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEw4UA///t/7j/P3/vB4cBqtVoAbHBQIABBQ0FBYdQBYsVBYdUERIkGHIQADHoguEGAwuEGAwKFBZg8DHQw8EBYNf/1Vq3/8oLDIwNf/Wpv//0oLG9Wq3/qBYJUCBYuqBaBqBBYW+BepHEBbybCBYP+BYSnErYLDyoLFAANq/r8Ga5T7MBZZUBAAhSCfhA6DBZhIGBQg8FHQg8GHQgwGFwowFBQwwDFwwLMlS7Bqta1AKEn2q1K1C1WgBYf/1WqBYIDB1QKCgYLC0taBYoXB/QICBY0//7vBAAQ8EEgIABCwwME9QVEA"))

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -3,5 +3,6 @@
0.03: Make it work with Gadgetbridge, Notifications fullscreen on a Bangle 2
0.04: Leave space at the bottom for Chrono widget, set back option at first option
0.05: Added 2 new fonts
0.06: COnverted fonts to font modules
0.06: Converted fonts to font modules
0.07: Added info line that cycles on BTN1/BTN3 (or vitual buttons on a bangle 2)
0.08: Added dependancy on MyLocation

View File

@ -1,6 +1,6 @@
# Pastel Clock
*a configurable clock with custom fonts and background*
*a configurable clock with custom fonts and background. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times*
* Designed specifically for Bangle 1 and Bangle 2
* A choice of 7 different custom fonts
@ -8,12 +8,13 @@
* Has a settings menu, change font, enable/disable the grid
* On Bangle 1 use BTN1,BTN3 to cycle through the info display (Date, ID, Batt %, Ram % etc)
* On Bangle 2 touch the top right/top left to cycle through the info display (Date, ID, Batt %, Ram % etc)
* Uses mylocation.json from MyLocation app to calculate sunrise and sunset times for your location
* Uses pedometer widget to get latest step count
* Dependant apps are installed when Pastel installs
I came up with the name Pastel due to the shade of the grid background.
## Creator
[Hugh Barney](https://github.com/hughbarney)
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
## Lato
![](screenshot_lato.png)

View File

@ -1,6 +1,9 @@
var SunCalc = require("https://raw.githubusercontent.com/mourner/suncalc/master/suncalc.js");
require("f_latosmall").add(Graphics);
const SETTINGS_FILE = "pastel.json";
const LOCATION_FILE = "mylocation.json";
let settings;
let location;
function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)||{};
@ -8,6 +11,29 @@ function loadSettings() {
settings.font = settings.font||"Lato";
}
// requires the myLocation app
function loadLocation() {
location = require("Storage").readJSON(LOCATION_FILE,1)||{"lat":51.5072,"lon":0.1276,"location":"London"};
}
function extractTime(d){
var h = d.getHours(), m = d.getMinutes();
return(("0"+h).substr(-2) + ":" + ("0"+m).substr(-2));
}
var sunRise = "00:00";
var sunSet = "00:00";
var drawCount = 0;
function updateSunRiseSunSet(now, lat, lon, line){
// get today's sunlight times for lat/lon
var times = SunCalc.getTimes(new Date(), lat, lon);
// format sunrise time from the Date object
sunRise = extractTime(times.sunrise);
sunSet = extractTime(times.sunset);
}
function loadFonts() {
// load font files based on settings.font
if (settings.font == "Architect")
@ -39,6 +65,8 @@ const infoData = {
ID_BLANK: { calc: () => '' },
ID_DATE: { calc: () => {var d = (new Date).toString().split(" "); return d[2] + ' ' + d[1] + ' ' + d[3];} },
ID_DAY: { calc: () => {var d = require("locale").dow(new Date).toLowerCase(); return d[0].toUpperCase() + d.substring(1);} },
ID_SR: { calc: () => 'Sunrise: ' + sunRise },
ID_SS: { calc: () => 'Sunset: ' + sunSet },
ID_STEP: { calc: () => 'Steps: ' + stepsWidget().getSteps() },
ID_BATT: { calc: () => 'Battery: ' + E.getBattery() + '%' },
ID_MEM: { calc: () => {var val = process.memory(); return 'Ram: ' + Math.round(val.usage*100/val.total) + '%';} },
@ -148,6 +176,10 @@ function draw() {
g.setFontLatoSmall();
g.setFontAlign(0, -1);
g.drawString((infoData[infoMode].calc()), w/2, h - 24 - 24);
if (drawCount % 3600 == 0)
updateSunRiseSunSet(new Date(), location.lat, location.lon);
drawCount++;
}
// Only update when display turns on
@ -169,6 +201,8 @@ Bangle.setUI("clockupdown", btn=> {
loadSettings();
loadFonts();
loadLocation();
g.clear();
var secondInterval = setInterval(draw, 1000);
draw();

1
apps/pebble/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: first release

17
apps/pebble/README.md Normal file
View File

@ -0,0 +1,17 @@
# Pebble
*a Pebble style clock with configurable background color, to keep the revolution going*
* Designed specifically for Bangle 2
* A choice of 6 different background colous through its setting menu
* Supports the Light and Dark themes
* Uses pedometer widget to get latest step count
* Dependant apps are installed when Pebble installs
* Uses the whole screen, widgets are made invisible but still run in the background
* When battery is less than 30% main screen goes Red
![](pebble_screenshot.png)
![](pebble_screenshot2.png)
![](pebble_screenshot3.png)
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

116
apps/pebble/pebble.app.js Normal file
View File

@ -0,0 +1,116 @@
Graphics.prototype.setFontQahiri = function(scale) {
// Actual height 60 (60 - 1)
g.setFontCustom(atob("AAAAAAAAfAAAAAAAAAAAAP4AAAAAAAAAAAD/AAAAAAAAAAAB/wAAAAAAAAAAAf8AAAAAAAAAAAH/AAAAAAAAAAAA/wAAAAAAAAAAAH4AAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAAAB8AAAAAAAAAAAD/gAAAAAAAAAAH/4AAAAAAAAAAP/8AAAAAAAAAAP/4AAAAAAAAAAf/4AAAAAAAAAA//wAAAAAAAAAB//gAAAAAAAAAD//AAAAAAAAAAD//AAAAAAAAAAH/+AAAAAAAAAAP/8AAAAAAAAAAf/4AAAAAAAAAAf/4AAAAAAAAAA//wAAAAAAAAAB//gAAAAAAAAAD//AAAAAAAAAAH/+AAAAAAAAAAH/+AAAAAAAAAAP/8AAAAAAAAAAH/4AAAAAAAAAAB/wAAAAAAAAAAAPwAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD/AAAD/AAAAAAA/wAAA/wAAAAAAP8AAAP8AAAAAAD/AAAD/AAAAAAA/wAAA/wAAAAAAP8AAAP8AAAAAAD/AAAD/AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAH///gH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///AAAAAAAAAAP//wAAAAAAAAAD//8AAAAAAAAAA///AAAAAAAAAAP//wAAAAAAAAAD//8AAAAAAAAAA///AAAAAAAAAAP//wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAH8A///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAH8A///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAfAAAAAAAAAfwAP4AAAAAAAAP8AD/AAAAAAAAD/gB/wAAAAAAAA/4Af8AAAAAAAAP+AH/AAAAAAAAD/AA/wAAAAAAAAfgAH4AAAAAAAABwAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="), 46, atob("DR0bDBsbGxsbGxsbDQ=="), 80+(scale<<8)+(1<<16));
}
const SETTINGS_FILE = "pebble.json";
let settings;
function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green'};
}
var img = require("heatshrink").decompress(atob("oFAwkGswA/AH4A/AH4A/AH4A/AFEAD74gdsAfBELlggMhD70iILsAiUAIKQRBgxAHgUiIKQQJUAMSD4JBQsBVBIAq/DEAJBCJ45VHkAxEDwKfDIIUREBq2BmcQCAQeCkczmRBEiAgND4MxSoYGBAAQgCAAohKDARhBG4IeDEAQ8BAA5fJABgpBgFDgEiQgJEHT4IeMmMBkMFAYJJDEQaYDiYfMkECiEEoEDBAX//8ykJsBD4MAWwIALiBeCqAyDn//BoYgBgAeMYAMhgE0CRIOBD58BkEEmCRKkEGD5szkUQqdASJUxD4MAgKBKmUigFEGJZgBAATODFw0CkEBmoOJAAQdB7owBOBDdCgbdED5fd6pRIgDdCeBkxD4fdeAgNEkMFmheLdgIfE6BgGmDdCoDdKDwYfD6gzGiBeBrpLHXYUQXIMgD4NND4SAFZgMRgAKBPwroBBYIeBIAL/CADESL4VmsAcWgMRkQeDAAMAkQAWMAQeCD4MSDqqdBDwgfBAC8GDwiAXDowA/AH4A/AH4A/AH4A/AEA"));
const h = g.getHeight();
const w = g.getWidth();
const ha = 2*h/5 - 8;
const h2 = 3*h/5 - 10;
const h3 = 7*h/8;
let batteryWarning = false;
function draw() {
let date = new Date();
let da = date.toString().split(" ");
//let timeStr = require("locale").time(date,1); // causes screen corruption ???
let timeStr = da[4].substr(0,5);
const t = 6;
// turn the warning on once we have dipped below 30%
if (E.getBattery() < 30)
batteryWarning = true;
// turn the warning off once we have dipped above 40%
if (E.getBattery() > 40)
batteryWarning = false;
g.reset();
g.setColor(settings.bg);
g.fillRect(0, 0, w, h2 - t);
// contrast bar
g.setColor(g.theme.fg);
g.fillRect(0, h2 - t, w, h2);
// day and steps
if (settings.color == 'Blue' || settings.color == 'Red')
g.setColor('#fff'); // white on blue or red best contrast
else
g.setColor('#000'); // otherwise black regardless of theme
g.setFont('Vector', 22);
g.setFontAlign(0, -1);
g.drawString(da[0], w/4, ha); // day of week
g.drawString(getSteps(), 3*w/4, ha);
// time
// white on red for battery warning
g.setColor(!batteryWarning ? g.theme.bg : '#f00');
g.fillRect(0, h2, w, h3);
g.setFontQahiri();
g.setFontAlign(0, -1);
g.setColor(!batteryWarning ? g.theme.fg : '#fff');
g.drawString(timeStr, w/2, h2 - 8);
// contrast bar
g.setColor(g.theme.fg);
g.fillRect(0, h3, w, h3 + t);
// the bottom
g.setColor(settings.bg);
g.fillRect(0, h3 + t, w, h);
g.setColor(settings.bg);
g.drawImage(img, w/2 + ((w/2) - 64)/2, 10, { scale: 1 });
drawCalendar(((w/2) - 48)/2, 10, 48, 4, da[2]);
}
// at x,y width:wi thicknes:th
function drawCalendar(x,y,wi,th,str) {
g.setColor(g.theme.fg);
g.fillRect(x, y, x + wi, y + wi);
g.setColor(g.theme.bg);
g.fillRect(x + th, y + th, x + wi - th, y + wi - th);
g.setColor(g.theme.fg);
let hook_t = 6;
// first calendar hook, one third in
g.fillRect(x + (wi/3) - (th/2), y - hook_t, x + wi/3 + th - (th/2), y + hook_t);
// second calendar hook, two thirds in
g.fillRect(x + (2*wi/3) -(th/2), y - hook_t, x + 2*wi/3 + th - (th/2), y + hook_t);
g.setFont('Vector', 22);
g.setFontAlign(0, 0);
g.drawString(str, x + wi/2 + th/2, y + wi/2 + th/2);
}
function getSteps() {
if (WIDGETS.wpedom !== undefined) {
return WIDGETS.wpedom.getSteps();
}
return '????';
}
g.clear();
Bangle.loadWidgets();
/*
* we are not drawing the widgets as we are taking over the whole screen
* so we will blank out the draw() functions of each widget
*/
for (let wd of WIDGETS) {wd.draw=()=>{};}
loadSettings();
setInterval(draw, 15000); // refresh every 15s
draw();
Bangle.setUI("clock");

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("oFAwgNKiIAIFqofegIf/DAUzAAMyAwUQD60T/4ACD7Q/cPxIf/YCofcDhYiSXYYfuUZgf/D/4f/D6USkUgD/4fuogAID6vtDw/UD6vu6geF73kb6vuEAtN9wfYMIneD7JADDwIfaIAJdBD7YgBHwQfbAAgfkf6Qf/D/4feogAID6oAND/4f/iAdJD/4f/D/4fUDxYABD74iODiAftTZgfnYYczAAMyD7UT/4ACH/S+bD8DAKD9Y="))

BIN
apps/pebble/pebble.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,38 @@
(function(back) {
const SETTINGS_FILE = "pebble.json";
// initialize with default settings...
let s = {'bg': '#0f0', 'color': 'Green'}
// ...and overwrite them with any saved values
// This way saved values are preserved if a new version adds more settings
const storage = require('Storage')
let settings = storage.readJSON(SETTINGS_FILE, 1) || s;
const saved = settings || {}
for (const key in saved) {
s[key] = saved[key]
}
function save() {
settings = s
storage.write(SETTINGS_FILE, settings)
}
var color_options = ['Green','Orange','Cyan','Perple','Red','Blue'];
var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f'];
E.showMenu({
'': { 'title': 'Pebble Clock' },
'< Back': back,
'Colour': {
value: 0 | color_options.indexOf(s.color),
min: 0, max: 5,
format: v => color_options[v],
onchange: v => {
s.color = color_options[v];
s.bg = bg_code[v];
save();
},
}
});
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

1
apps/poweroff/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New app!

13
apps/poweroff/README.md Normal file
View File

@ -0,0 +1,13 @@
# Poweroff
Simple app to power off your Bangle.js
## Usage
Start the app shutdowns your Bangle.js watch after a short delay.
## Creator
Marco (@myxor)
## Icon
Icon taken from https://materialdesignicons.com/ Apache License 2.0

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwMB/4Ak/k/ArX8AoIGC/F8n0fAoPwAoMPAoPgAoMHAoPAC4MDAoPBAoODAoODAoPBAoOHAoPhAo8HAoPgAoMPAoPwArRQCFIRQCGoQCBHYYFEKARNCAQQIC4ACBMoXgv/+EwXwn/8GQX4g/gRIX8b4KVC/wFBv6iCwDnE+AcCAF4="))

13
apps/poweroff/app.js Normal file
View File

@ -0,0 +1,13 @@
g.clear();
g.setFont("6x8",2).setFontAlign(0,0);
var x = g.getWidth()/2;
var y = g.getHeight()/2 + 10;
g.drawString("Powering off...", x, y);
setTimeout(function() {
if (Bangle.softOff) Bangle.softOff(); else Bangle.off();
}, 1000);
Bangle.loadWidgets();
Bangle.drawWidgets();

BIN
apps/poweroff/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

View File

@ -2,3 +2,4 @@
0.02: Use 'recorder.log..' rather than 'record.log..'
Fix interface.html
0.03: Fix theme and maps/graphing if no GPS
0.04: Multiple bugfixes

View File

@ -304,10 +304,10 @@ function plotTrack(info) {
g.fillCircle(ox,oy,5);
if (info.qOSTM) g.setColor("#000");
else g.setColor(g.theme.fg);
g.drawString(require("locale").distance(dist),120,220);
g.drawString(require("locale").distance(dist),g.getWidth() / 2, g.getHeight() - 20);
g.setFont("6x8",2);
g.setFontAlign(0,0,3);
g.drawString("Back",230,200);
g.drawString("Back",g.getWidth() - 10, g.getHeight() - 40);
setWatch(function() {
viewTrack(info.fn, info);
}, global.BTN3||BTN1);
@ -360,6 +360,10 @@ function plotGraph(info, style) {
var t,dx,dy,d,lt = c[timeIdx];
while(l!==undefined) {
++nl;c=l.split(",");
l = f.readLine(f);
if (c[latIdx] == "") {
continue;
}
t = c[timeIdx];
i = Math.round(80*(t - strt)/dur);
p = Bangle.project({lat:c[latIdx],lon:c[lonIdx]});
@ -372,7 +376,6 @@ function plotGraph(info, style) {
}
lp = p;
lt = t;
l = f.readLine(f);
}
} else throw new Error("Unknown type "+style);
var min=100000,max=-100000;
@ -396,13 +399,15 @@ function plotGraph(info, style) {
height: g.getHeight()-(24+8),
axes : true,
gridy : grid,
gridx : 50,
gridx : infn.length / 3,
title: title,
miny: min,
maxy: max,
xlabel : x=>Math.round(x*dur/(60*infn.length))+" min" // minutes
});
g.setFont("6x8",2);
g.setFontAlign(0,0,3);
g.drawString("Back",230,200);
g.drawString("Back",g.getWidth() - 10, g.getHeight() - 40);
setWatch(function() {
viewTrack(info.filename, info);
}, global.BTN3||BTN1);

2
apps/sensible/ChangeLog Normal file
View File

@ -0,0 +1,2 @@
0.01: New App!
0.02: Corrected variable initialisation

35
apps/sensible/README.md Normal file
View File

@ -0,0 +1,35 @@
# Sensible
Collect all the sensor data from the Bangle.js 2, display the live readings in menu pages, and broadcast in Bluetooth Low Energy (BLE) advertising packets to any listening devices in range.
## Usage
The advertising packets will be recognised by [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) open source middleware and any other program which observes the standard packet types. Also convenient for testing individual sensors of the Bangle.js 2 via the menu interface.
## Features
Currently implements:
- Accelerometer
- Barometer
- GPS
- Heart Rate Monitor
- Magnetometer
in the menu display but NOT YET in Bluetooth Low Energy advertising (which will be implemented in a subsequent version).
## Controls
Browse and control sensors using the standard Espruino menu interface.
## Requests
[Contact reelyActive](https://www.reelyactive.com/contact/) for support/updates.
## Creator
Developed by [jeffyactive](https://github.com/jeffyactive) of [reelyActive](https://www.reelyactive.com)

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwkG/4AG+cilGIxGCkU/B44AGmQUBAAsjCyoYN+QWJAAMvCxsjLQXzG4gYIOIZwG+YLDCw34BRIkFx4JFHQRDElGCJYgOCFw5RCPQwJFGAg4BIoSRIDAQQEG4YLBHgYAGJQIjCJ4RGBDoU4SIqNDwYwDJAQEDFwSRGDAQfBFQgIDFwQtDRoowBAgQDEDYQzC7oACTogrEA4IfF/4WDDAY/Fx4CCEYQbB/oXF74TDCAYGBUoIDDCwowCUoIkBAYSABGwIDCLogADBIKMCAYRODLwRGGJAaMFPwghBnoXJHoJ8DF4Q5DC5HTKogVBgAAFpoXH6oQGAA1dC7/UC5sNC4/dCA0QAwsEC50BC40AC5FQC4sgMB4XFgUwC40FC4/QBwkD+B5HDA6oFh/xSREFqtVbogMEj/yVxkFMwRgEl//Y5sAqhgF///SA4AHghgDgQXBPBAAHrpICh4XBMBoADC4ReBAALxHABUBCwX/bI4AKgYXD+YXRn4XDSKCNDAAZ5QOoZhSLohhESRkBLopJQIo4YOCxYYCJQ0BCxoACmURCoMRkYOI"))

162
apps/sensible/sensible.js Normal file
View File

@ -0,0 +1,162 @@
/**
* Copyright reelyActive 2021
* We believe in an open Internet of Things
*/
// Non-user-configurable constants
const APP_ID = 'sensible';
// Global variables
let acc, bar, hrm, mag;
let isAccMenu = false;
let isBarMenu = false;
let isGpsMenu = false;
let isHrmMenu = false;
let isMagMenu = false;
let isBarEnabled = true;
let isGpsEnabled = true;
let isHrmEnabled = true;
let isMagEnabled = true;
// Menus
let mainMenu = {
"": { "title": "-- SensiBLE --" },
"Acceleration": function() { E.showMenu(accMenu); isAccMenu = true; },
"Barometer": function() { E.showMenu(barMenu); isBarMenu = true; },
"GPS": function() { E.showMenu(gpsMenu); isGpsMenu = true; },
"Heart Rate": function() { E.showMenu(hrmMenu); isHrmMenu = true; },
"Magnetometer": function() { E.showMenu(magMenu); isMagMenu = true; }
};
let accMenu = {
"": { "title" : "- Acceleration -" },
"State": { value: "On" },
"x": { value: null },
"y": { value: null },
"z": { value: null },
"<-": function() { E.showMenu(mainMenu); isAccMenu = false; },
};
let barMenu = {
"": { "title" : "- Barometer -" },
"State": {
value: isBarEnabled,
format: v => v ? "On" : "Off",
onchange: v => { isBarEnabled = v; Bangle.setBarometerPower(v, APP_ID); }
},
"Altitude": { value: null },
"Press": { value: null },
"Temp": { value: null },
"<-": function() { E.showMenu(mainMenu); isBarMenu = false; },
};
let gpsMenu = {
"": { "title" : "- GPS -" },
"State": {
value: isGpsEnabled,
format: v => v ? "On" : "Off",
onchange: v => { isGpsEnabled = v; Bangle.setGPSPower(v, APP_ID); }
},
"Lat": { value: null },
"Lon": { value: null },
"Altitude": { value: null },
"Satellites": { value: null },
"HDOP": { value: null },
"<-": function() { E.showMenu(mainMenu); isGpsMenu = false; },
};
let hrmMenu = {
"": { "title" : "- Heart Rate -" },
"State": {
value: isHrmEnabled,
format: v => v ? "On" : "Off",
onchange: v => { isHrmEnabled = v; Bangle.setHRMPower(v, APP_ID); }
},
"BPM": { value: null },
"Confidence": { value: null },
"<-": function() { E.showMenu(mainMenu); isHrmMenu = false; },
};
let magMenu = {
"": { "title" : "- Magnetometer -" },
"State": {
value: isMagEnabled,
format: v => v ? "On" : "Off",
onchange: v => { isMagEnabled = v; Bangle.setCompassPower(v, APP_ID); }
},
"x": { value: null },
"y": { value: null },
"z": { value: null },
"Heading": { value: null },
"<-": function() { E.showMenu(mainMenu); isMagMenu = false; },
};
// Update acceleration
Bangle.on('accel', function(newAcc) {
acc = newAcc;
if(isAccMenu) {
accMenu.x.value = acc.x.toFixed(2);
accMenu.y.value = acc.y.toFixed(2);
accMenu.z.value = acc.z.toFixed(2);
E.showMenu(accMenu);
}
});
// Update barometer
Bangle.on('pressure', function(newBar) {
bar = newBar;
if(isBarMenu) {
barMenu.Altitude.value = bar.altitude.toFixed(1) + 'm';
barMenu.Press.value = bar.pressure.toFixed(1) + 'mbar';
barMenu.Temp.value = bar.temperature.toFixed(1) + 'C';
E.showMenu(barMenu);
}
});
// Update GPS
Bangle.on('GPS', function(newGps) {
gps = newGps;
if(isGpsMenu) {
gpsMenu.Lat.value = gps.lat.toFixed(4);
gpsMenu.Lon.value = gps.lon.toFixed(4);
gpsMenu.Altitude.value = gps.alt + 'm';
gpsMenu.Satellites.value = gps.satellites;
gpsMenu.HDOP.value = (gps.hdop * 5).toFixed(1) + 'm';
E.showMenu(gpsMenu);
}
});
// Update heart rate monitor
Bangle.on('HRM', function(newHrm) {
hrm = newHrm;
if(isHrmMenu) {
hrmMenu.BPM.value = hrm.bpm;
hrmMenu.Confidence.value = hrm.confidence + '%';
E.showMenu(hrmMenu);
}
});
// Update magnetometer
Bangle.on('mag', function(newMag) {
mag = newMag;
if(isMagMenu) {
magMenu.x.value = mag.x;
magMenu.y.value = mag.y;
magMenu.z.value = mag.z;
magMenu.Heading.value = mag.heading.toFixed(1);
E.showMenu(magMenu);
}
});
// On start: enable sensors and display main menu
g.clear();
Bangle.setBarometerPower(isBarEnabled, APP_ID);
Bangle.setGPSPower(isGpsEnabled, APP_ID);
Bangle.setHRMPower(isHrmEnabled, APP_ID);
Bangle.setCompassPower(isMagEnabled, APP_ID);
E.showMenu(mainMenu);

BIN
apps/sensible/sensible.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

1
apps/widbars/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New Widget!

15
apps/widbars/README.md Normal file
View File

@ -0,0 +1,15 @@
# Bars Widget
A simple widget that display several measurements as vertical bars.
![Screenshot](screenshot.png)
## Measurements from left to right:
<!-- HRM and Temperature are commented out (they didn't seem very useful)
- Current heart rate, on a scale from 0-200 bpm (*red*)<br>
Only if available: this widget does not turn on HRM monitoring by itself.
- Device temperature, on a scale from 0-50 °C (*yellow*)
-->
- Flash storage space used (*blue/cyan*)
- Memory usage (*magenta*)
- Battery charge (*green*)

BIN
apps/widbars/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
apps/widbars/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

67
apps/widbars/widget.js Normal file
View File

@ -0,0 +1,67 @@
(() => {
const h=24, // widget height
w=3, // width of single bar
bars=3; // number of bars
// Note: HRM/temperature are commented out (they didn't seem very useful)
// If re-adding them, also adjust `bars`
// ==HRM start==
// // We show HRM if available, but don't turn it on
// let bpm,rst,con=10; // always ignore HRM with confidence below 10%
// function noHrm() { // last value is no longer valid
// if (rst) clearTimeout(rst);
// rst=bpm=undefined; con=10;
// WIDGETS["bars"].draw();
// }
// Bangle.on('HRM', hrm=>{
// if (hrm.confidence>con || hrm.confidence>=80) {
// bpm=hrm.confidence;
// con=hrm.confidence;
// WIDGETS["bars"].draw();
// if (rst) clearTimeout(rst);
// rst = setTimeout(noHrm, 10*60*1000); // forget HRM after 10 minutes
// }
// });
// ==HRM end==
/**
* Draw a bar
*
* @param {int} x left
* @param {int} y top (of full bar)
* @param {string} col Color
* @param {number} f Fraction of bar to draw
*/
function bar(x,y, col,f) {
if (!f) f = 0; // for f=NaN: set it to 0 -> don't even draw the bottom pixel
if (f>1) f = 1;
if (f<0) f = 0;
const top = Math.round((h-1)*(1-f));
// use Math.min/max to make sure we stay within widget boundaries for f=0/f=1
if (top) g .clearRect(x,y, x+w-1,y+top-1); // erase above bar
if (f) g.setColor(col).fillRect(x,y+top, x+w-1,y+h-1); // even for f=0.001 this is still 1 pixel high
}
function draw() {
g.reset();
const x = this.x, y = this.y,
m = process.memory();
let b=0;
// ==HRM== bar(x+(w*b++),y,'#f00'/*red */,bpm/200); // >200 seems very unhealthy; if we have no valid bpm this will just be empty space
// ==Temperature== bar(x+(w*b++),y,'#ff0'/*yellow */,E.getTemperature()/50); // you really don't want to wear a watch that's hotter than 50°C
bar(x+(w*b++),y,g.theme.dark?'#0ff':'#00f'/*cyan/blue*/,1-(require('Storage').getFree() / process.env.STORAGE));
bar(x+(w*b++),y,'#f0f'/*magenta*/,m.usage/m.total);
bar(x+(w*b++),y,'#0f0'/*green */,E.getBattery()/100);
}
let redraw;
Bangle.on('lcdPower', on => {
if (redraw) clearInterval(redraw)
redraw = undefined;
if (on) {
WIDGETS["bars"].draw();
redraw = setInterval(()=>WIDGETS["bars"].draw, 10*1000); // redraw every 10 seconds
}
});
WIDGETS["bars"]={area:"tr",width: bars*w,draw:draw};
})()

View File

@ -10,3 +10,4 @@
0.11: Don't overwrite existing settings on app update
0.12: Fixed for Bangle 2
0.13: Fillbar setting added, see README
0.14: Fix drawing the bar when charging

View File

@ -5,12 +5,12 @@ Show the current battery level and charging status in the top right of the clock
Works with Bangle 1 and Bangle 2
When the fillbar setting is on the level colour will fill the entire
bar. This makes for an easier to read dsiplay when the charge is
bar. This makes for an easier to read display when the charge is
below 50%.
![](widbatpc.full.jpg)
When the fillbar setting is off the level colour will follow the battry percentage
When the fillbar setting is off the level colour will follow the battery percentage
![](widbatpc.part.jpg)

View File

@ -79,20 +79,20 @@
// else...
var s = 39;
var x = this.x, y = this.y;
const l = E.getBattery();
let xl = x+4+l*(s-12)/100;
const l = E.getBattery(),
c = levelColor(l);
// show bar full in the level color, as you cant see the color if the bar is too small
if (setting('fillbar'))
xl = x+4+100*(s-12)/100;
c = levelColor(l);
if (Bangle.isCharging() && setting('charger')) {
g.setColor(chargerColor()).drawImage(atob(
"DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
x+=16;
}
let xl = x+4+l*(s-12)/100;
// show bar full in the level color, as you can't see the color if the bar is too small
if (setting('fillbar'))
xl = x+4+100*(s-12)/100;
g.setColor(g.theme.fg);
g.fillRect(x,y+2,x+s-4,y+21);
g.clearRect(x+2,y+4,x+s-6,y+19);

View File

@ -1,8 +1,52 @@
.navbar { background-color: #5755d9; padding: 0.5em 1em 0.5em 1em; }
.navbar { background-color: #5755d9; padding: 1em 1em 1em 1em; }
.navbar .navbar-brand {
color: #fff;
font-weight: bold;
}
.container.apploader-tab, ul.tab.tab-block {
padding-left: 1rem;
padding-right: 1rem;
border-bottom: 0px;
}
.navbar-brand.mr-2 > img {
margin-left: 0.3rem;
}
.panel-body.columns {
margin: 1px;
}
.tile.column.col-6.col-sm-12.col-xs-12.app-tile {
border: solid 1px #fafafa;
margin: 0;
min-height: 150px;
padding-top: 0.5rem;
}
.tab.tab-block .tab-item {
border-bottom: solid 1px #dadee4;
}
a.mr-2{
display: flex;
align-items: center;
}
.navbar-section > a > div {
margin-left: 0.75rem;
}
.dropdown-container {
margin-bottom: 0.5rem;
margin-top: 0.5rem;
}
a.btn.btn-link.dropdown-toggle {
padding-left: 0.01em;
}
.avatar img {
border-radius: 5px 5px 5px 5px;
background: #fff;

View File

@ -21,8 +21,9 @@
</head>
<body>
<header class="navbar-primary navbar">
<section class="navbar-section">
<a href="https://banglejs.com" target="_blank" class="navbar-brand mr-2"><img src="img/banglejs-logo-sml.png" alt="Bangle.js">&nbsp;&nbsp;App Loader</a>
<section class="navbar-section" >
<a href="https://banglejs.com" target="_blank" class="navbar-brand mr-2" ><img src="img/banglejs-logo-sml.png" alt="Bangle.js">
<div>App Loader</div></a>
<!-- <a href="#" class="btn btn-link">...</a> -->
</section>
<section class="navbar-section">
@ -59,7 +60,7 @@
</div>
<div class="container apploader-tab" id="librarycontainer">
<div>
<div class="dropdown-container">
<div class="dropdown devicetype-nav">
<a href="#" class="btn btn-link dropdown-toggle" tabindex="0">
<span>All apps</span><i class="icon icon-caret"></i>