Module Loading By System Number
danportugal
Posts: 14
Is it possible to do this? to only DEFINE_MODULE based on system number at runtime?
I'm getting a compiler on this:
DEFINE_START IF (SYSTEM_NUMBER == 1) { DEFINE_MODULE 'EventScheduler' modEvent01On(vdvEventScheduler01)
0
Comments
Unfortunately you can't use a variable there but I'd maybe suggest a compiler directive instead? Is that workable for the task? Say each system has a master source file that sets that and any other compiler directives.. and the rest of the code comes in as a common include?
I intend to have the same source code file to be loaded on all 7 processors.
Since all touch panels will need to access some information parsed/processed in all processors.
My DEFINE_DEVICE statements are not x:x:0, they are all defined with system numbers even the virtual devices.
What i did was modify the module to have a "EnableThisModule" variable. If the system number of the virtual device matches, then the module is enabled. So channel events, levels, commands, timelines, etc. all watch the variable and only progress if it's enabled. Otherwise it just sits there doing nothing really other than take up memory. I thought about having it sync' it's local memory to the 'master' via data_event:string, but that would create some confusion as to whose triggering the schedule (local mem/proc vs. remote proc).
If your modules are duet, you can offload and reload based on different things at run time. This is an advanced topic, but several here on the forum are familiar and a few in support can assist. Investigate CONFIRGURING APPLICATION DEFINED DEVICES ~pg62 here:
https://adn.harmanpro.com/site_elements/resources/2147_1522087829/NX-Series.WebConsole-ProgrammingGuide_original.pdf