drained: force off gps/hrm

pull/2684/head
Rob Pilling 2023-04-07 21:27:15 +01:00
parent 39aa8e7e7b
commit a36e705d79
2 changed files with 16 additions and 3 deletions

View File

@ -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)

View File

@ -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();