From 04e14d0ff26240c756be6e190690dab1cabe3bee Mon Sep 17 00:00:00 2001 From: Beormund <75735592+Beormund@users.noreply.github.com> Date: Mon, 31 Jan 2022 18:55:05 +0000 Subject: [PATCH] Added antiburn module An LCD/OLED anti-screenburn feature. To use: * copy Antiburn.tapp to file system * Either issue Tasmota command antiburn or * Programmatically using lv.antiburn() The lvgl screen will change form black to red to green to blue to white each second for 30 seconds. The antiburn cleaning can be cancelled by touching the screen or it will complete after 30 seconds. --- tasmota/berry/modules/Antiburn.tapp | Bin 0 -> 2104 bytes tasmota/berry/modules/antiburn/antiburn.be | 52 +++++++++++++++++++++ tasmota/berry/modules/antiburn/autoexec.be | 20 ++++++++ 3 files changed, 72 insertions(+) create mode 100644 tasmota/berry/modules/Antiburn.tapp create mode 100644 tasmota/berry/modules/antiburn/antiburn.be create mode 100644 tasmota/berry/modules/antiburn/autoexec.be diff --git a/tasmota/berry/modules/Antiburn.tapp b/tasmota/berry/modules/Antiburn.tapp new file mode 100644 index 0000000000000000000000000000000000000000..19e043e5cd297a96697b922352a1c24a83421255 GIT binary patch literal 2104 zcmZ`)O>fgM7|yfzDt6ZP1l;)* zz=ackh7%G$1C1l^8^>8bimN2<>*xJ^{My~4rDfZ~@x6c0dw=WQ@AC!A!e`C8W6@N_ zY|4DM&rW;St)=~+m-ODROPWsCtcB%2fLgu*s+;7P4Y^b-A!@{kA4d@t0cjly#rtU@ zTJ|P+83$>|NEp+A1%wL{u_#VvBo^U}Oh!ypRJkMro=8Pf$pYKHpb41-WREB+qgYXQ z0>bdZrMUxG3E05dwh0U#jpIZSIg{C6)E!eb0t|>;oaR8By5m%ioJmkoHD)t?jf%&) zl38=5qKN__6A+7uiw1$`M}f0pQs3Cgj6ifGH-I6QLN7^;k%Y-HSP_92#De7jbhB-D z3%clsgWk>4uWvrDSQb7RU3obSUC&ql(iia5=)#JaG@vR`#*EW4qSm%;o4LycSGu~y ziFA?tkV;8Rf?0Z)6Izvi;>8IcazVq!g0WdyNKzrV7#1?9s^UIup)gJ)IDT8KppW*n zoef=7l;CJj2Llw>rR_G#n^Kh5rGsn~&d!P%GKWPd@q|7l3kPl`x>FJ*LKi)=XK{*&+8s{PEI<{cF3F% zGL0)5RFYn?U_#9>{>%?qJ&7_;|#$4Q`bD9 z2fN$VoaSyS9cIQvC53XL<+h2Jyyd7+krAz8B&51->6w@!vnRQXsJa literal 0 HcmV?d00001 diff --git a/tasmota/berry/modules/antiburn/antiburn.be b/tasmota/berry/modules/antiburn/antiburn.be new file mode 100644 index 000000000..68bfa5649 --- /dev/null +++ b/tasmota/berry/modules/antiburn/antiburn.be @@ -0,0 +1,52 @@ +var antiburn = module('antiburn') + +antiburn.init = def (m) + class Antiburn + var scr_original + var scr_antiburn + var running + static colors = [ + 0x000000, + 0xff0000, + 0x00ff00, + 0x0000ff, + 0xffffff + ] + def init() + self.running = false + end + def start() + if self.running + return + else + lv.start() + self.scr_original = lv.scr_act() + self.scr_antiburn = lv.obj(0) + lv.scr_load(self.scr_antiburn) + self.scr_antiburn.add_event_cb(/->self.stop(), lv.EVENT_PRESSED, 0) + self.running = true + self.cycle(0) + end + end + def cycle(i) + if !self.running return end + if i < 30 + self.scr_antiburn.set_style_bg_color(lv.color_hex(self.colors[i % 5]), 0) + tasmota.set_timer(1000, /->self.cycle(i+1)) + else + self.stop() + end + end + def stop() + if self.running && self.scr_antiburn != nil + lv.scr_load(self.scr_original) + self.running = false + self.scr_antiburn.del() + self.scr_antiburn = nil + end + end + end + return Antiburn() +end + +return antiburn \ No newline at end of file diff --git a/tasmota/berry/modules/antiburn/autoexec.be b/tasmota/berry/modules/antiburn/autoexec.be new file mode 100644 index 000000000..5f2c15c75 --- /dev/null +++ b/tasmota/berry/modules/antiburn/autoexec.be @@ -0,0 +1,20 @@ +# Register the command 'Antiburn' +# Module loaded in memory only when the command is first used + +var wd = tasmota.wd + +lv.antiburn = def() + import sys + var path = sys.path() + path.push(wd) + import antiburn + path.pop() + antiburn.start() +end + +tasmota.add_cmd("Antiburn", + def () + lv.antiburn() + tasmota.resp_cmnd_done() + end +)