forked from FOSS/BangleApps
Merge pull request #3369 from bobrippling/feat/drained-menu-enhance
drained: change enable/disable BLE depending on statemaster
commit
d2b1487315
|
@ -3,3 +3,4 @@
|
|||
0.03: Permit exceptions to load in low-power mode, e.g. daylight saving time.
|
||||
Also avoid polluting global scope.
|
||||
0.04: Enhance menu: enable bluetooth, visit settings & visit recovery
|
||||
0.05: Enhance menu: permit toggling bluetooth
|
||||
|
|
|
@ -53,6 +53,21 @@ var draw = function () {
|
|||
}, 60000 - (date.getTime() % 60000));
|
||||
};
|
||||
var reload = function () {
|
||||
var showMenu = function () {
|
||||
var menu = {
|
||||
"Restore to full power": drainedRestore,
|
||||
};
|
||||
if (NRF.getSecurityStatus().advertising)
|
||||
menu["Disable BLE"] = function () { NRF.sleep(); showMenu(); };
|
||||
else
|
||||
menu["Enable BLE"] = function () { NRF.wake(); showMenu(); };
|
||||
menu["Settings"] = function () { return load("setting.app.js"); };
|
||||
menu["Recovery"] = function () { return Bangle.showRecoveryMenu(); };
|
||||
menu["Exit menu"] = reload;
|
||||
if (nextDraw)
|
||||
clearTimeout(nextDraw);
|
||||
E.showMenu(menu);
|
||||
};
|
||||
Bangle.setUI({
|
||||
mode: "custom",
|
||||
remove: function () {
|
||||
|
@ -60,15 +75,7 @@ var reload = function () {
|
|||
clearTimeout(nextDraw);
|
||||
nextDraw = undefined;
|
||||
},
|
||||
btn: function () {
|
||||
var menu = {
|
||||
"Restore to full power": drainedRestore,
|
||||
"Enable BLE": function () { return NRF.wake(); },
|
||||
"Settings": function () { return load("setting.app.js"); },
|
||||
"Recovery": function () { return Bangle.showRecoveryMenu(); },
|
||||
};
|
||||
E.showMenu(menu);
|
||||
}
|
||||
btn: showMenu
|
||||
});
|
||||
Bangle.CLOCK = 1;
|
||||
g.clear();
|
||||
|
|
|
@ -72,21 +72,31 @@ const draw = () => {
|
|||
};
|
||||
|
||||
const reload = () => {
|
||||
const showMenu = () => {
|
||||
const menu: { [k: string]: () => void } = {
|
||||
"Restore to full power": drainedRestore,
|
||||
};
|
||||
|
||||
if (NRF.getSecurityStatus().advertising)
|
||||
menu["Disable BLE"] = () => { NRF.sleep(); showMenu(); };
|
||||
else
|
||||
menu["Enable BLE"] = () => { NRF.wake(); showMenu(); };
|
||||
|
||||
menu["Settings"] = () => load("setting.app.js");
|
||||
menu["Recovery"] = () => Bangle.showRecoveryMenu();
|
||||
menu["Exit menu"] = reload;
|
||||
|
||||
if(nextDraw) clearTimeout(nextDraw);
|
||||
E.showMenu(menu);
|
||||
};
|
||||
|
||||
Bangle.setUI({
|
||||
mode: "custom",
|
||||
remove: () => {
|
||||
if (nextDraw) clearTimeout(nextDraw);
|
||||
nextDraw = undefined;
|
||||
},
|
||||
btn: () => {
|
||||
const menu = {
|
||||
"Restore to full power": drainedRestore,
|
||||
"Enable BLE": () => NRF.wake(),
|
||||
"Settings": () => load("setting.app.js"),
|
||||
"Recovery": () => Bangle.showRecoveryMenu(),
|
||||
};
|
||||
E.showMenu(menu);
|
||||
}
|
||||
btn: showMenu
|
||||
});
|
||||
Bangle.CLOCK=1;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "drained",
|
||||
"name": "Drained",
|
||||
"version": "0.04",
|
||||
"version": "0.05",
|
||||
"description": "Switches to displaying a simple clock when the battery percentage is low, and disables some peripherals",
|
||||
"readme": "README.md",
|
||||
"icon": "icon.png",
|
||||
|
|
Loading…
Reference in New Issue