REXYGEN Community Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Login

    How to replace a 1-Wire sensor/actuator without restarting REXYGEN runtime core (RexCore)?

    1-Wire
    1-wire owfs owsdrv
    1
    1
    823
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cechuratC
      cechurat
      last edited by cechurat

      All the 1-Wire devices are referenced by a "path" of the OWFS package (namely the owserver), which the 1-Wire driver of REXYGEN relies on. This "path" is hardcoded in the compiled application and it typically includes the 64-bit ID of the 1-Wire device, e.g. /28.551DDF030000/temperature12

      Replacing a sensor therefore normally means you have to reconfigure the 1-Wire driver in your project, recompile it and download it to the target device, resulting in restarting the whole application, which is undesirable in some cases.

      Luckily, the OWFS package supports the so-called aliases for individual 1-Wire devices. If you define the aliases, you can reference them in 1-Wire driver configuration in REXYGEN Studio. This adds one layer of hardware abstraction, which will allow you to replace a 1-Wire sensor/actuator on the fly if needed. In case of replacing the 1-Wire device, you'll just update the alias definition. But for REXYGEN runtime core, everything will look the same.

      Configuring OWFS aliases

      Please add the following line to your /etc/owfs.conf:

      alias = /etc/ow-alias
      

      Now create the file with aliases definition:

      sudo nano /etc/ow-alias
      

      And put the following content in (replace the 1-Wire IDs with the IDs of your own devices!):

      /28.063BC8040000 = sensor1
      /28.1FBFBC020000 = sensor2
      

      Save the file and restart owserver:

      sudo systemctl restart owserver
      

      Now run owdir and you should see your aliases. Also you can use

      owread /sensor1/temperature12
      

      to read the temperature.

      And you can use /sensor1/temperature12 in the OwsDrv driver configuration in REXYGEN Studio.
      0_1551109384447_OwsDrv_conf.png

      As a result, you'll be able to replace a 1-Wire sensor/actuator without restarting REXYGEN runtime core (RexCore). In such a case, the only thing which you will need to do is editing the ID in /etc/ow-alias file and restarting the owserver.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      This is a community forum for REXYGEN users and fans. Detailed information can be found at REXYGEN homepage.

      There is also an outdated REXYGEN community forum.

      Powered by NodeBB.