online code doesn?t work inside a module
MorgoZ
Posts: 116
Hello!
I?ve created a module with a DATA_EVENT[dvTp] online code inside of it, and it works strange for me.
the program only executes the online code when the master is power off and then power on, but the online event doesn?t get executed when i reboot the master or the touch panels, is it normal or is there something that i?m missing?
I?ve put the define_module statements after the DEFINE_VARIABLE section of the main program.
Any help?
Thanks and salutes!!!
I?ve created a module with a DATA_EVENT[dvTp] online code inside of it, and it works strange for me.
the program only executes the online code when the master is power off and then power on, but the online event doesn?t get executed when i reboot the master or the touch panels, is it normal or is there something that i?m missing?
I?ve put the define_module statements after the DEFINE_VARIABLE section of the main program.
Any help?
Thanks and salutes!!!
0
Comments
The online event works fine inside a module, the problem is that the device that i check for its online event (a touch panel) is defined at the DEFINE_START section of the main code, and it seems to be that the modules are executed before the DEFINE_START, so there is no device defined when the module is defined.
I need to define the device at the DEFINE_START because it is inside of a structure, and i think that the structures have to be initialized at the DEFINE_START, don?t they?
So, if you think that i can initialize the device (of the structure) somehow to define it before the module, please tell me.
Thanks!!!!!
But I think it is more a problem of the DEFINE_START at all. DEFINE_START would be passed after reboot much earlier than the panel would be online. So a simple routine like would fail.
Another issue may be the so called Event table. The NetLinx compiler creates this table which includes any device/channel/Level/Timeline Event ID used in the code at compile time, not at program start. So it is "fixed" and it would not be possible to use a variable i.e for a device in a button_event without recreating this table.
To get the above to work, the command REBUILD_EVENT() must be used to recreate the event table. See language manual for more details. See details to REBUILD_EVENT() in the NetLinx langauge manual, or type it in studio and hit F1
Once i read about this sentence, but i didn?t notice that it could help me now
Salutes!!