From c7aa2b36553dd6f36fb203e74a8f51ddd7b9426d Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Wed, 19 Apr 2023 18:14:10 +0100 Subject: [PATCH] drained: load self on startup this allows us to then control restoring normal operation --- apps/drained/boot.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/drained/boot.ts b/apps/drained/boot.ts index c269bf08a..4dc885c20 100644 --- a/apps/drained/boot.ts +++ b/apps/drained/boot.ts @@ -8,9 +8,14 @@ drainedInterval = setInterval(() => { if(E.getBattery() > threshold) return; - if(disableBoot) - require("Storage").erase(".boot0"); + const app = "drained.app.js"; - 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); }