Hi,
Maybe someone has an idea, based on the above template. I have this TCP device which the LM is controlling. In this case you set a color light value. The light changes to the requested value by cycling through values and returning back a status for each light change. Now there is one caveat, I can bring this light on from the off state to a particular color with the exception of white. When I turn on white it will cycle through to the last light color that was previously on and then the what value has to be resent to get it to change. The time taken to change between any color is variable, changing from one color to another is not always the same. The number of times I receive a the status that the light is changing color is inconsistent.
For example, I wish to turn the light to white and the last color the light was on with was green.
SEND GOTO WHITE
1 sec later, received LIGHT IS GREEN
1.1 sec later, received LIGHT IS GREEN
0.5 sec later, received LIGHT IS GREEN
2 sec later, received LIGHT IS GREEN
1 sec later, received LIGHT IS GREEN
1.5 sec later, received LIGHT IS GREEN
NOW I SEND GOTO WHITE
Now for some light colors I may have to wait for 42 responses before I can change to white.
My idea is to create some kind of timer every time a status is received. This gets cancelled on receiving a new status. When the timer is reached then send the request to change to white.
Now my question is how can I realize this when working with my template. Using Sleep is not really an option because whilst the status of the light is coming back there can be other status values coming back. Is there a way to delay a non blocking function call with the option to cancel it in LUA?
Thanks,
Roger
Maybe someone has an idea, based on the above template. I have this TCP device which the LM is controlling. In this case you set a color light value. The light changes to the requested value by cycling through values and returning back a status for each light change. Now there is one caveat, I can bring this light on from the off state to a particular color with the exception of white. When I turn on white it will cycle through to the last light color that was previously on and then the what value has to be resent to get it to change. The time taken to change between any color is variable, changing from one color to another is not always the same. The number of times I receive a the status that the light is changing color is inconsistent.
For example, I wish to turn the light to white and the last color the light was on with was green.
SEND GOTO WHITE
1 sec later, received LIGHT IS GREEN
1.1 sec later, received LIGHT IS GREEN
0.5 sec later, received LIGHT IS GREEN
2 sec later, received LIGHT IS GREEN
1 sec later, received LIGHT IS GREEN
1.5 sec later, received LIGHT IS GREEN
NOW I SEND GOTO WHITE
Now for some light colors I may have to wait for 42 responses before I can change to white.
My idea is to create some kind of timer every time a status is received. This gets cancelled on receiving a new status. When the timer is reached then send the request to change to white.
Now my question is how can I realize this when working with my template. Using Sleep is not really an option because whilst the status of the light is coming back there can be other status values coming back. Is there a way to delay a non blocking function call with the option to cancel it in LUA?
Thanks,
Roger