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


  • administrators

    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.