mirror of https://github.com/espruino/BangleApps
Add check for widgets that clear the screen!
Remove clear of the screen on reload (will break currently running app)pull/3629/head
parent
a4f5978fb6
commit
f0c9ae183c
|
@ -1,2 +1,3 @@
|
|||
0.01: New app!
|
||||
0.02: Minor code improvements
|
||||
0.03: Remove clearing of the screen (will break running apps) and fix lint errors
|
|
@ -2,8 +2,8 @@
|
|||
"id": "banglebridge",
|
||||
"name": "BangleBridge",
|
||||
"shortName": "BangleBridge",
|
||||
"version": "0.02",
|
||||
"description": "Widget that allows Bangle Js to record pair and end data using Bluetooth Low Energy in combination with the BangleBridge Android App",
|
||||
"version": "0.03",
|
||||
"description": "Widget that allows Bangle.js to record pair and end data using Bluetooth Low Energy in combination with the BangleBridge Android App (**Note:** this has nothing to do with Gadgetbridge)",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
"tags": "widget",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
(() => {
|
||||
/**
|
||||
* Widget measurements
|
||||
* Description:
|
||||
* Description:
|
||||
* name: connection.wid.js
|
||||
*icon: conectionIcon.icon
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
//Font
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
//Sensors code
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Jorge
|
||||
*/
|
||||
function accel() {
|
||||
|
@ -35,8 +35,7 @@
|
|||
});
|
||||
|
||||
setInterval(function () {
|
||||
|
||||
acclS = accelN.x + "##" + accelN.y + "##" + accelN.z + "\n" + accelN.diff + "##" + accelN.mag;
|
||||
//acclS = accelN.x + "##" + accelN.y + "##" + accelN.z + "\n" + accelN.diff + "##" + accelN.mag;
|
||||
data[3] = accelN;
|
||||
}, 2 * 1000);
|
||||
|
||||
|
@ -45,8 +44,7 @@
|
|||
function btt() {
|
||||
|
||||
setInterval(function () {
|
||||
|
||||
bttS = E.getBattery(); //return String
|
||||
//bttS = E.getBattery(); //return String
|
||||
data[2] = E.getBattery();
|
||||
}, 15 * 1000);
|
||||
|
||||
|
@ -65,9 +63,9 @@
|
|||
|
||||
setInterval(function () {
|
||||
|
||||
compssS = "A: " + compssN.x + " ## " + compssN.y + " ## " + compssN.z + "\n" +
|
||||
/*compssS = "A: " + compssN.x + " ## " + compssN.y + " ## " + compssN.z + "\n" +
|
||||
"B: " + compssN.dx + " ## " + compssN.dy + " ## " + compssN.dz + " ## " + "\n" +
|
||||
"C: " + compssN.heading; //return String
|
||||
"C: " + compssN.heading; *///return String
|
||||
data[4] = compssN;
|
||||
}, 2 * 1000);
|
||||
|
||||
|
@ -86,8 +84,8 @@
|
|||
|
||||
setInterval(function () {
|
||||
|
||||
gpsS = "A: " + gpsN.lat + " ## " + gpsN.lon + " ## " + gpsN.alt + "\n" + "B: " + gpsN.speed + " ## " + gpsN.course + " ## " + gpsN.time + "\n" +
|
||||
"C: " + gpsN.satellites + " ## " + gpsN.fix; //return String
|
||||
/*gpsS = "A: " + gpsN.lat + " ## " + gpsN.lon + " ## " + gpsN.alt + "\n" + "B: " + gpsN.speed + " ## " + gpsN.course + " ## " + gpsN.time + "\n" +
|
||||
"C: " + gpsN.satellites + " ## " + gpsN.fix; *///return String
|
||||
// work out how to display the current time
|
||||
var d = new Date();
|
||||
var year = d.getFullYear();
|
||||
|
@ -150,7 +148,7 @@
|
|||
//console.log("Index ==> "+ index);
|
||||
msr[indexFinal] = nueva;
|
||||
|
||||
item = nueva;
|
||||
//item = nueva;
|
||||
lastInsert = indexFinal;
|
||||
|
||||
}
|
||||
|
@ -180,7 +178,7 @@
|
|||
|
||||
hrmN = normalize(hrmN);
|
||||
var roundedRate = parseFloat(hrmN).toFixed(2);
|
||||
hrmS = String.valueOf(roundedRate); //return String
|
||||
//hrmS = String.valueOf(roundedRate); //return String
|
||||
//console.log("array----->" + msr);
|
||||
data[0] = roundedRate;
|
||||
|
||||
|
@ -205,7 +203,7 @@
|
|||
|
||||
setInterval(function () {
|
||||
|
||||
stepS = String.valueOf(stepN); //return String
|
||||
//stepS = String.valueOf(stepN); //return String
|
||||
data[1] = stepN;
|
||||
}, 2 * 1000);
|
||||
|
||||
|
@ -240,12 +238,11 @@
|
|||
g.setFont("Vector", 45);
|
||||
g.drawString(prueba,100,200);*/
|
||||
if (flip == 1) { //when off
|
||||
|
||||
|
||||
flip = 0;
|
||||
//Bangle.buzz(1000);
|
||||
g.clear();
|
||||
} else { //when on
|
||||
|
||||
|
||||
flip = 1;
|
||||
g.setFont("Vector", 30);
|
||||
g.drawString(data[0], 65, 180);
|
||||
|
@ -283,7 +280,7 @@
|
|||
com: data[4],
|
||||
gps: data[5]
|
||||
};
|
||||
/* g.clear();
|
||||
/*
|
||||
g.drawString(compssS,100,200);
|
||||
*/
|
||||
|
||||
|
@ -293,7 +290,7 @@
|
|||
//draw();
|
||||
|
||||
}, 5 * 1000);
|
||||
|
||||
|
||||
WIDGETS["banglebridge"]={
|
||||
area: "tl",
|
||||
width: 10,
|
||||
|
|
|
@ -515,12 +515,6 @@ module.exports = {
|
|||
"no-undef"
|
||||
]
|
||||
},
|
||||
"apps/widbt_notify/widget.js": {
|
||||
"hash": "16372ffcbc6bd1419ca326c7da40c2195f82a4bfceb6f123c15872624c4f0adf",
|
||||
"rules": [
|
||||
"no-undef"
|
||||
]
|
||||
},
|
||||
"apps/widbgjs/widget.js": {
|
||||
"hash": "9852ce9aafb0a1ca3029d497282c8cdf07438ea36a3323313bad5b7569b1081b",
|
||||
"rules": [
|
||||
|
@ -1157,12 +1151,6 @@ module.exports = {
|
|||
"no-undef"
|
||||
]
|
||||
},
|
||||
"apps/banglebridge/widget.js": {
|
||||
"hash": "4ee8d6749e1d0e28c58ad871fd9f6ccbca2d716bb4fbd3511ba4c34a6a5897e1",
|
||||
"rules": [
|
||||
"no-undef"
|
||||
]
|
||||
},
|
||||
"apps/bad/bad.app.js": {
|
||||
"hash": "d1354613102818190dd4e6e28fd715db7dc4d51b8e618cae61a3135529cc97eb",
|
||||
"rules": [
|
||||
|
|
|
@ -17,3 +17,4 @@
|
|||
Add option to disable vibration when charger connects
|
||||
0.18: Only redraw when values change
|
||||
0.19: Match draw() API e.g. to allow wid_edit to alter this widget
|
||||
0.20: Remove clear of the screen on reload (will break currently running app)
|
|
@ -2,7 +2,7 @@
|
|||
"id": "widbatpc",
|
||||
"name": "Battery Level Widget (with percentage)",
|
||||
"shortName": "Battery Widget",
|
||||
"version": "0.19",
|
||||
"version": "0.20",
|
||||
"description": "Show the current battery level and charging status in the top right of the clock, with charge percentage",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
@ -156,7 +156,6 @@
|
|||
// need to redraw all widgets, because changing the "charger" setting
|
||||
// can affect the width and mess with the whole widget layout
|
||||
setWidth();
|
||||
g.clear();
|
||||
Bangle.drawWidgets();
|
||||
}
|
||||
|
||||
|
|
|
@ -348,11 +348,17 @@ apps.forEach((app,appIdx) => {
|
|||
}
|
||||
}
|
||||
// something that needs to be evaluated with 'eval(require("Storage").read(fn))'
|
||||
if (/\.clkinfo?\.js$/.test(file.name) ||
|
||||
/\.settings?\.js$/.test(file.name)) {
|
||||
if (/\.clkinfo\.js$/.test(file.name) ||
|
||||
/\.settings\.js$/.test(file.name)) {
|
||||
if (!fileContents.trim().endsWith(")"))
|
||||
WARN(`App ${app.id} file ${file.name} should be evaluated as a function but doesn't end in ')'`, {file:appDirRelative+file.url});
|
||||
}
|
||||
if (/\.clkinfo\.js$/.test(file.name) ||
|
||||
/\.wid\.js$/.test(file.name)) {
|
||||
if (fileContents.indexOf("g.clear(")>=0 ||
|
||||
fileContents.indexOf("g.reset().clear()")>=0)
|
||||
ERROR(`App ${app.id} widget/clkinfo ${file.name} should never totally clear the screen`, {file:appDirRelative+file.url});
|
||||
}
|
||||
}
|
||||
for (const key in file) {
|
||||
if (!STORAGE_KEYS.includes(key)) ERROR(`App ${app.id} file ${file.name} has unknown key ${key}`, {file:appDirRelative+file.url});
|
||||
|
|
Loading…
Reference in New Issue