Home AMX User Forum NetLinx Studio

Mutually Exclusive

Greetings...

I can't figure out if I'm nuts, or if DEFINE_MUTUALLY_EXCLUSIVE has inconsistent results. Here is basically what I have...

DEFINE_CONSTANT

BTN1 = 1
BTN2 = 2
BTN3 = 3
BTN4 = 4

DEFINE_MUTUALLY_EXCLUSIVE
([devTP, BTN1]..[devTP, BTN4])


BUTTON_EVENT [devTP, theButtons]
{
PUSH:
{
ON [devTP, BUTTON.INPUT.CHANNEL]
}
}

devTP is an array of devices. The input channel turns on fine on the panels, but the previously selected button stays on as well. Any thoughts?? (and yes, theButtons is a defined array of the constants)

Comments

  • AMXJeffAMXJeff Posts: 450
    sonny wrote: »
    Greetings...

    I can't figure out if I'm nuts, or if DEFINE_MUTUALLY_EXCLUSIVE has inconsistent results. Here is basically what I have...

    DEFINE_CONSTANT

    BTN1 = 1
    BTN2 = 2
    BTN3 = 3
    BTN4 = 4

    DEFINE_MUTUALLY_EXCLUSIVE
    ([devTP, BTN1]..[devTP, BTN4])


    BUTTON_EVENT [devTP, theButtons]
    {
    PUSH:
    {
    ON [devTP, BUTTON.INPUT.CHANNEL]
    }
    }

    devTP is an array of devices. The input channel turns on fine on the panels, but the previously selected button stays on as well. Any thoughts?? (and yes, theButtons is a defined array of the constants)

    Very good question! There are three IO states on a channel; input, output and feedback. Normally Output and Feedback track and stay together. So it acts like input/output object. However when you put them in a mutually exclusive set, feedback and output do not track any longer. So if you pulse/to the channel, the output portion pulses momentarily and the feedback portion stays on. This is why your button seems to stays on. So... AMX created a keyword called Total_Off to force turn off the feedback state of the channel.

    Total_Off[dev,chan];

    You can actually use this to your advantage. You can pulse/to a channel and the channel will remain on showing last selected.
  • sonnysonny Posts: 208
    Thanks...

    The main function I'm looking for is visual display of the button on the touch panel...currently active audio source, for example. Feedback for the button is set to Channel, with color changes for On and Off States. Pulsing will pulse the button but won't keep it on. I swear I have used "ON [dev, chan]" in the past within a mutually exclusive set and it has worked. (but I may not be remembering correctly).

    I would think by using Pulse I would have to also define the set as DEFINE_LATCHING??
  • truetrue Posts: 307
    Pulse, On, it doesn't matter - any will keep the last in the set on.

    When you say "the previously selected button stays on," do you mean the one that was just hit? I'm trying to figure out what you mean by "the input channel" and "the previously selected button" and where a disconnect would be.
  • sonnysonny Posts: 208
    true wrote: »
    Pulse, On, it doesn't matter - any will keep the last in the set on.

    When you say "the previously selected button stays on," do you mean the one that was just hit? I'm trying to figure out what you mean by "the input channel" and "the previously selected button" and where a disconnect would be.

    The prior active channel prior to the newly pressed on. For example BTN2 has been pressed and the channel tied to it was turned ON in code, then BTN3 is pressed and turned ON. Now on the TP both BTN2 and BTN3 are in the ON state.

    Thanks
  • shr00m-dewshr00m-dew Posts: 394
    I've never gotten a mutually exclusive to work on a device array. I always have to break it out for each device.



    Kevin D.
  • a_riot42a_riot42 Posts: 1,624
    shr00m-dew wrote: »
    I've never gotten a mutually exclusive to work on a device array. I always have to break it out for each device.


    Yes, mutually exclusivity across an array of devices doesn't seem to work. The mutual exclusivity is between the channels of a device, not channels across an array of devices. That would require quadratically more accounting. The compiler allows you to use a dev array in the define_mutex section but it won't behave as desired. Using define_combine might work with mutexes but I have never needed to use this feature. Make the channels mutually exclusive across a virtual device and then using define_combine, combine the virtual with the array of devices.

    define_mutually_exclusive

    ([vdvDev, 1]..[vdvDev, 4])

    define_combine
    (vdvDev, dvTP[])

    BUTTON_EVENT [vdvDev, theButtons]
    {
    PUSH:
    {
    ON [vdvDev, BUTTON.INPUT.CHANNEL]
    }
    }


    Paul
  • ericmedleyericmedley Posts: 4,177
    I've found mixed results with using Mut_EX with arrays myself. I've always just done a statement for each device. while a pain in the rump, it does seem to act more reliably.
  • sonnysonny Posts: 208
    Thanks guys...I think my confusion is I've recently changed the way I manage touch panels, going from addressing a virtual device with a combine on the physicals, to an array of the physicals. This is probably why I remember this working fine in the past. It would seem that this would generate a compiler error, or warning at least, if there is a runtime issue with this.
Sign In or Register to comment.