summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-03-17 23:30:53 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-03-17 23:30:53 +0000
commit17af05ba8805d00bacbd3910cfa444e8a1ea6e5b (patch)
tree3b80370e6fd5c624ffc4ef9a1142865138ef16e8 /data
parent9a70d3cc976c1008ad061801b6e090a5723fd6b8 (diff)
TH - make ac on/off sound only do it after 5 sec after start
Diffstat (limited to 'data')
-rw-r--r--data/elementary/themes/edc/battery.edc24
1 files changed, 24 insertions, 0 deletions
diff --git a/data/elementary/themes/edc/battery.edc b/data/elementary/themes/edc/battery.edc
index 46d895eba4..8a3c4cd36d 100644
--- a/data/elementary/themes/edc/battery.edc
+++ b/data/elementary/themes/edc/battery.edc
@@ -3,6 +3,7 @@ group { name: "e/modules/battery/main";
3 min: 16 16; 3 min: 16 16;
4 max: 160 160; 4 max: 160 160;
5 script { 5 script {
6 public load_time;
6 public message(Msg_Type:type, id, ...) { 7 public message(Msg_Type:type, id, ...) {
7 if ((type == MSG_FLOAT) && (id == 1)) { 8 if ((type == MSG_FLOAT) && (id == 1)) {
8 new Float:val = getfarg(2); 9 new Float:val = getfarg(2);
@@ -12,6 +13,20 @@ group { name: "e/modules/battery/main";
12 set_state(PART:"fill_clip", "custom", 0.0); 13 set_state(PART:"fill_clip", "custom", 0.0);
13 } 14 }
14 } 15 }
16 public Float:year_sec() {
17 new year, month, day, yearday, weekday, hour, minute;
18 new Float:second;
19
20 date(year, month, day, yearday, weekday, hour, minute, second);
21 return seconds() + float(yearday * 24 * 3600);
22 }
23 public run_prog_later(prog) {
24 new Float:second, Float:start;
25
26 second = Float:year_sec();
27 start = get_float(load_time);
28 if ((second - start) > float(5)) run_program(prog);
29 }
15 } 30 }
16 parts { 31 parts {
17 part { name: "pulse_clip"; type: RECT; 32 part { name: "pulse_clip"; type: RECT;
@@ -112,10 +127,19 @@ group { name: "e/modules/battery/main";
112 } 127 }
113 } 128 }
114 programs { 129 programs {
130 program { signal: "load"; source: "";
131 script { set_float(load_time, year_sec()); }
132 }
115 program { signal: "e,state,ac,on"; source: "e"; 133 program { signal: "e,state,ac,on"; source: "e";
134 script { run_prog_later(PROGRAM:"ac_on"); }
135 }
136 program { name: "ac_on";
116 action: PLAY_SAMPLE "synth-worble-up" 1.0 ALERT; 137 action: PLAY_SAMPLE "synth-worble-up" 1.0 ALERT;
117 } 138 }
118 program { signal: "e,state,ac,off"; source: "e"; 139 program { signal: "e,state,ac,off"; source: "e";
140 script { run_prog_later(PROGRAM:"ac_off"); }
141 }
142 program { name: "ac_off";
119 action: PLAY_SAMPLE "synth-worble-dn" 1.0 ALERT; 143 action: PLAY_SAMPLE "synth-worble-dn" 1.0 ALERT;
120 } 144 }
121 program { signal: "e,state,charging"; source: "e"; 145 program { signal: "e,state,charging"; source: "e";