Device Mappings - Wow!
Reese Jacobs
Posts: 347
For most of my projects, I do not use the Device Mapping feature in Studio. This morning, I happened to notice that in one of my large projects, all of my device mappings indicated 'Invalid Device'. I don't recall this problem until moving to Studio 3.3 and I am now on 3.4 but the problem remains. I checked over the forums and found similar problems and checked the items mentioned in those posts (DEFINE_DEVICE in lower case, #IF_DEFINED used to re-define the same devices, etc.). None of these previously noted corrections were applicable in my case.
I therefore spent time this afternoon editing the file until the device mappings appeared and what I was found was nothing short of amazing (to me anyway!). As it turns out, at the same time I upgraded to Studio 3.3, I had gone through the main program file for this large project and added comments to the DEFINE_DEVICE section. Many of the comments were multi-line using (* and *) for the comment blocks. As it turns out, the use of this comment construct is the problem. In particular, if your comment spans multiple lines (a comment block) using (* and *), you may well have devices following the first of those comment blocks that do not appear in Device Mappings. A single line comment using (* and *) does not create a problem. If you convert all of the multi-line comments to use // instead, the Device Mappings work as they should. In short, if you are having trouble with Device Mappings and you use (* and *) for multi-line comments in your DEFINE_DEVICE section, check it out.
And yes, the module did compile correctly with the (* and *) comment delimeters and the devices (several hundred of them) were correctly defined before converting the multi-line comments to use // instead. The only problem was that the devices did not show up in the Device Mapping dialog. For anyone with Device Mapping issues, add this to the list of things to check.
I therefore spent time this afternoon editing the file until the device mappings appeared and what I was found was nothing short of amazing (to me anyway!). As it turns out, at the same time I upgraded to Studio 3.3, I had gone through the main program file for this large project and added comments to the DEFINE_DEVICE section. Many of the comments were multi-line using (* and *) for the comment blocks. As it turns out, the use of this comment construct is the problem. In particular, if your comment spans multiple lines (a comment block) using (* and *), you may well have devices following the first of those comment blocks that do not appear in Device Mappings. A single line comment using (* and *) does not create a problem. If you convert all of the multi-line comments to use // instead, the Device Mappings work as they should. In short, if you are having trouble with Device Mappings and you use (* and *) for multi-line comments in your DEFINE_DEVICE section, check it out.
And yes, the module did compile correctly with the (* and *) comment delimeters and the devices (several hundred of them) were correctly defined before converting the multi-line comments to use // instead. The only problem was that the devices did not show up in the Device Mapping dialog. For anyone with Device Mapping issues, add this to the list of things to check.
0
Comments
Paul
Thanks in advance.
I do have to wonder: what kind of system needs several hundred devices? That seems excessive.
Unless you're using multiple touchpanels and modules with dozens of D:P:S each, the utility of which practice escapes me, but I know that's what they teach these days.
.
Sure! If you look at the right hand side of the device mapping window where all the defined devices are listed, the very top entry is "<Custom>.........User-Defined". Punch in the D:P:S and you're set. This is now "hard-coded" into your workspace so if your device changes you'll have to remember to change the D:P:S yourself, but no more problems with auto-mapped devices dissappearing.