Home AMX General Discussion

Streamlining Axcess code

amxhobbyistamxhobbyist Junior MemberPosts: 90
Hello,

I am trying to streamline my Axcess code and am looking for some insight. Here is an example of the problem I have:

Take any given lighting circuit; I must provide latching feedback to various panels. Example:

PUSH[dev_tp_theater,ch_tp_radia1_1] (* living room lights *)
PUSH[dev_tp_masterbed,ch_tp_radia1_1]
PUSH[dev_tp_computer,ch_tp_radia1_1]
PUSH[dev_tp_kitchen,ch_tp_radia1_1]
PUSH[dev_ctrl_frontdoor,3]
PUSH[dev_rf1,31] {
TO[dev_tp_theater,ch_tp_radia1_1]
TO[dev_tp_masterbed,ch_tp_radia1_1]
TO[dev_tp_computer,ch_tp_radia1_1]
TO[dev_ctrl_frontdoor,3]
TO[dev_tp_kitchen,ch_tp_radia1_1]
if ([dev_tp_theater,ch_tp_radia1_1]) { SEND_STRING dev_radia1,"'1L100',13" }
else { SEND_STRING dev_radia1,"'1L0',13" }
}

The various channels on the panels are in DEFINE_LATCHING, and this works great, though it gets a bit messy having a structure like this for every circuit. However, there are two problems with this approach:

1. I must first check the status of the circuit by looking at one of the panels. You can see that this is done in the code above - whether the circuit turns on or off is dependant upon the status of [dev_tp_theater,ch_tp_radia1_1]. I don't like this because it makes my entire system dependant on that panel. Could I mitigate this by PUSHing to a variable? Can I treat a variable exactly like a [device,channel] combination, testing it's on status with IF[variable] and adding it to DEFINE_LATCHING?

2. How do I activate this code block within code? Let's say I want those lights to come on at a specific time of day. I can't just do ON[dev,channel] because that doesn't execute a PUSH. I can't just toss the ON command to the radia unit because then the feedback on the panels won't reflect it. So I end up writing another block of code that adjusts all of the panels. Now each time I add or change a device that controls said circuit, I have to track it down in both places. Imagine adding an AXD-MSP32, which I'm about to install three of. I have to add each channel function (ON/OFF and PUSH/TO) to each code block. That's 4*32=128 lines of code per MSP32.

There has GOT to be a better way. DEFINE_COMBINE isn't always applicable because I don't necessarily want each panel to behave in the same manner.

Any thoughts?

Comments

  • frthomasfrthomas Junior Member Posts: 176
    amxhobbyist,

    I don't know much about Axcess code (more a Netlinx guy) and about Radia, but I think what you want to do is:

    (a) create a variable to keep track of the light state. Since you have many lights you probably want an array.

    (b) ideally, get the state of the light by asking the RADIA system if it allows that. Otherwise assume off and if will only be wrong initially.

    (c) send feedback to the panels based on the variable state

    (d) send command to RADIA based on the variable state

    (e) have the TP buttons change the variable state.

    F.e. you could define a call like (syntax approximate)
    DEFINE CALL (mylight, mystate)
    {
    IF (Lights[mylight] <> mystate)
    {
    Lights[mylight] = mystate;
    SEND_STRING TO RADIA TO SET STATE FOR mylight
    }
    }

    Obviously the problem you will run into is the identifier mapping between TP channel codes, the array index and the RADIA system. If you can find a way to numerically map them, it is much easier. Apparently, RADIA and arrays both start from 1, so I would "lock" a TP device and channel range (say TP 4 channel codes 1 to whatever number of light you have), so that a push on device 4, channel 1, any panel, means toggling the light at pos 1 in the array which is the radia light 1... Another trick might be to use an offset, say 100 for the panels, so that [panel4, 101] is light (channel_code-100 = 1)...

    Fred
  • FrankieFrankie Junior Member Posts: 71
    Correct me if I am wrong, but is there not some built in feed back channels in the Radia?? I can't remember but i am sure you could look it up in the manual for your dimmer.
  • Kaptain KaosKaptain Kaos AMX Southeast Posts: 42
    Streamlining Axcess code

    Here is an example of using levels to track channel feedback in NetLinx.

    LEVEL.VALUE is an embedded function. You do NOT need to use CREATE_LEVEL for the device.

    The ON or OFF commands are then sent to a device, a DEV, or a DEV_CHAN.

    No matter what UI controls the device with the level all devices in the array get the feedback.




    LEVEL_EVENT[dvMLC_LIV_LAMP,1]
    {
    IF (LEVEL.VALUE > 0)
    {
    ON[LED_LIV_MSPS,2]
    }

    ELSE IF (LEVEL.VALUE = 0)

    {
    OFF[LED_LIV_MSPS,2]
    }

    ELSE

    {
    (* statements for all other conditions *)
    }

    }


    Hope this helps,


    Rex
  • amxhobbyistamxhobbyist Junior Member Posts: 90
    Wow, this is an old thread.. You know what, I switched to Netlinx so this problem went away for me by using devchan arrays. :) Thanks for the response, though.
  • Irvine_KyleIrvine_Kyle Junior Member Posts: 67
    Wow, is right haven't looked at AXCESS code in quite awhile but here's an idea. In the Software History for RADIA they mention that channels 1-128 are for presets feedback. Perhaps you could use these. It looks like to me that you are toggling between 2 states or rather presets?? Basing the next preset on the FB of the panel. Why not base it on the FB of the device? So instead of :

    if ([dev_tp_theater,ch_tp_radia1_1]) { SEND_STRING dev_radia1,"'1L100',13" }
    else { SEND_STRING dev_radia1,"'1L0',13" }

    it would be

    if ([dev_radia1,128]) { SEND_STRING dev_radia1,"'1L100',13" }
    else { SEND_STRING dev_radia1,"'1L0',13" }

    just a thought
Sign In or Register to comment.