On the go timer interrupts?
-
Hi.
I don't have so much experience in C++ so I don't know if it will be possible.
What I want is, at the moment I receive the order from the controller to switch on a light, if the light has a preset time running, create a timer interrupt at the end of the said period to turn that light off.
I would like those interrupt to be independant and generated, so if I have two lights, would behave the same.Do you think that is possible?
Thx!
-
@Sergio-Rius It is possible even without interrupts. But I think this kind of logic should be put in the controller. It saves you the coding and leaves the solution flexible.
So you create an on/off sensor. And just add a timer in the controller. Domoticz supports this without using scripting.
-
@TheoL Hi.
I think that a higher level of abstraction from the controller, and giving the node more personality suits better for me. Also I like reducing the unnecessary radio traffic.Let me explain something more my node. The node I'm working on it's basically a multiple actuator that abstracts from the code things like the number of relays or their behaviour.
At the moment, you are forced to populate a collection for it to discover and work with a variable number of elements, but as soon as I can I'll find a way to inject that info and avoid altering the code. Perhaps something like espeasy does, rflink activates it's rf modules, or even through a variable from the controller (worst of cases)Now it does all those things but the timer shutdown. I'm a good C# programmer, but I admit that it'll be difficult for me to adapt to C++. I still do all the things as I was doing in C#
I don't know anything about the scope or the behaviour of instantiated objects. I would like to tie a timer object to one element's property in the collection and let it run, but I don't know how, or if it will stay "alive" after the procedure ends