!7 cmodule AlarmOnPowerLoss > DynPrintLogAndEnabled { switchable bool setOff; switchable S mp3SnippetID = #1001093; start-thread { if (!enabled) ret; if (setOff) print("Already set off. Reset in menu"); print("Setting live in 10..."); doWithSleep(10.0, r { loadLibrary(mp3SnippetID) }); if (!enabled) ret; doEvery(1.0, r check); } void check enter { if (enabled && !setOff && linux_batteryDischarging()) setOff(); } void setOff { setField(setOff := true); playMP3(loadLibrary(mp3SnippetID)); } }