mirror of https://github.com/espruino/BangleApps
drained: force off gps/hrm
parent
39aa8e7e7b
commit
a36e705d79
|
@ -10,12 +10,12 @@ With this app installed, your Bangle will automatically switch into low power mo
|
|||
|
||||
## No backlight (#2502)
|
||||
[x] LCD brightness
|
||||
[ ] LCD timeout
|
||||
[ ] LCD timeout?
|
||||
|
||||
## Peripherals
|
||||
[x] Disable auto heart rate measurement in health app (#2502)
|
||||
[x] Overwrite setGPSPower() function (#2502)
|
||||
[ ] Turn off already-running GPS / HRM
|
||||
[x] Turn off already-running GPS / HRM
|
||||
|
||||
## Features
|
||||
[ ] Wake on twist -> off (#2502)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const app = "drained";
|
||||
|
||||
// from boot.js
|
||||
if(typeof drainedInterval !== "undefined")
|
||||
drainedInterval = clearInterval(drainedInterval) as undefined;
|
||||
|
@ -6,7 +8,18 @@ if(typeof drainedInterval !== "undefined")
|
|||
Bangle.setLCDBrightness(0);
|
||||
|
||||
// peripherals
|
||||
Bangle.setGPSPower = Bangle.setHRMPower = (_val: boolean, _name: string) => false;
|
||||
const powerNoop = () => false;
|
||||
|
||||
const forceOff = (name: "GPS" | "HRM" | "Compass" /*| "Barom"*/) => {
|
||||
(Bangle as any)._PWR[name] = [];
|
||||
|
||||
// if(name === "Barom"){ setBarometerPower(...) }
|
||||
// ^^^^
|
||||
Bangle[`set${name}Power`](false, app);
|
||||
Bangle[`set${name}Power`] = powerNoop;
|
||||
};
|
||||
forceOff("GPS");
|
||||
forceOff("HRM");
|
||||
|
||||
// events
|
||||
Bangle.removeAllListeners();
|
||||
|
|
Loading…
Reference in New Issue