Autor Thema: Checking to see if a display is present  (Gelesen 2891 mal)

Offline ken.mccoy

  • Newbie
  • *
  • Beiträge: 7
Checking to see if a display is present
« am: April 03, 2021, 23:25:20 Nachmittag »
Is there a clever way to determine at run time whether the software is running on an RC or RCX version of hardware?

I am re-selling Easy E4-UC-RCX1 units with a pre-installed sensor monitoring software.   

It is possible to include some enhanced features if the application is running on an Easy E4-UC-RC1 with display.  At start-up I would like to test for a display and if it's present, the program will run the full set of features and if no display is present then only a subset of features will operate.

Of course, it's possible to maintain two versions of the software but for configuration management and logistic reasons it would be nice to have a single version of the code that self-configures at run time.


Offline weiss_nix

  • Sr. Member
  • ****
  • Beiträge: 608
  • it has to be easy, it's a easy!
Antw:Checking to see if a display is present
« Antwort #1 am: April 04, 2021, 17:24:10 Nachmittag »
hello ken.mccoy!
All programming components are available on an RCX, so I assume that every program (also with display control and P keys) can be run. You just have to make sure that no user input is required in the standard mode.
greetings
Sollte ich (gefährliches) Halbwissen verbreiten, beuge ich demütig mein Haupt mit der Gewissheit versagt zu haben!
WICHTIG: Sämtliche Programme dienen lediglich der Veranschaulichung von Funktionen und sind nicht für den Produktiveinsatz geeignet!

Offline ken.mccoy

  • Newbie
  • *
  • Beiträge: 7
Antw:Checking to see if a display is present
« Antwort #2 am: April 05, 2021, 00:19:45 Vormittag »
Thanks Weiss-Nix -

You are right.   Everything seems possible on the RCX version and in fact if you look at the "display" tab on the web page supported by an RCX you can see the full display and do button pushing with your mouse.   My problem is that if a display is present I want to collect a parameter from the user at start-up to enable an enhanced calculation.  The output of that enhanced calculation will be displayed on the screen together with the usual relay activations as necessary.   But if the display is not present, then a less complicated process simply flips the relays as required.

My problem is that if I assume that I am working with an RC version with display and wait for user input, I could wait forever if in fact the code is running on an RCX version.  Conversely if I start with the assumption that a display is not present, then I never ask the user for the necessary input.

So far, my only solution is a time out option.   That is, assume an RC unit and wait 15 or 30 seconds for input.   If none is forthcoming then assume the code is running on an RCX.   But that is causes a long boot up delay and is not very elegant.    That's why I am hoping there might be a better way to test for the presence of a display 

Offline weiss_nix

  • Sr. Member
  • ****
  • Beiträge: 608
  • it has to be easy, it's a easy!
Antw:Checking to see if a display is present
« Antwort #3 am: April 05, 2021, 09:42:38 Vormittag »
Hello ken.mccoy,
i mean you think a little too complicated. If you present a start screen when you start the system for the first time, the commissioning engineer can select the range of functions. You can save the decision in a retentive variable. The start screen is not visible on an RCX, so no decision can be made about the range of functions. A time function can optionally be used for safety.
See example...

If the retentive bit M512 is set then it is an RC ...
Sollte ich (gefährliches) Halbwissen verbreiten, beuge ich demütig mein Haupt mit der Gewissheit versagt zu haben!
WICHTIG: Sämtliche Programme dienen lediglich der Veranschaulichung von Funktionen und sind nicht für den Produktiveinsatz geeignet!

Offline ken.mccoy

  • Newbie
  • *
  • Beiträge: 7
Antw:Checking to see if a display is present
« Antwort #4 am: April 05, 2021, 19:55:59 Nachmittag »
Good solution!    I had not considered the use of a retained marker bit.     Thanks