Announcement

Collapse
No announcement yet.

HS2 passing a setting trough a device

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HS2 passing a setting trough a device

    Hi.
    Is there a practical way of using a device to enter a setting, like the COM Port used by the com event handler? That way I could just change a simple setting and some variable in the scripts would be updated without the need to have to look into all scripts for a reference to change.
    Thank you

    #2
    If you are using the COM port in a script then yes you can use a device to hold the value for the port without an issue so it is possible to change the device value and then the port to use this new value but a plugin probably not. You will be reliant on re-opening the port for the new setting though.

    Something like

    hs.opencomportex(hs.devicevalue("A1"),"9600,N,8,1".....etc)

    Where A1 holds the value of the com port (COM1 could be value 1, COM2 2 etc)

    Another option is to hold the COM port number in a global variable although you need to recreate them at startup.

    Comment


      #3
      But that is just my problem. How do I make "A1" hold the COM port in use? Is there a way to just go to the device list, click on COM PORT and enter a new number?

      Comment


        #4
        Not really - HS2 does not support things like that (HS3 allows you to have a text box, HS2 does not) so you would have to have a fixed set of values already programmed into the device using something like hs.devicevalueadd. I think a global variable might be more of a good idea, or a setting in an ini file (you could use the HS settings.ini file if you wanted) that you can change. I wonder though is this something that you can see yourself using regularly? Seems a fair bit of effort to only change a number in a script...

        Comment


          #5
          I see. Thank you for your reply.
          Every time I connect a module with the FTDI chip in it, my computer assigns it a new COM number. It happened once and it was a lot of trouble having to look for all those com references to change them. If I could assign it as a text to a device and change it when necessary, it would spare me of all that low level fuss.
          But I guess using a Global variable in the ini would do the trick.
          I'll give it a try.

          One more step in the direction of H$3
          Once again, thank you.

          Comment

          Working...
          X