Merge remote-tracking branch 'upstream/master'

pull/1710/head
Danny 2022-02-18 13:20:16 +01:00
commit 26320aadfe
23 changed files with 223 additions and 49 deletions

View File

@ -2,3 +2,4 @@ apps/animclk/V29.LBM.js
apps/banglerun/rollup.config.js
apps/schoolCalendar/fullcalendar/main.js
apps/authentiwatch/qr_packed.js
*.test.js

1
apps/info/ChangeLog Normal file
View File

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

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

@ -0,0 +1,17 @@
# Info
A very simple app that shows information on 3 different screens.
Go to the next screen via tab right, go to the previous screen
via tab left and reload the data via tab in the middle of the
screen. Very useful if combined with pattern launcher ;)
![](screenshot_1.png)
![](screenshot_2.png)
![](screenshot_2.png)
## Contributors
- [David Peer](https://github.com/peerdavid).
## Thanks To
<a href="https://www.flaticon.com/free-icons/info" title="info icons">Info icons created by Freepik - Flaticon</a>

108
apps/info/info.app.js Normal file
View File

@ -0,0 +1,108 @@
var s = require("Storage");
const locale = require('locale');
var ENV = process.env;
var W = g.getWidth(), H = g.getHeight();
var screen = 0;
const maxScreen = 2;
function getVersion(file) {
var j = s.readJSON(file,1);
var v = ("object"==typeof j)?j.version:false;
return v?((v?"v"+v:"Unknown")):"NO ";
}
function drawData(name, value, y){
g.drawString(name, 5, y);
g.drawString(value, 100, y);
}
function getSteps(){
try{
return Bangle.getHealthStatus("day").steps;
} catch(e) {
return ">= 2v12";
}
}
function getBpm(){
try{
return Math.round(Bangle.getHealthStatus("day").bpm) + "bpm";
} catch(e) {
return ">= 2v12";
}
}
function drawInfo() {
g.reset().clearRect(Bangle.appRect);
var h=18, y = h;//-h;
// Header
g.setFont("Vector", h+2).setFontAlign(0,-1);
g.drawString("--==|| INFO ||==--", W/2, 0);
g.setFont("Vector",h).setFontAlign(-1,-1);
// Dynamic data
if(screen == 0){
drawData("Steps", getSteps(), y+=h);
drawData("HRM", getBpm(), y+=h);
drawData("Battery", E.getBattery() + "%", y+=h);
drawData("Voltage", E.getAnalogVRef().toFixed(2) + "V", y+=h);
drawData("IntTemp.", locale.temp(parseInt(E.getTemperature())), y+=h);
}
if(screen == 1){
drawData("Charging?", Bangle.isCharging() ? "Yes" : "No", y+=h);
drawData("Bluetooth", NRF.getSecurityStatus().connected ? "Conn." : "Disconn.", y+=h);
drawData("GPS", Bangle.isGPSOn() ? "On" : "Off", y+=h);
drawData("Compass", Bangle.isCompassOn() ? "On" : "Off", y+=h);
drawData("HRM", Bangle.isHRMOn() ? "On" : "Off", y+=h);
}
// Static data
if(screen == 2){
drawData("Firmw.", ENV.VERSION, y+=h);
drawData("Boot.", getVersion("boot.info"), y+=h);
drawData("Settings", getVersion("setting.info"), y+=h);
drawData("Storage", "", y+=h);
drawData(" Total", ENV.STORAGE>>10, y+=h);
drawData(" Free", require("Storage").getFree()>>10, y+=h);
}
if(Bangle.isLocked()){
g.setFont("Vector",h-2).setFontAlign(-1,-1);
g.drawString("Locked", 0, H-h+2);
}
g.setFont("Vector",h-2).setFontAlign(1,-1);
g.drawString((screen+1) + "/3", W, H-h+2);
}
drawInfo();
setWatch(_=>load(), BTN1);
Bangle.on('touch', function(btn, e){
var left = parseInt(g.getWidth() * 0.3);
var right = g.getWidth() - left;
var isLeft = e.x < left;
var isRight = e.x > right;
if(isRight){
screen = (screen + 1) % (maxScreen+1);
}
if(isLeft){
screen -= 1;
screen = screen < 0 ? maxScreen : screen;
}
drawInfo();
});
Bangle.on('lock', function(isLocked) {
drawInfo();
});
Bangle.loadWidgets();
for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";}
// Bangle.drawWidgets();

1
apps/info/info.icon.js Normal file
View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwcBkmSpICDBwcJBYwCDpAhFggRJGg8SCI+ABgU//gSDCI4JBj//AAX4JRAIBg4QDAAPgBIJWGgIQFAAI+BLglAgEPCI/wEgJoEgYQHAAPANwhWFAApcBCIWQgAQJAAMAgSMDCJiSCwB6GQA6eCn5TFL4q5BUgIRF/wuBv4RGkCeGO4IREUgMBCJCVGCISwIWw0BYRLIICLBHHCJRrGCIQIFR44I5LIoRaPpARcdIwRJfYMBCJuACKUkgE/a5f8gEJCJD7FCIeAg78FAAvggFJCIMACJZOBCIOQCJsCCIOSgEfCBP4gESCIZTFOIwRDoDIGaguSCIVIgCkFTwcAggRDpIYBQAx6BgAOCAQYIBLghWBTwQRFFgIABXIIFDBwgCDBYQAENAYCFLgIAEKwpKIIhA="))

BIN
apps/info/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

19
apps/info/metadata.json Normal file
View File

@ -0,0 +1,19 @@
{
"id": "info",
"name": "Info",
"version": "0.01",
"description": "An application that displays information such as battery level, steps etc.",
"icon": "info.png",
"type": "app",
"tags": "tool",
"readme": "README.md",
"supports": ["BANGLEJS2"],
"screenshots": [
{"url":"screenshot_1.png"},
{"url":"screenshot_2.png"},
{"url":"screenshot_3.png"}],
"storage": [
{"name":"info.app.js","url":"info.app.js"},
{"name":"info.img","url":"info.icon.js","evaluate":true}
]
}

BIN
apps/info/screenshot_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
apps/info/screenshot_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
apps/info/screenshot_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1 +1,2 @@
0.01: Initial release
0.02: Optional fullscreen mode

View File

@ -4,8 +4,8 @@
|---------------------------------|--------------------------------------|
| <center>Neon X</center> | <center>Neon IO X</center> |
This is a clock based on Pebble's Neon X and Neon IO X watchfaces by Sam Jerichow.
Can be switched between in the Settings menu, which can be accessed through
This is a clock based on Pebble's Neon X and Neon IO X watchfaces by Sam Jerichow.
Can be switched between in the Settings menu, which can be accessed through
the app/widget settings menu of the Bangle.js
## Settings
@ -14,7 +14,11 @@ the app/widget settings menu of the Bangle.js
Activate the Neon IO X clock look, a bit hard to read until one gets used to it.
### Thickness
The thickness of watch lines, from 1 to 5.
The thickness of watch lines, from 1 to 6.
### Date on touch
Shows the current date as DD MM on touch and reverts back to time after 5 seconds or with another touch.
### Fullscreen
Shows the watchface in fullscreen mode.
Note: In fullscreen mode, widgets are hidden, but still loaded.

View File

@ -2,7 +2,7 @@
"id": "neonx",
"name": "Neon X & IO X Clock",
"shortName": "Neon X Clock",
"version": "0.01",
"version": "0.02",
"description": "Pebble Neon X & Neon IO X for Bangle.js",
"icon": "neonx.png",
"type": "clock",

View File

@ -34,6 +34,7 @@ const colors = {
const is12hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]||false;
const screenWidth = g.getWidth();
const screenHeight = g.getHeight();
const halfWidth = screenWidth / 2;
const scale = screenWidth / 240;
const REFRESH_RATE = 10E3;
@ -58,16 +59,19 @@ function drawLine(poly, thickness){
}
}
let settings = require('Storage').readJSON('neonx.json', 1);
if (!settings) {
settings = {
thickness: 4,
io: 0,
showDate: 1
};
let settings = {
thickness: 4,
io: 0,
showDate: 1,
fullscreen: false,
};
let saved_settings = require('Storage').readJSON('neonx.json', 1) || settings;
for (const key in saved_settings) {
settings[key] = saved_settings[key]
}
function drawClock(num){
let tx, ty;
@ -79,13 +83,15 @@ function drawClock(num){
g.setColor(colors[settings.io ? 'io' : 'x'][y][x]);
if (!settings.io) {
tx = (x * 100 + 18) * newScale;
ty = (y * 100 + 32) * newScale;
newScale *= settings.fullscreen ? 1.18 : 1.0;
let dx = settings.fullscreen ? 0 : 18
tx = (x * 100 + dx) * newScale;
ty = (y * 100 + dx*2) * newScale;
} else {
newScale = 0.33 + current * 0.4;
newScale = 0.33 + current * (settings.fullscreen ? 0.48 : 0.4);
tx = (halfWidth - 139) * newScale + halfWidth;
ty = (halfWidth - 139) * newScale + halfWidth + 12;
tx = (halfWidth - 139) * newScale + halfWidth + (settings.fullscreen ? 2 : 0);
ty = (halfWidth - 139) * newScale + halfWidth + (settings.fullscreen ? 2 : 12);
}
for (let i = 0; i < digits[num[y][x]].length; i++) {
@ -116,7 +122,11 @@ function draw(date){
l2 = ('0' + d.getMinutes()).substr(-2);
}
g.clearRect(0,24,240,240);
if(settings.fullscreen){
g.clearRect(0,0,screenWidth,screenHeight);
} else {
g.clearRect(0,24,240,240);
}
drawClock([l1, l2]);
}
@ -150,4 +160,9 @@ Bangle.on('lcdPower', function(on){
});
Bangle.loadWidgets();
Bangle.drawWidgets();
if(settings.fullscreen){
for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";}
} else {
Bangle.drawWidgets();
}

View File

@ -7,7 +7,8 @@
neonXSettings = {
thickness: 4,
io: 0,
showDate: 1
showDate: 1,
fullscreen: false,
};
updateSettings();
@ -17,7 +18,7 @@
if (!neonXSettings) resetSettings();
let thicknesses = [1, 2, 3, 4, 5];
let thicknesses = [1, 2, 3, 4, 5, 6];
const menu = {
"" : { "title":"Neon X & IO"},
@ -48,7 +49,15 @@
neonXSettings.showDate = v;
updateSettings();
}
}
},
'Fullscreen': {
value: false | neonXSettings.fullscreen,
format: () => (neonXSettings.fullscreen ? 'Yes' : 'No'),
onchange: () => {
neonXSettings.fullscreen = !neonXSettings.fullscreen;
updateSettings();
},
},
};
E.showMenu(menu);
})

View File

@ -16,3 +16,4 @@
0.14: incorporated lazybones idle timer, configuration settings to come
0.15: fixed tendancy for mylocation to default to London
added setting to enable/disable idle timer warning
0.16: make check_idle boolean setting work properly with new B2 menu

View File

@ -2,7 +2,7 @@
"id": "pastel",
"name": "Pastel Clock",
"shortName": "Pastel",
"version": "0.15",
"version": "0.16",
"description": "A Configurable clock with custom fonts, background and weather display. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times",
"icon": "pastel.png",
"dependencies": {"mylocation":"app","weather":"app"},

View File

@ -38,38 +38,28 @@
},
},
'Show Grid': {
value: s.grid,
format: () => (s.grid ? 'Yes' : 'No'),
onchange: () => {
s.grid = !s.grid;
value: !!s.grid,
format: v => v ? /*LANG*/"Yes":/*LANG*/"No",
onchange: v => {
s.grid = v;
save();
},
},
'Show Weather': {
value: s.weather,
format: () => (s.weather ? 'Yes' : 'No'),
onchange: () => {
s.weather = !s.weather;
value: !!s.weather,
format: v => v ? /*LANG*/"Yes":/*LANG*/"No",
onchange: v => {
s.weather = v;
save();
},
},
// for use when the new menu system goes live
/*
'Idle Warning': {
value: s.idle_check,
onchange : v => {
value: !!s.idle_check,
format: v => v ? /*LANG*/"Yes":/*LANG*/"No",
onchange: v => {
s.idle_check = v;
save();
},
},
*/
'Idle Warning': {
value: s.idle_check,
format: () => (s.idle_check ? 'Yes' : 'No'),
onchange: () => {
s.idle_check = !s.idle_check;
save();
},
}
})
})

View File

@ -1 +1,3 @@
0.01: New Widget!
0.02: Battery bar turns yellow on charge
Memory status bar does not trigger garbage collect

View File

@ -1,7 +1,7 @@
{
"id": "widbars",
"name": "Bars Widget",
"version": "0.01",
"version": "0.02",
"description": "Display several measurements as vertical bars.",
"icon": "icon.png",
"screenshots": [{"url":"screenshot.png"}],

View File

@ -42,19 +42,25 @@
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
}
let batColor='#0f0';
function draw() {
g.reset();
const x = this.x, y = this.y,
m = process.memory();
m = process.memory(false);
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);
bar(x+(w*b++),y,batColor,E.getBattery()/100);
}
let redraw;
Bangle.on('charging', function(charging) {
batColor=charging?'#ff0':'#0f0';
WIDGETS["bars"].draw();
});
Bangle.on('lcdPower', on => {
if (redraw) clearInterval(redraw)
redraw = undefined;

2
core

@ -1 +1 @@
Subproject commit bf29f5697445686255a785476e6b1ed6a13ff697
Subproject commit a7a80a13fa187a4ff5f89669992babca2d95812c

View File

@ -202,7 +202,6 @@ window.addEventListener('load', (event) => {
}
var selectLang = document.getElementById("settings-lang");
console.log(languages);
languages.forEach(lang => {
selectLang.innerHTML += `<option value="${lang.code}" ${SETTINGS.language==lang.code?"selected":""}>${lang.name} (${lang.code})</option>`;
});