Using Multiple Tp with Multiple Iports
Gfull
Posts: 19
I would like to use multiple tp's (4) with multiple iports (4) and have the ability to access any iport from any tp using the netlinx jar module. I have a theory but would love to have some guidance from someone who has ran into this problem.
my question lies in the define start section will the code below work or
DEFINE_MODULE 'Sonance_iPort_Comm_dr1_0_0' DuetCode(vdvIport_1, dvIW_22_1)
DEFINE_MODULE 'Sonance_iPort_Comm_dr1_0_0' DuetCode(vdvIport_2, dvIW_22_2)
DEFINE_MODULE 'Sonance_iPort_Comm_dr1_0_0' DuetCode(vdvIport_3, dvIW_22_3)
DEFINE_MODULE 'Sonance_iPort_Comm_dr1_0_0' DuetCode(vdvIport_4, dvIW_22_4)
DEFINE_MODULE 'Sonance_iPort_UI' TP1(vdvIport_1, dvTP1, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
DEFINE_MODULE 'Sonance_iPort_UI' TP2(vdvIport_2, dvTP2, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
DEFINE_MODULE 'Sonance_iPort_UI' TP3(vdvIport_3, dvTP3, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
DEFINE_MODULE 'Sonance_iPort_UI' TP4(vdvIport_4, dvTP4, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
should i change the define ui module to something like this
Define_Module 'Sonance_iPort_UI' TP1(vdvIport_1,dvTP1_Iport_1,dvTP2_Iport_1,dvTP3_Iport_1,dvTP4_Iport_1,dvTP4, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
and so for tp 2-4.
any help would be appreciated
thanks
Greg
my question lies in the define start section will the code below work or
DEFINE_MODULE 'Sonance_iPort_Comm_dr1_0_0' DuetCode(vdvIport_1, dvIW_22_1)
DEFINE_MODULE 'Sonance_iPort_Comm_dr1_0_0' DuetCode(vdvIport_2, dvIW_22_2)
DEFINE_MODULE 'Sonance_iPort_Comm_dr1_0_0' DuetCode(vdvIport_3, dvIW_22_3)
DEFINE_MODULE 'Sonance_iPort_Comm_dr1_0_0' DuetCode(vdvIport_4, dvIW_22_4)
DEFINE_MODULE 'Sonance_iPort_UI' TP1(vdvIport_1, dvTP1, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
DEFINE_MODULE 'Sonance_iPort_UI' TP2(vdvIport_2, dvTP2, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
DEFINE_MODULE 'Sonance_iPort_UI' TP3(vdvIport_3, dvTP3, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
DEFINE_MODULE 'Sonance_iPort_UI' TP4(vdvIport_4, dvTP4, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
should i change the define ui module to something like this
Define_Module 'Sonance_iPort_UI' TP1(vdvIport_1,dvTP1_Iport_1,dvTP2_Iport_1,dvTP3_Iport_1,dvTP4_Iport_1,dvTP4, nCHAN_BTN, nTXT_BTN, nLVL_BTN)
and so for tp 2-4.
any help would be appreciated
thanks
Greg
0
Comments
You could change the module header for the UI mod which should be open to allow an array of devs (not individuals as you've shown) but then you need to re-write the majority of the code to track which iPort the TP is supposed to control to determine which virtual to send commands to and which virtual's feedback to send to which TP.
It can be done but it's alot of work. It might be easier to create a seperate TP port/pages for each iPort then using the arrays of TPs will be easier to manage.
I personally use a non duet "modified" module for the iPort that does allow for any TP to control any iPort using a single TP port/page approach that does the instance tracking for control & feedback. I tend to shy away from Duet modules and locked modules in general since I've had limited experience and success with them. If I can't personally fix it I don't want to use it.
I know my post is not entirely helpful. I'll try to look at what I did so I can speak more intelligently. But, it is doable and I do it all the time.
Jeff
To amplify Jeff's statement. I do use the Netlinx version myself too. I never had any luck with the Duet version. It's a process hog too.
Here's my definition for 20+ panels controlling 3 different iPorts
I was going to modify the UI module - but never got around to it. Good luck!
I am looking at a project with 12 iPods and many UIs and need to modify the UI module so that I don't use 12 ports. Given that the UI module does touch panel feedback in various places including define_program, it looks like I will need a few for loops. 12 for loops running, updating 20 touch panels at every iPod's elapsed second is going to hog the processor big time I would think. The kaleidescape module does something similar and its feedback can slow down, so I am wondering if there is a better method. Ultimately all these strings have to be sent to all these wireless devices so there may not be much that can be done other than throwing hardware at it. I've tried dynamically populating the dvTP array for feedback but that requires a rebuild_event call which is also expensive. Has anyone come up with any clever tricks to deal with this?
Paul
Just gotta do allot of re-writting.
Yes with a locked comm module there isn't much choice I guess. I'll have to redo the buttons and feedback it looks like similar to what you have done. I am just worried about burdening the processor. Have you had any issue with this when using multiple iPorts?
Paul
I also use an overall flag so values are just stored and no loops are run in there's not at least 1 TP on an iPort page.
So if an iPod is playing but its not a source for any UI, no for loops run?
Paul
Yeah, if iPods are playing but no UI is on an iPort page there's no FB that needs to be sent so no loops run. FB is just stored in a structure so when a UI does return to the iPort page it can be updated with the data stored in the index of the structure that matches the virtual device/iPort.
I was thinking about setting it up so that if iPods are running and no UI is currently controlling it, that the PROCESS_RESPONSE function wouldn't get called. That function is 600 lines long, and I don't want it called in 12 modules every second if no one is controlling it. Still have to figure out a good way to do that though.
Paul
It supports multiple panels, but the UI module is written to use its own port. 5 iPods means 5 ports, which seemed silly to me. So I modified it to use one port like I normally do, and buttons/feedback is ignored if the UI isn't currently controlling the device. It seems to have also made feedback more snappy too. As soon as the iPod is pulled from the iPort feedback is virtually instant, and same when its docked, so that a nice benefit I wasn't considering.
Paul
It's probably done to conserve memory. Since you can't allocate memory on the fly in NetLinx, your state variables (all your meta data, browing info) have to be big enough to hold all the possible feedback on all the possible panels and all the possible devices, which can use a lot of memory up real fast. And in case you are thinking that's not likely to be a problem, I ran across it only minutes ago where a project loaded on a test controller failed because it ran out of memory. The target controller is more than big enough, but my bench unit, a mere 900, is not. I can just comment out some modules and still test ... but if they were all together, that wouldn't be an option.
So the question becomes, does it use more resources to load another instance, or just combine all the variable allocation into one? In the end, more instances are going to use more memory, but if you only need one or two, but the module is explicitly set up for 5 devices and 20 panels, you're hosed if you aren't the source originator and can't just change the dims and recompile.
Display Memory
Volatile Free : 14169096/67108864 (largest free block in bytes/max physical)
NonVolatile Free: 1010616/1047536 (bytes free/max physical)
Disk Free :114843648/128299008 (bytes of free space/max physical)
Duet Memory Free : 6288520 (bytes)
Partition 1 - 6288520 (bytes)
Total Collections - 2
Average Time Between Collections - 19418ms
Partition 2 - <UNKNOWN>
I've got 12 instances of the Netlinx iPort comm and UI module, plus a dozen or so other modules, and it looks like there is memory left so it shouldn't be an issue.
I have a feeling that the memory gained by using fewer ports is more than what is taken up by more modules using the same port, but I could be wrong.
Paul
Paul
Maybe I am confused, but the way the UI/comm module are written, any TP in the array passed to it will trigger events and get feedback from the comm if they use the same port. For instance, the UI module has this code in define_program:
[dvTP, dvTP_BUTTONS[4]] = (nONLINE == 1) // Online Status button
So every TP in the array will have its online status button turned on, even if only one of the iPods is docked. This is the module declaration using one port for all iPods:
define_module
'iPort_UI' mdlIpodUI
(vdvIpod, dvIpodUIs, iIportTPChannels, iIportTPVTChannels, iIportTPLevels, TP_UI_LIST, nR4_DMS_PORT1, nR4_DMS_PORT2)
define_module
'iPort COMM' mdlIpodComm
(vdvIpod, dvIpod)
As soon as vdvIpod comes online, all the TPs in dvIpodUIs will have their status turned on. However, one TP might be controlling another iPod which isn't currently online so the feedback is incorrect. So I have to do this:
define_module
'iPort_UI' mdlKitchenIpodUI
(vdvKitchenIpod, dvIpodUIs, iIportTPChannels, iIportTPVTChannels, iIportTPLevels, TP_UI_LIST, nR4_DMS_PORT1, nR4_DMS_PORT2)
define_module
'iPort COMM' mdlKitchenIpodComm
(vdvKitchenIpod, dvKitchenIpod)
define_module
'iPort_UI' mdlDenIpodUI
(vdvDenIpod, dvIpodUIs, iIportTPChannels, iIportTPVTChannels, iIportTPLevels, TP_UI_LIST, nR4_DMS_PORT1, nR4_DMS_PORT2)
define_module
'iPort COMM' mdlDenIpodComm
(vdvDenIpod, dvDenIpod)
Perhaps I am misunderstanding what you are saying.
Paul
I might end up doing that, but for now this method seems to work. This way I can use the least amount of memory too. Not much with one iPort, more with more iPorts. I wish Jon had kept the UI code separate from the parsing code though to make it easier to integrate but it didn't take as much work as I thought it would.
Paul