Home NetLinx Studio

Feedback and Arrays

AdaptelAdaptel Junior MemberPosts: 41
I am a ongoning self-taught AMX programmer and I have made the jump from Axcess to Netlinx a couple months ago. Got a couple questions about feedback, arrays, grouping of channels, & simplifying assignment.

1) When, if anywhere can you use the convention in NL:
(dvMYDEVICE,chMY1stCHAN)..(dvMYDEVICE,chMYlastCHAN) or
(dcMY1stDEVCHAN)..(dcMYlastDEVCHAN)
Can this be done instead of having to assign arrays of channels or devchans for every "group" of buttons, devices, or channels?

2) Can multiple feeback assignments be done without seprate declarations or loops? ie, with these declarations:

DEFINE_DEVICE
dvMSP32 = 128:1:0
dvRELAY8 = 2:1:0

DEFINE_VAR
INTEGER chRELAYS[] = {1,2,3,4,5,6,7,8} (*relays of AXC-REL8*)
INTEGER chMSPBTNS[] = {5,6,7,8,9,10,11,12} (*relay control buttons*)
Instead of doing this:
TIMELINE_EVENT[TL_UPD8FEEDBACK]
{ [dvMSP32,chRELAYS[1]] = [dvRELAY8,chMSPBTNS[1]]
[dvMSP32,chRELAYS[2]] = [dvRELAY8,chMSPBTNS[2]]
etc......
}
or this (partial):
TIMELINE_EVENT[TL_UPD8FEEDBACK]
STACK_VAR CNT
{ FOR (CNT=1 ; CNT<=8 ; CNT++)
[dvMSP32,chRELAYS[CNT]] = [dvRELAY8,chMSPBTNS[CNT]]
}
Is there any convention to assign feedback like this to update more than one feedback element at once? Are there any tricks for groups of devchans or chans?:
TIMELINE_EVENT[TL_UPD8FEEDBACK]
{ [dvMSP32,chRELAYS[]] = [dvRELAY8,chMSPBTNS[]]
}

This may be a simple question and/or terrible example, but any input would be greatly appreciated. Thanx.

Comments

  • Chip MoodyChip Moody Junior Member Posts: 727
    For what it's worth, I've found that doing a for loop for updating button status takes longer than if you just have a bunch of [TP,x] = (some state) lines...

    - Chip
  • DHawthorneDHawthorne Old Timer Posts: 4,584
    Chip Moody wrote:
    For what it's worth, I've found that doing a for loop for updating button status takes longer than if you just have a bunch of [TP,x] = (some state) lines...

    - Chip
    I kind of thought that might be the case; I simply find it easier to code in a loop, and usually it's not going to be enough difference to matter.
Sign In or Register to comment.