mirror of https://github.com/espruino/BangleApps
boot +0.29: Update boot0 to avoid code block (faster execution)
+ Fix issues where 'Uncaught Error: Function not found' could happen with multiple .boot.jspull/794/head
parent
97bdf0b7d0
commit
41b3224e3f
|
@ -4,7 +4,7 @@
|
||||||
"tags": "tool,system,b2",
|
"tags": "tool,system,b2",
|
||||||
"type":"bootloader",
|
"type":"bootloader",
|
||||||
"icon": "bootloader.png",
|
"icon": "bootloader.png",
|
||||||
"version":"0.28",
|
"version":"0.29",
|
||||||
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":".boot0","url":"boot0.js"},
|
{"name":".boot0","url":"boot0.js"},
|
||||||
|
|
|
@ -27,3 +27,5 @@
|
||||||
0.26: Remove buzz in setUI polyfill (#750)
|
0.26: Remove buzz in setUI polyfill (#750)
|
||||||
0.27: Update polyfill for most recent changes
|
0.27: Update polyfill for most recent changes
|
||||||
0.28: Fix double clock load after settings are changed
|
0.28: Fix double clock load after settings are changed
|
||||||
|
0.29: Update boot0 to avoid code block (faster execution)
|
||||||
|
Fix issues where 'Uncaught Error: Function not found' could happen with multiple .boot.js
|
||||||
|
|
|
@ -6,7 +6,7 @@ var s = require('Storage').readJSON('setting.json',1)||{};
|
||||||
var isB2 = process.env.HWVERSION; // Is Bangle.js 2
|
var isB2 = process.env.HWVERSION; // Is Bangle.js 2
|
||||||
var boot = "";
|
var boot = "";
|
||||||
var CRC = E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/));
|
var CRC = E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/));
|
||||||
boot += `if (E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/))!=${CRC}) { eval(require('Storage').read('bootupdate.js'));} else {\n`;
|
boot += `if (E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/))!=${CRC}) { eval(require('Storage').read('bootupdate.js')); throw "Storage Updated!"}\n`;
|
||||||
boot += `E.setFlags({pretokenise:1});\n`;
|
boot += `E.setFlags({pretokenise:1});\n`;
|
||||||
if (s.ble!==false) {
|
if (s.ble!==false) {
|
||||||
if (s.HID) { // Human interface device
|
if (s.HID) { // Human interface device
|
||||||
|
@ -133,9 +133,11 @@ else if (mode=="updown") {
|
||||||
}
|
}
|
||||||
// Append *.boot.js files
|
// Append *.boot.js files
|
||||||
require('Storage').list(/\.boot\.js/).forEach(bootFile=>{
|
require('Storage').list(/\.boot\.js/).forEach(bootFile=>{
|
||||||
boot += "//"+bootFile+"\n"+require('Storage').read(bootFile)+"\n";
|
// we add a semicolon so if the file is wrapped in (function(){ ... }()
|
||||||
|
// with no semicolon we don't end up with (function(){ ... }()(function(){ ... }()
|
||||||
|
// which would cause an error!
|
||||||
|
boot += require('Storage').read(bootFile)+";\n";
|
||||||
});
|
});
|
||||||
boot += "}\n";// initial 'if'
|
|
||||||
require('Storage').write('.boot0',boot);
|
require('Storage').write('.boot0',boot);
|
||||||
delete boot;
|
delete boot;
|
||||||
E.showMessage("Reloading...");
|
E.showMessage("Reloading...");
|
||||||
|
|
Loading…
Reference in New Issue