Willkommen auf unserer neuen Forenplattform für das Bus-Profi Forum

Neue Felder für die persönlichen Daten
Man kann jetzt seine öffentlich einsehbare Daten genau bestimmen. Details findet ihr in in diesem Beitrag.

Durch die neue Forensoftware und die Portierung der Daten konnten die Passwörter aus dem alten Forum nicht übernommen werden, bitte lassen Sie sich ein neues Passwort über die Passwort vergessen Funktion zusenden. Sollte es zu Problemen kommen kontaktieren Sie das Bus-Profi Team per E-Mail.

timers / delay from logic

Hard- und Softwarefragen rund Domiq-Module fürs LCN-System
Antworten

Themenersteller
twinkelm
Neues Mitglied
Neues Mitglied
Beiträge: 16
Registriert: Mo 23. Mai 2011, 08:54
Status: Offline

#1 timers / delay from logic

Beitrag von twinkelm »

Hi Filip, hi all,

one more question, if allowed ;-)

Is it possible to use DELAY or TIMER commands from the logic module? I want to create a timer based callback, and DELAY or TIMER commands would be really helpful instead of programming a timer by myself.

Something like
use abc = "TIMER.room.5s.C.LOGIC"
abc.value = "mycallback(parameter)"

If yes, do you have some sample code? I tried some variations of above, but no success ;-)

Any other options?

Have a nice evening,
Best regards,

Thomas

DOMIQ
Fleißiges Mitglied
Fleißiges Mitglied
Beiträge: 252
Registriert: Sa 25. Apr 2009, 11:16
Kontaktdaten:
Status: Offline

#2 RE: timers / delay from logic

Beitrag von DOMIQ »

You could use timers like below:

Code: Alles auswählen

function handler(test)
  print("This is delayed " .. test)
end

command("TIMER.test.5.C.LOGIC=handler('Hello')")

Themenersteller
twinkelm
Neues Mitglied
Neues Mitglied
Beiträge: 16
Registriert: Mo 23. Mai 2011, 08:54
Status: Offline

#3 RE: timers / delay from logic

Beitrag von twinkelm »

That is an elegant solution, just what I was expecting, thanks a lot. And especially thanks for the super fast reply!

Best regards,
Thomas

DOMIQ
Fleißiges Mitglied
Fleißiges Mitglied
Beiträge: 252
Registriert: Sa 25. Apr 2009, 11:16
Kontaktdaten:
Status: Offline

#4 RE: timers / delay from logic

Beitrag von DOMIQ »

Sorry, I just found one reason why that will not work. :blush:
Next version of the system will have it fixed. As for now command call is adding C. in front.
As a workaround until it's fixed you can add following line to the Events tab:

Code: Alles auswählen

Channel: C%.TIMER%.(.+)
Command:
Channel name: TIMER.$C1
Channel value: $D0
This will forward any data sent to C.TIMER.xxx=yyy as TIMER.xxx=yyy. You can try the same approach with delays.
Antworten