Arduino-OWI Slave , how to set m_label without touching the library

I'm using the Arduino-OWI , in particular I could successfully run the example provided in the library Example
I would like to connect about 24 slave devices (Pro Mini) on the bus and make use of the
m_owi.match_label (m_label) functionality as shown in "Driver/Arduino.h".
My today's understanding is, that I have to set the label (m_label) by executing the label_rom function in the bus master. Means I need to provide a unique full ROM address for each device first and next execute the LABEL_ROM command on the selected device on the bus.
This is a big initialization task which must be newly performed after each power up, as there is no persistence of the m_label variable.

My hope is, that I can set this m_label somehow at compilation time of my slave. In other words, I want to define some constant in the slave software, upload the code and have a fixed m_label as long I do not overwrite it from the bus.

As m_label is protected,there is no way to set it in the slave instance directly.

Maybe I could use a derived class form OWI, but my knowledge to do so is poor.
I tried it like this, but get always an error 'm_label' was not declared in this scope.
I simply tried to create a derived class just in my .ino file for the slave as a first dirty attempt.

#include <GPIO.h>
#include <OWI.h>
#include <Slave/OWI.h>
#include <Driver/Arduino.h>

class OWI_EXT : public OWI {
  public:
              
      void set_label(uint8_t nbr) {

        m_label=nbr;
      }
};



 
/** One-Wire Slave Device Bus Manager. */
Slave::OWI<BOARD::D7> owi(Arduino::FAMILY_CODE);

Hope someone has solved this already

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.