2023-04-13 17:30:49 +00:00
|
|
|
const { battery: threshold = 5, interval = 10, disableBoot = false }: DrainedSettings
|
2023-04-13 16:51:23 +00:00
|
|
|
= require("Storage").readJSON(`drained.setting.json`, true) || {};
|
2023-04-08 07:25:27 +00:00
|
|
|
|
2023-04-13 16:51:23 +00:00
|
|
|
drainedInterval = setInterval(() => {
|
2023-03-10 23:20:28 +00:00
|
|
|
if(Bangle.isCharging())
|
|
|
|
return;
|
2023-04-13 17:30:49 +00:00
|
|
|
if(E.getBattery() > threshold)
|
2023-03-10 23:20:28 +00:00
|
|
|
return;
|
|
|
|
|
2023-04-13 17:30:49 +00:00
|
|
|
if(disableBoot){
|
|
|
|
require("Storage").erase(".boot0");
|
|
|
|
|
|
|
|
Bangle.on("charging", charging => {
|
|
|
|
if (charging)
|
|
|
|
eval(require('Storage').read('bootupdate.js'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-04-07 16:52:54 +00:00
|
|
|
load("drained.app.js");
|
2023-04-08 07:25:27 +00:00
|
|
|
}, interval * 60 * 1000);
|