Module Instance
TouchToBegin
Posts: 15
Is there any thing that can be done to make known a particular instance of a module in code?
This would be for debugging pusposes. I use the same variable names for a lot of things in all my modules and I would like to know which module was sending info to the console without putting in a bunch of specific code. Something like send_string 0, "INSTANCE.NAME" would be great.
This would be for debugging pusposes. I use the same variable names for a lot of things in all my modules and I would like to know which module was sending info to the console without putting in a bunch of specific code. Something like send_string 0, "INSTANCE.NAME" would be great.
0
Comments
- Chip
Pass each module a name through its header; include in each module a function called Debug which prepends that name to your string to send.
This allowed me to insert a room number into each module instance therefore each one effectively becomes discrete in the way it reported using send_string 0.
This is all obviously a 'no brainer' if the module is your own as you can modify it at will, but for modules by others, it's a bit more difficult.
My two bobs worth
If you had something like this:
MODULE_NAME='RuncoComm' (DEV vdvDisplay, DEV dvDisplay)
You could do something like this:
SEND_STRING 0, "'Hello From: ',ITOA(vdvDisplay.NUMBER)"
Or if you want to deal with a real device with multiple systems you have these at your disposal also:
dvDisplay.PORT
dvDisplay.SYSTEM
I?ve used this approach in the past and I think it?s as close to an INSTANCE_NAME that you can get without having to add code.
ontopic, the DEVICE.PORT doesnt really work well if you define your virtuals like i do:
vdvProjector = 33001:1:1
I take it a step further and put the whole D:P:S in. I made a quick function to make it a string: When communicating between masters on a multi-master system, I like to make my virtual devices the same on all the masters, so I need to have the system number to tell them apart.