Timers

9 replies [Last post]
BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010

I'm trying to get a timer to automatically restart, as per the wiki example, however it wont.  Below is the simple test lua script that I'm using :-

-- Update the LCD every minute with the current time
function init()
  -- After 10 seconds the 't1' timer will expire and call the 'doclock' function.
  start_timer("t1",10,"doclock")
end
 
function doclock()
  print("Starting LCD timer!")
  -- Reset the timer so it calls 'doclock' again in 10 seconds.
  start_timer("t1",10,"doclock")
end

 

This produces the following output :-

# xap-plugboard -d 5 -i br0

xAP Plugboard - for xAP v1.2
Copyright (C) DBzoo 2009

br0: address 192.168.1.55
br0: netmask 255.255.255.0
Autoconfig: xAP broadcasts on 192.168.1.255:3639
xAP uid=FF02D800, source=dbzoo.livebox.2.Plugboard
Debug level 5
Broadcast socket port 3639 in use
Assuming a hub is active
Socket port 3640 in use
Discovered port 3641
loadScripts(/etc/plugboard)
loadScript(lcd_timer.lua)
start_timer(t1,1290268780,doclock)
Ready
Fire Timer t1 calling doclock
Starting LCD timer!
start_timer(t1,1290268791,doclock)

 

And that's it, I would have expected to see the "Starting LCD timer!" and the "start_timer(.....", output on the screen every 10 seconds. 

Can anyone see what I'm doing wrong?  I'm running with HAH version 255.

Thanks

 

Karl

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Used to be good ...

Hi Karl,

However ... lots of stuff changed in 255. This might now be broken (and there aren't many folks scripting in Lua).

There is a lot of work going on to convert the Lua scripting to use the new xaplib2. If you can hold out for this, I'm sure that you'll find scripting things a) easier to do, b) much more flexible and powerful and c) faster.

Brett & I are on the alpha codestream for this. Reckon that it would be better to push ahead on this than spend time fixing/re-testing what will soon be legacy.

What do you reckon?

Derek.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Plugboard next generation

Well this is a bit of dilemma I'm working on new plugboard engine although I have lots of samples working its just not ready for mainstream release.  So do I spend time investigating and fixing something that is about to be deprecated or do you wait until I can release the next generation engine?

I've written up the documentation for the API as it stands, in a private wiki area, however everything is subject to change as I'm still working on it.  So releasing it now would lock in its current state something; I'm not ready for.

Alternatively I could make this DEV release available however it would come with the caveat that anything could change without notice.  I haven't even checked my changes into the source control system yet.

Also this engine is not compatible with existing scripts, although its not hard to whip them into their new form, I haven't spending any time testing my backward compatibility calls.

What I will say is that the new plugboard will blow your socks off.

So I'll leave the decision up to you?  Want to live on the bleeding edge or have a bug?

Brett

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Life's for Living...

What an offer, but I think you know the answer to that question.  I'm fortunate enough to have two HAH's, one strictly DEV, and that's where I found this problem. 

I certainly don't want you to push anything out before it's ready, you know I'm keen to promote and support you guys, and I agree that releasing too soon can cause more issues and distract you from developing the new plugboard.  I'd also add, that if there are no other reported issues in a live environment, then it's not worth trying to fix this for me.

If you think that I can be of help with the new code then you know how to get hold of me, I'll always be happy to help.

Karl

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
If HAH were a bunje jump...

I'd be asking you to strap me up ready to jump off!

In other words I'd say let's drop the old and go for the new...we can work out all the kinks on the way...

I only have about 8 scripts and they're all a bit wimpy anyway(still working on my Lua training) so it's no biggie for me if the thing breaks.

I'm happy to throw myself down as a beta tester...will report back any issues with no expectation of quick fix.

Being a luddite I often do things in a way which you techies wouldn't, this can often highlight issues.

Over to you Brett!

danward79
Offline
Joined: 19 Jan 2011
Did the timers get fixed in the LUA plugboard?

Hi Guys,

I am trying to update my weather script to run of a timer that resets it's self. 

I have found that the timers are not resetting as per this thread, I was surprised because I thought it was fixed in the lua plugboard?

I tried to work around the problem by triggering off a hbeat message but this did not work either (register_class). Any ideas for a work around?

Cheers

Dan

brett
Offline
Providence, United States
Joined: 9 Jan 2010
LUA engine

As you mentioned the "register_class" function this is deprecated so I can only assume you are using the 'old' engine.

Unfortunately I don't maintain the "old" plugboard engine and the new one hasn't been released.   I think its probably best if I just release it and deal with the bugs it throws up as its does provide a much better framework.

I'm just goint to bite the bullet and push it out - there is never going to be a good time.

Brett

danward79
Offline
Joined: 19 Jan 2011
Hi Brett, Thanks for the

Hi Brett, 

Thanks for the info. 

Is the new engine still lua? I like lua as I have used it before. ;-)

Moving to the new version is not issue here as I have nothing running off my box properly yet.

Cheers

Dan

danward79
Offline
Joined: 19 Jan 2011
Hi Brett,I actually just

Hi Brett,

I actually just updated to the latest beta 279.2. The plugboard looks like it has the facility for global functions which is a real improvement. Super

Thanks

Dan

brett
Offline
Providence, United States
Joined: 9 Jan 2010
That beta

That beta is the new LUA plugboard - I only pushed this new beta about 4 hrs ago.

The documentation that I've written so far http://www.dbzoo.com/livebox/hah_plugboard_v2

There are updated samples in your /etc_ro_fs/plugboard/samples directory.

Brett

Hardware Info