Skip to content

Commit

Permalink
Squeeze a few more bytes out for Bangle.js 1
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jan 8, 2024
1 parent e99e295 commit f37bb94
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libs/banglejs/jswrap_bangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -5621,6 +5621,12 @@ Show a 'recovery' menu that allows you to perform certain tasks on your Bangle.
You can also enter this menu by restarting your Bangle while holding down the button.
*/
/*JSON{
"type" : "staticmethod", "class" : "Bangle", "name" : "showRecoveryMenu", "patch":true,
"generate_js" : "libs/js/banglejs/Bangle_showRecoveryMenu_F18.min.js",
"#if" : "defined(BANGLEJS) && defined(BANGLEJS_F18)"
}
*/

/*JSON{
"type" : "staticmethod",
Expand Down
52 changes: 52 additions & 0 deletions libs/js/banglejs/Bangle_showRecoveryMenu_F18.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
(function() {
Bangle.setUI();
clearTimeout();
clearInterval();
clearWatch();
Bangle.removeAllListeners();
E.removeAllListeners();
NRF.removeAllListeners();
Bangle.setLCDBrightness(1);
E.showMenu({"":{title:"Recovery"},
"Clean Boot": () => {
reset();
},
"Reboot": () => {
E.reboot();
},
"Turn Off": () => {
Bangle.off();
},
"Factory Reset": () => {
E.showPrompt("Are you sure?\nThis will remove all data.",{title:"Factory Reset"}).then(ok => {
if (!ok) return Bangle.showRecoveryMenu();
E.showMessage("Resetting");
Bangle.setLCDTimeout(0);
if(!NRF.getSecurityStatus().connected)
Terminal.setConsole();
Bangle.factoryReset();
});
},
"Exit": () => {
if (require("Storage").list().length>0) {
E.showMessage("Loading...");
if(!NRF.getSecurityStatus().connected)
Terminal.setConsole();
load();
} else {
E.reboot();
}
},
"Attempt Compact": () => {
E.showMessage("Compacting...\nMay take\n5 min.");
if(!NRF.getSecurityStatus().connected)
Terminal.setConsole();
require("Storage").compact();
E.reboot();
},
"Rewrite Bootloader": () => {
setTimeout(load,1000);
eval(require("Storage").read("bootupdate.js"));
},
});
})
2 changes: 2 additions & 0 deletions libs/js/banglejs/Bangle_showRecoveryMenu_F18.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions libs/js/update_js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ node ../../../EspruinoDocs/bin/minify.js banglejs/Bangle_showClock.js banglejs/B
node ../../../EspruinoDocs/bin/minify.js banglejs/Bangle_load.js banglejs/Bangle_load.min.js
node ../../../EspruinoDocs/bin/minify.js banglejs/Bangle_setUI_F18.js banglejs/Bangle_setUI_F18.min.js
node ../../../EspruinoDocs/bin/minify.js banglejs/Bangle_setUI_Q3.js banglejs/Bangle_setUI_Q3.min.js
node ../../../EspruinoDocs/bin/minify.js banglejs/Bangle_showRecoveryMenu_F18.js banglejs/Bangle_showRecoveryMenu_F18.min.js
node ../../../EspruinoDocs/bin/minify.js banglejs/locale.js banglejs/locale.min.js

node ../../../EspruinoDocs/bin/minify.js dickens/Bangle_setUI_DICKENS.js dickens/Bangle_setUI_DICKENS.min.js
Expand Down

0 comments on commit f37bb94

Please sign in to comment.