mirror of https://github.com/espruino/BangleApps
Merge remote-tracking branch 'upstream/master' into jekyll-apps.json
commit
9a0b3f07e8
|
@ -2,3 +2,5 @@
|
||||||
0.02: Add support for ZIPs
|
0.02: Add support for ZIPs
|
||||||
Find and download ZIPs direct from the Espruino website
|
Find and download ZIPs direct from the Espruino website
|
||||||
Take 'beta' tag off
|
Take 'beta' tag off
|
||||||
|
0.03: Improve bootloader update safety. Now sets unsafeFlash:1 to allow flash with 2v11 and later
|
||||||
|
Add CRC checks for common bootloaders that we know don't work
|
||||||
|
|
|
@ -60,6 +60,7 @@ function onInit(device) {
|
||||||
document.getElementById("fw-unknown").style = "display:none";
|
document.getElementById("fw-unknown").style = "display:none";
|
||||||
document.getElementById("fw-ok").style = "";
|
document.getElementById("fw-ok").style = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkForFileOnServer() {
|
function checkForFileOnServer() {
|
||||||
|
@ -264,6 +265,8 @@ function createJS_app(binary, startAddress, endAddress) {
|
||||||
bin32[3] = VERSION; // VERSION! Use this to test ourselves
|
bin32[3] = VERSION; // VERSION! Use this to test ourselves
|
||||||
console.log("CRC 0x"+bin32[2].toString(16));
|
console.log("CRC 0x"+bin32[2].toString(16));
|
||||||
hexJS = "";//`\x10if (E.CRC32(E.memoryArea(${startAddress},${endAddress-startAddress}))==${bin32[2]}) { print("FIRMWARE UP TO DATE!"); load();}\n`;
|
hexJS = "";//`\x10if (E.CRC32(E.memoryArea(${startAddress},${endAddress-startAddress}))==${bin32[2]}) { print("FIRMWARE UP TO DATE!"); load();}\n`;
|
||||||
|
hexJS += `\x10if (E.CRC32(E.memoryArea(0xF7000,0x7000))==1339551013) { print("BOOTLOADER 2v10.219 needs update"); load();}\n`;
|
||||||
|
hexJS += `\x10if (E.CRC32(E.memoryArea(0xF7000,0x7000))==1207580954) { print("BOOTLOADER 2v10.236 needs update"); load();}\n`;
|
||||||
hexJS += '\x10var s = require("Storage");\n';
|
hexJS += '\x10var s = require("Storage");\n';
|
||||||
hexJS += '\x10s.erase(".firmware");\n';
|
hexJS += '\x10s.erase(".firmware");\n';
|
||||||
var CHUNKSIZE = 2048;
|
var CHUNKSIZE = 2048;
|
||||||
|
@ -291,20 +294,14 @@ function createJS_bootloader(binary, startAddress, endAddress) {
|
||||||
var chunk = btoa(new Uint8Array(binary.buffer, binary.byteOffset+i, l));
|
var chunk = btoa(new Uint8Array(binary.buffer, binary.byteOffset+i, l));
|
||||||
hexJS += '\x10_fw.set(atob("'+chunk+'"), 0x'+(i).toString(16)+');\n';
|
hexJS += '\x10_fw.set(atob("'+chunk+'"), 0x'+(i).toString(16)+');\n';
|
||||||
}
|
}
|
||||||
// hexJS += `\x10(function() {
|
hexJS += `\x10(function() { if (E.CRC32(_fw)!=${crc}) throw "Invalid CRC: 0x"+E.CRC32(_fw).toString(16);\n`;
|
||||||
// if (E.CRC32(_fw)!=${crc}) throw "Invalid CRC!";
|
hexJS += 'E.showMessage("Flashing Bootloader...")\n';
|
||||||
// var f = require("Flash");
|
hexJS += 'E.setFlags({unsafeFlash:1})\n';
|
||||||
// for (var i=${startAddress};i<${endAddress};i+=4096) f.erasePage(i);
|
hexJS += 'var f = require("Flash");\n';
|
||||||
// f.write(_fw,${startAddress});
|
|
||||||
// E.reboot();
|
|
||||||
// })();\n`;
|
|
||||||
hexJS += `\x10if (E.CRC32(_fw)!=${crc}) throw "Invalid CRC: 0x"+E.CRC32(_fw).toString(16);\n`;
|
|
||||||
hexJS += '\x10var f = require("Flash");\n';
|
|
||||||
for (var i=startAddress;i<endAddress;i+=4096)
|
for (var i=startAddress;i<endAddress;i+=4096)
|
||||||
hexJS += '\x10f.erasePage(0x'+i.toString(16)+');\n';
|
hexJS += 'f.erasePage(0x'+i.toString(16)+');\n';
|
||||||
hexJS += `\x10f.write(_fw,${startAddress});\n`;
|
hexJS += `f.write(_fw,${startAddress});\n`;
|
||||||
// hexJS += '\x10setTimeout(()=>E.showMessage("Rebooting..."),50);\n';
|
hexJS += `})()\n`;
|
||||||
// hexJS += '\x10setTimeout(()=>E.reboot(), 2000);\n';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileLoaded() {
|
function fileLoaded() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "fwupdate",
|
"id": "fwupdate",
|
||||||
"name": "Firmware Update",
|
"name": "Firmware Update",
|
||||||
"version": "0.02",
|
"version": "0.03",
|
||||||
"description": "[BETA] Uploads new Espruino firmwares to Bangle.js 2. For now, please use the instructions under https://www.espruino.com/Bangle.js2#firmware-updates",
|
"description": "[BETA] Uploads new Espruino firmwares to Bangle.js 2. For now, please use the instructions under https://www.espruino.com/Bangle.js2#firmware-updates",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "RAM",
|
"type": "RAM",
|
||||||
|
|
|
@ -4,3 +4,4 @@
|
||||||
0.05: Refactor to use 'layout' library for multi-device support
|
0.05: Refactor to use 'layout' library for multi-device support
|
||||||
0.06: Add number of satellites in view and fix crash with GPS time
|
0.06: Add number of satellites in view and fix crash with GPS time
|
||||||
0.07: Resolve one FIFO_FULL case and exit App with button press
|
0.07: Resolve one FIFO_FULL case and exit App with button press
|
||||||
|
0.08: Leave GPS power switched on on exit (will switch off after 0.5 seconds anyway)
|
||||||
|
|
|
@ -132,9 +132,6 @@ Bangle.on('GPS', onGPS);
|
||||||
Bangle.on('GPS-raw', onGPSraw);
|
Bangle.on('GPS-raw', onGPSraw);
|
||||||
|
|
||||||
function exitApp() {
|
function exitApp() {
|
||||||
Bangle.setGPSPower(0, "app");
|
|
||||||
Bangle.removeListener('GPS-raw', onGPSraw);
|
|
||||||
Bangle.removeListener('GPS', onGPS);
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "gpsinfo",
|
"id": "gpsinfo",
|
||||||
"name": "GPS Info",
|
"name": "GPS Info",
|
||||||
"version": "0.07",
|
"version": "0.08",
|
||||||
"description": "An application that displays information about altitude, lat/lon, satellites and time",
|
"description": "An application that displays information about altitude, lat/lon, satellites and time",
|
||||||
"icon": "gps-info.png",
|
"icon": "gps-info.png",
|
||||||
"type": "app",
|
"type": "app",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
1.00: Release for Bangle 2 (2021/11/18)
|
1.00: Release for Bangle 2 (2021/11/18)
|
||||||
1.01: Internal id update to wid_* as per Gordon's request (2021/11/21)
|
1.01: Internal id update to wid_* as per Gordon's request (2021/11/21)
|
||||||
1.02: Support dark themes
|
1.02: Support dark themes
|
||||||
|
1.03: Increase screen update rate when charging
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "A Battery Widget (with percentage)",
|
"name": "A Battery Widget (with percentage)",
|
||||||
"shortName":"A Battery Widget",
|
"shortName":"A Battery Widget",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"version":"1.02",
|
"version":"1.03",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
"supports": ["BANGLEJS", "BANGLEJS2"],
|
"supports": ["BANGLEJS", "BANGLEJS2"],
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
(function(){
|
(function(){
|
||||||
|
const intervalLow = 60000; // update time when not charging
|
||||||
|
const intervalHigh = 2000; // update time when charging
|
||||||
|
|
||||||
let COLORS = {
|
let COLORS = {
|
||||||
'white': g.theme.dark ? "#000" : "#fff",
|
'white': g.theme.dark ? "#000" : "#fff",
|
||||||
'black': g.theme.dark ? "#fff" : "#000",
|
'black': g.theme.dark ? "#fff" : "#000",
|
||||||
|
@ -36,10 +39,14 @@
|
||||||
g.setFontAlign(0,0);
|
g.setFontAlign(0,0);
|
||||||
g.setFont('6x8');
|
g.setFont('6x8');
|
||||||
g.drawString(l, x + 14, y + 10);
|
g.drawString(l, x + 14, y + 10);
|
||||||
|
|
||||||
|
if (Bangle.isCharging()) changeInterval(id, intervalHigh);
|
||||||
|
else changeInterval(id, intervalLow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Bangle.on('charging',function(charging) { draw(); });
|
Bangle.on('charging',function(charging) { draw(); });
|
||||||
setInterval(()=>WIDGETS["wid_a_battery_widget"].draw(), 60000);
|
var id = setInterval(()=>WIDGETS["wid_a_battery_widget"].draw(), intervalLow);
|
||||||
|
|
||||||
WIDGETS["wid_a_battery_widget"]={area:"tr",width:30,draw:draw};
|
WIDGETS["wid_a_battery_widget"]={area:"tr",width:30,draw:draw};
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -20,3 +20,4 @@
|
||||||
Fix issue with widget overwrite in large font mode
|
Fix issue with widget overwrite in large font mode
|
||||||
Memory usage enhancements
|
Memory usage enhancements
|
||||||
0.20: Fix issue where step count would randomly reset
|
0.20: Fix issue where step count would randomly reset
|
||||||
|
0.21: Memory usage improvements, fix widget initial width (fix #1170)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widpedom",
|
"id": "widpedom",
|
||||||
"name": "Pedometer widget",
|
"name": "Pedometer widget",
|
||||||
"version": "0.20",
|
"version": "0.21",
|
||||||
"description": "Daily pedometer widget",
|
"description": "Daily pedometer widget",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
(() => {
|
(() => {
|
||||||
const PEDOMFILE = "wpedom.json"
|
|
||||||
// Last time Bangle.on('step' was called
|
// Last time Bangle.on('step' was called
|
||||||
let lastUpdate = new Date();
|
let lastUpdate = new Date();
|
||||||
// Last step count when Bangle.on('step' was called
|
// Last step count when Bangle.on('step' was called
|
||||||
|
@ -8,19 +7,14 @@
|
||||||
let settings;
|
let settings;
|
||||||
|
|
||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
const d = require('Storage').readJSON(PEDOMFILE, 1) || {};
|
const d = require('Storage').readJSON("wpedom.json", 1) || {};
|
||||||
settings = d.settings || {};
|
settings = Object.assign({
|
||||||
}
|
|
||||||
|
|
||||||
function setting(key) {
|
|
||||||
if (!settings) { loadSettings() }
|
|
||||||
const DEFAULTS = {
|
|
||||||
'goal': 10000,
|
'goal': 10000,
|
||||||
'progress': false,
|
'progress': false,
|
||||||
'large': false,
|
'large': false,
|
||||||
'hide': false
|
'hide': false
|
||||||
}
|
}, d.settings || {});
|
||||||
return (key in settings) ? settings[key] : DEFAULTS[key];
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bangle.on('step', stepCount => {
|
Bangle.on('step', stepCount => {
|
||||||
|
@ -31,10 +25,10 @@
|
||||||
if (lastUpdate.getDate() == date.getDate()){
|
if (lastUpdate.getDate() == date.getDate()){
|
||||||
stp_today += steps;
|
stp_today += steps;
|
||||||
} else {
|
} else {
|
||||||
// TODO: could save this to PEDOMFILE for lastUpdate's day?
|
// TODO: could save this to "wpedom.json" for lastUpdate's day?
|
||||||
stp_today = steps;
|
stp_today = steps;
|
||||||
}
|
}
|
||||||
if (stp_today === setting('goal')
|
if (stp_today === settings.goal
|
||||||
&& !(require('Storage').readJSON('setting.json',1)||{}).quiet) {
|
&& !(require('Storage').readJSON('setting.json',1)||{}).quiet) {
|
||||||
let b = 3, buzz = () => {
|
let b = 3, buzz = () => {
|
||||||
if (b--) Bangle.buzz().then(() => setTimeout(buzz, 100))
|
if (b--) Bangle.buzz().then(() => setTimeout(buzz, 100))
|
||||||
|
@ -51,29 +45,31 @@
|
||||||
});
|
});
|
||||||
// When unloading, save state
|
// When unloading, save state
|
||||||
E.on('kill', () => {
|
E.on('kill', () => {
|
||||||
if (!settings) { loadSettings() }
|
require("Storage").writeJSON("wpedom.json",{
|
||||||
let d = {
|
|
||||||
lastUpdate : lastUpdate.valueOf(),
|
lastUpdate : lastUpdate.valueOf(),
|
||||||
stepsToday : stp_today,
|
stepsToday : stp_today,
|
||||||
settings : settings,
|
settings : settings,
|
||||||
};
|
});
|
||||||
require("Storage").write(PEDOMFILE,d);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// add your widget
|
// add your widget
|
||||||
WIDGETS["wpedom"]={area:"tl",width:26,
|
WIDGETS["wpedom"]={area:"tl",width:0,
|
||||||
redraw:function() { // work out the width, and queue a full redraw if needed
|
getWidth:function() {
|
||||||
let stps = stp_today.toString();
|
|
||||||
let newWidth = 24;
|
let newWidth = 24;
|
||||||
if (setting('hide'))
|
if (settings.hide)
|
||||||
newWidth = 0;
|
newWidth = 0;
|
||||||
else {
|
else {
|
||||||
if (setting('large')) {
|
if (settings.large) {
|
||||||
newWidth = 12 * stps.length + 3;
|
newWidth = 12 * stps.length + 3;
|
||||||
if (setting('progress'))
|
if (settings.progress)
|
||||||
newWidth += 24;
|
newWidth += 24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return newWidth;
|
||||||
|
},
|
||||||
|
redraw:function() { // work out the width, and queue a full redraw if needed
|
||||||
|
let stps = stp_today.toString();
|
||||||
|
let newWidth = this.getWidth();
|
||||||
if (newWidth!=this.width) {
|
if (newWidth!=this.width) {
|
||||||
// width has changed, re-layout all widgets
|
// width has changed, re-layout all widgets
|
||||||
this.width = newWidth;
|
this.width = newWidth;
|
||||||
|
@ -84,14 +80,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
draw:function() {
|
draw:function() {
|
||||||
if (setting('hide')) return;
|
if (settings.hide) return;
|
||||||
if (stp_today > 99999)
|
if (stp_today > 99999)
|
||||||
stp_today = stp_today % 100000; // cap to five digits + comma = 6 characters
|
stp_today = stp_today % 100000; // cap to five digits + comma = 6 characters
|
||||||
let stps = stp_today.toString();
|
let stps = stp_today.toString();
|
||||||
g.reset().clearRect(this.x, this.y, this.x + this.width, this.y + 23); // erase background
|
g.reset().clearRect(this.x, this.y, this.x + this.width, this.y + 23); // erase background
|
||||||
if (setting('progress')) {
|
if (settings.progress) {
|
||||||
const width = 23, half = 11;
|
const width = 23, half = 11;
|
||||||
const goal = setting('goal'), left = Math.max(goal-stps,0);
|
const goal = settings.goal, left = Math.max(goal-stps,0);
|
||||||
// blue or dark green
|
// blue or dark green
|
||||||
g.setColor(left ? "#08f" : "#080").fillCircle(this.x + half, this.y + half, half);
|
g.setColor(left ? "#08f" : "#080").fillCircle(this.x + half, this.y + half, half);
|
||||||
if (left) {
|
if (left) {
|
||||||
|
@ -113,10 +109,10 @@
|
||||||
}
|
}
|
||||||
g.reset();
|
g.reset();
|
||||||
}
|
}
|
||||||
if (setting('large')) {
|
if (settings.large) {
|
||||||
g.setFont("6x8",2);
|
g.setFont("6x8",2);
|
||||||
g.setFontAlign(-1, 0);
|
g.setFontAlign(-1, 0);
|
||||||
g.drawString(stps, this.x + (setting('progress')?28:4), this.y + 12);
|
g.drawString(stps, this.x + (settings.progress?28:4), this.y + 12);
|
||||||
} else {
|
} else {
|
||||||
let w = 24;
|
let w = 24;
|
||||||
if (stps.length > 3){
|
if (stps.length > 3){
|
||||||
|
@ -137,11 +133,12 @@
|
||||||
getSteps:()=>stp_today
|
getSteps:()=>stp_today
|
||||||
};
|
};
|
||||||
// Load data at startup
|
// Load data at startup
|
||||||
let pedomData = require("Storage").readJSON(PEDOMFILE,1);
|
let pedomData = loadSettings();
|
||||||
if (pedomData) {
|
if (pedomData) {
|
||||||
if (pedomData.lastUpdate)
|
if (pedomData.lastUpdate)
|
||||||
lastUpdate = new Date(pedomData.lastUpdate);
|
lastUpdate = new Date(pedomData.lastUpdate);
|
||||||
stp_today = pedomData.stepsToday|0;
|
stp_today = pedomData.stepsToday|0;
|
||||||
delete pedomData;
|
delete pedomData;
|
||||||
}
|
}
|
||||||
|
WIDGETS["wpedom"].width = WIDGETS["wpedom"].getWidth();
|
||||||
})()
|
})()
|
||||||
|
|
Loading…
Reference in New Issue