Need Help, Duet Module multi TP?!?

RemyRemy Junior MemberPosts: 3
Hi everybody,

I'm a Level 1 Programmer, so I will frequently ask evident and basic question, I have already done several project who works fine, but with real basic logic and hand write all the command i share.
And sorry for my poor english and the mistake, I'm from Montreal Québec!

My problem IS:

I was trying to usea Duet module in my program (Marantz sr8500), and the Original define device go below:

dvDEVICE = 5001:1:0 // Marantz SR8500, Serial Port
dvTP = 10001:1:0 // Touch Panel
vdvDEVICE1 = 41001:1:0 // Virtual Device # 1 ==>MAIN ROOM
vdvDEVICE2 = 41001:2:0 // virtual device # 2 ==>MULTI ROOM

The original Module:

MODULE_NAME='Marantz_SR8500_UI' (
DEV vdvDEV_ARRAY[],
DEV dvTP,
INTEGER nCHAN_BTN[],
INTEGER nTXT_BTN[]
)

My problem is that I gat several TP in my projet and i don't know how to modify it?!?

I was thinking that i will need to write this in my main:

DEV vdvDEV_ARRAY[] = {
vdvDEVICE1,
vdvDEVICE2
}

and for the multi Panel, i don't know what i have to do?!?

Your Help will be realy appreciate!!!

Thank's

Rémy

Comments

  • DHawthorneDHawthorne Junior Member Posts: 4,584
    Make the "dvTP" that the module wants a virtual device. Then put a DEFINE_COMBINE statement in your program with that virtual device for your first entry, and your real panel device numbers for the rest (check the proper syntax, I always have to look it up myself). That should make the module think there is only one panel, and they will all link up. It's not perfect, there are some wonky glitches in a combine, but it should be adequate. The Marantz protocol is pretty easy though, you could roll your own with only the features you need and it will probably work better than the Duet module.
  • RemyRemy Junior Member Posts: 3
    Thank's for the reply!

    1- Does this mean that I will need to change the device "dvTP" event in all the module if i change it for a "vdvTP"?!?

    2- Is it possible to make a "advTP" array that contain all my TP and replace the "dvTP" of the "UI" (AXS module)?!?
    I did that for a Escient but the Duet was originaly build like that.
    And if Ido that, is the "comm" module (JAR file) will continue to works?

    3- If i do what you tell me did the "comm" module will continue to work properly?

    4- What do you do in my position, do you let that Duet module on the side and use the commad you need that<s all, or you take the time to make it works?

    Thank's
  • edgelitocedgelitoc Junior Member Posts: 160
    Remy wrote: »
    Thank's for the reply!

    1- Does this mean that I will need to change the device "dvTP" event in all the module if i change it for a "vdvTP"?!?

    2- Is it possible to make a "advTP" array that contain all my TP and replace the "dvTP" of the "UI" (AXS module)?!?
    I did that for a Escient but the Duet was originaly build like that.
    And if Ido that, is the "comm" module (JAR file) will continue to works?

    3- If i do what you tell me did the "comm" module will continue to work properly?

    4- What do you do in my position, do you let that Duet module on the side and use the commad you need that<s all, or you take the time to make it works?

    Thank's


    My 2 cents is to use a direct serial command, don't use duet module,, you are doing the right thing to have a basic logic on your program.
  • RemyRemy Junior Member Posts: 3
    edgelitoc wrote: »
    My 2 cents is to use a direct serial command, don't use duet module,, you are doing the right thing to have a basic logic on your program.

    Ok, thank's ;)
  • a_riot42a_riot42 AMX Wizard Posts: 1,619
    DHawthorne wrote: »
    Make the "dvTP" that the module wants a virtual device. Then put a DEFINE_COMBINE statement in your program with that virtual device for your first entry, and your real panel device numbers for the rest (check the proper syntax, I always have to look it up myself). That should make the module think there is only one panel, and they will all link up. It's not perfect, there are some wonky glitches in a combine, but it should be adequate. The Marantz protocol is pretty easy though, you could roll your own with only the features you need and it will probably work better than the Duet module.

    I would stay away from DEFINE_COMBINE myself. If you have several touch panels and all need to control the Marantz, then make an array of touch panels, rather than just one, and pass it to the module. Make any changes you need to in your UI module to accommodate the array rather than a single device.

    IE:
    MODULE_NAME='Marantz_SR8500_UI' (
    DEV vdvDevices[],
    DEV dvTPs[],
    INTEGER nCHAN_BTN[],
    INTEGER nTXT_BTN[]
    )
    

    When writing Netlinx code I generally don't use singular devices, always arrays that can grow if needed. Its far easier to add a device to an array later on, than to modify a single device into an array. For instance, every project I do automatically gets 8 iPad touch panels defined even if there is only one specified. That way panels can be added to the system just by configuring the panel's device ID and loading the panel file.

    So if you find yourself passing one device around to modules, or button events, try to refactor it to be arrays. Its unfortunate that Netlinx doesn't use polymorphism so you can't send either a device or an array of devices to a function. I've ended up with functions that are identical other than one is for a single device, and the other is for an array of devices. If you could at least make an anonymous array that would suffice, but you can't.

    So I always deal with arrays rather than devices. All my button_events have two arrays in the header, one for an array of UIs and the other array for channels. I wish you could use multidimensional arrays in button_events to make things even more fun, but that is not allowed.
    Paul
Sign In or Register to comment.