¿ªÔÆÌåÓý

LogixNG best way with multiple sensors #logixng


 

Hi, I am looking for some best practice advice / guidance here.
?
I am configuring a prototypical (UK Entrance Exit) panel with lots of fussy things that need to happen when the physical buttons are pushed. It will be about twenty buttons, already configured in JMRI as sensors and already in a sensor group so only one button will be active at any one time.? I have a requirement which initially sounds simple - whenever a button is pressed, I want to go and do some processing which needs to know which button triggered the process.
?
Approach number one - twenty ConditionalNGs one for each button. When a ConditionalNG fires, it sets a [global] variable to note which button (ie which ConditionalNG) was pressed and then calls a common module to do the processing. The module can then look at the variable to see which button caused things to happen. I think I can make that work, but twenty almost identical ConditionalNGs feels a bit clumsy and error prone.
?
Approach number two - a single ConditionalNG which is set to react to any of the sensors going active (presumably an "or"). Again, it would need to identify which sensor caused the trigger and save the detail to a variable before calling a module to do the processing.? That feels like it would be neater, but I haven't found a way to let a ConditionalNG know which specific sensor triggered it.
?
Approach number three - the obvious and much better approach which has completed eluded me so far!
?
Any thoughts or suggestions very welcome.
?
Some background of what will go on in the later processing (more for interest than anything). Each button can be either an Entrance to a route, and Exit, or both. The first button to be pressed has to be an entrance (exit buttons will be ignored). The light in the entrance button will then start to flash. The next button to be pressed should then be an exit button. If there is no valid route from entrance to exit, the flashing entrance button light will go dark and the process starts again. If there is a valid route, then the light will go steady and the route will start to set (probably using standard JMRI routes to do that).........
?
Maybe that explains why I am looking for any one of the 20 buttons to trigger the same process (where the logic will be), but that I do need to know which button was pressed.
?
Hopefully, the question makes some sense!
?
Thanks, Nick.

Join [email protected] to automatically receive all group messages.