2023-03-10 23:20:28 +00:00
|
|
|
"use strict";
|
2023-04-13 17:30:49 +00:00
|
|
|
var _a = require("Storage").readJSON("drained.setting.json", true) || {}, _b = _a.battery, threshold = _b === void 0 ? 5 : _b, _c = _a.interval, interval = _c === void 0 ? 10 : _c, _d = _a.disableBoot, disableBoot = _d === void 0 ? false : _d;
|
2023-04-13 17:05:59 +00:00
|
|
|
drainedInterval = setInterval(function () {
|
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", function (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:26:10 +00:00
|
|
|
}, interval * 60 * 1000);
|