drained: load self on startup

this allows us to then control restoring normal operation
master
Rob Pilling 2023-04-19 18:14:10 +01:00
parent a28891e6df
commit c7aa2b3655
1 changed files with 8 additions and 3 deletions

View File

@ -8,9 +8,14 @@ drainedInterval = setInterval(() => {
if(E.getBattery() > threshold) if(E.getBattery() > threshold)
return; return;
if(disableBoot) const app = "drained.app.js";
require("Storage").erase(".boot0");
load("drained.app.js"); if(disableBoot)
require("Storage").write(
".boot0",
`if(typeof __FILE__ === "undefined" || __FILE__ !== "${app}") setTimeout(load, 100, "${app}");`
);
load(app);
}, interval * 60 * 1000); }, interval * 60 * 1000);
} }