1
0
Fork 0

- remove hack around Nasal bug, which is already fixed

- add second optional argument to light.blink() method, which
  defines which state should be set after the end of the sequences
  (defaults: 0)
This commit is contained in:
mfranz 2007-04-06 21:33:22 +00:00
parent c331a49dea
commit 5471f0cd5b

View file

@ -232,9 +232,11 @@ light = {
},
# light.blink() -> blinking light (default)
# light.blink(3) -> when switched on, only run three blink sequences
blink : func(count = 1000000000) { # FIXME: hack around nasal bug, should be -1
# light.blink(3) -> when switched on, only run three blink sequences;
# second optional arg defines state after the sequences
blink : func(count = -1, endstate = 0) {
me.seqcount = count;
me.endstate = endstate;
if (me.continuous) {
me.continuous = 0;
me.index = 0;
@ -262,7 +264,8 @@ light = {
_loop_ : func(id) {
id == me.loopid or return;
if (!me.count) {
me.switch(0);
me.loopid += 1;
me.stateN.setBoolValue(me.endstate);
return;
}
me.stateN.setBoolValue(me.index == 2 * int(me.index / 2));