Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Repeatrer level limit (NRF24L01 transport)

Repeatrer level limit (NRF24L01 transport)

Scheduled Pinned Locked Moved Development
25 Posts 3 Posters 4.6k Views 4 Watching
  • 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.
  • B bilbolodz

    @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

    @bilbolodz first question: it might be possible using the method suggested here: https://forum.mysensors.org/topic/5410/changing-node-id-at-run-time/
    If you try it, please report back with the results. If it works we should document it somewhere where it is easier to find.

    For sure there is possibility to change ID of node "on the fly" set:

    #define MY_NODE_ID AUTO

    and send message C_INTERNAL I_ID_RESPONSE with new ID node. Working even without node reboot

    I will check your method with parent ID. I will try to check also these method with power level but I don't know how to check in programming way current NRF power.

    mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by mfalkvidd
    #10

    @bilbolodz the level is RF24_PA_HIGH unless you have an override in your sketch. See https://github.com/mysensors/MySensors/blob/10ef62307b914c88295977d58b9601d994e89117/MyConfig.h#L640

    B 1 Reply Last reply
    0
    • mfalkviddM mfalkvidd

      The radio object can be accessed through the global variable _radio (see here). Maybe you can just call the appropriate function?

      B Offline
      B Offline
      bilbolodz
      wrote on last edited by
      #11

      @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

      The radio object can be accessed through the global variable _radio (see here). Maybe you can just call the appropriate function?

      I've made a quick grep. It looks that _radio is avaliable for RFM69 transport. For NFR there is a function RF24_setRFSetup but as parameter i takes MY_RF24_RF_SETUP defined as:

      #define MY_RF24_RF_SETUP (uint8_t)( ((MY_RF24_DATARATE & 0b10 ) << 4) | ((MY_RF24_DATARATE & 0b01 ) << 3) | (MY_RF24_PA_LEVEL << 1) ) + 1 // +1 for Si24R1

      It's problematic using it for power level without messing other things!

      1 Reply Last reply
      0
      • mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #12

        See if you can change the value and call

        _radio.RF24_initialize();
        

        But I am not familiar with the inner workings of the radio code. Maybe running RF24_initialize() will have unintended side effects.

        1 Reply Last reply
        0
        • mfalkviddM mfalkvidd

          @bilbolodz the level is RF24_PA_HIGH unless you have an override in your sketch. See https://github.com/mysensors/MySensors/blob/10ef62307b914c88295977d58b9601d994e89117/MyConfig.h#L640

          B Offline
          B Offline
          bilbolodz
          wrote on last edited by
          #13

          @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

          @bilbolodz the level is RF24_PA_HIGH unless you have an override in your sketch.

          That's obvious, I'm using it. Problem is that its "#define'ed" so value of these "variable" is set during compilation and it's not possible to change it in program!

          mfalkviddM 1 Reply Last reply
          0
          • B bilbolodz

            @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

            @bilbolodz the level is RF24_PA_HIGH unless you have an override in your sketch.

            That's obvious, I'm using it. Problem is that its "#define'ed" so value of these "variable" is set during compilation and it's not possible to change it in program!

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #14

            @bilbolodz sorry, I must have misunderstood your question. You asked how to get the current power setting. I said that the current power setting will be the default value, unless you set it to something else. If you set it to something else, it will be set to the value you set it to. So just use the value you set it to? No need to get it from the radio?

            B 1 Reply Last reply
            0
            • mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by mfalkvidd
              #15

              Enabling MY_DEBUG_VERBOSE_RF24 would print the registers though. Maybe that's what you are asking for?

              1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @bilbolodz sorry, I must have misunderstood your question. You asked how to get the current power setting. I said that the current power setting will be the default value, unless you set it to something else. If you set it to something else, it will be set to the value you set it to. So just use the value you set it to? No need to get it from the radio?

                B Offline
                B Offline
                bilbolodz
                wrote on last edited by
                #16

                @mfalkvidd
                The problem is:

                My sensors network is over 30 nodes a few repeaters and so on, majority of nodes are the same hardware devices.
                I want to "tune" my network changing NRF power level and MY_PARENT_NODE_ID "on th fly" (now it's "hard defined").
                You've suggested to use method:

                int8_t myNodeId;
                
                #define MY_NODE_ID myNodeId
                
                void before () { 
                    // read I/O pins and set myNodeId
                    myNodeId = 32;
                    Serial.println( myNodeId );
                }
                

                but with MY_PARENT_NODE_ID and MY_RF24_PA_LEVEL. Good idea I will check if it working BUT:

                there MUST be a way to check remotely IF it's working. There is no problem with MY_PARENT_NODE_ID because it affect network topology and it could be easily checked. I don't know how to check "from program" current power level.

                Ideal solution would that sketch will detect current power level and suffix sketch name with _MIN, _LOW, _HIGH, _MAX.

                It would allow me to have only two version of "HEX firmware" for OTA: with or without repeater mode. Other things (parent level and ID) I could change "on the fly" sending command" (and maybe rebooting) to sensor.

                Is it clear now?

                mfalkviddM 2 Replies Last reply
                0
                • B bilbolodz

                  @mfalkvidd
                  The problem is:

                  My sensors network is over 30 nodes a few repeaters and so on, majority of nodes are the same hardware devices.
                  I want to "tune" my network changing NRF power level and MY_PARENT_NODE_ID "on th fly" (now it's "hard defined").
                  You've suggested to use method:

                  int8_t myNodeId;
                  
                  #define MY_NODE_ID myNodeId
                  
                  void before () { 
                      // read I/O pins and set myNodeId
                      myNodeId = 32;
                      Serial.println( myNodeId );
                  }
                  

                  but with MY_PARENT_NODE_ID and MY_RF24_PA_LEVEL. Good idea I will check if it working BUT:

                  there MUST be a way to check remotely IF it's working. There is no problem with MY_PARENT_NODE_ID because it affect network topology and it could be easily checked. I don't know how to check "from program" current power level.

                  Ideal solution would that sketch will detect current power level and suffix sketch name with _MIN, _LOW, _HIGH, _MAX.

                  It would allow me to have only two version of "HEX firmware" for OTA: with or without repeater mode. Other things (parent level and ID) I could change "on the fly" sending command" (and maybe rebooting) to sensor.

                  Is it clear now?

                  mfalkviddM Offline
                  mfalkviddM Offline
                  mfalkvidd
                  Mod
                  wrote on last edited by
                  #17

                  @bilbolodz yup. Thanks for clarifying.
                  And thanks for noticing that _radio is only available for rfm69. Seems a bit inconsistent to me, but there are probably reasons for it.

                  It looks like transportGetTxPowerLevel() / RF24_getTxPowerLevel() will return some sort of mapping of the current power level. But these functions are internal/private, so I don't know how to access them.

                  1 Reply Last reply
                  0
                  • mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by mfalkvidd
                    #18

                    Verifying the parent node id should be possible by calling transportGetParentNodeId() or simply getParentNodeId();

                    1 Reply Last reply
                    0
                    • B bilbolodz

                      @mfalkvidd
                      The problem is:

                      My sensors network is over 30 nodes a few repeaters and so on, majority of nodes are the same hardware devices.
                      I want to "tune" my network changing NRF power level and MY_PARENT_NODE_ID "on th fly" (now it's "hard defined").
                      You've suggested to use method:

                      int8_t myNodeId;
                      
                      #define MY_NODE_ID myNodeId
                      
                      void before () { 
                          // read I/O pins and set myNodeId
                          myNodeId = 32;
                          Serial.println( myNodeId );
                      }
                      

                      but with MY_PARENT_NODE_ID and MY_RF24_PA_LEVEL. Good idea I will check if it working BUT:

                      there MUST be a way to check remotely IF it's working. There is no problem with MY_PARENT_NODE_ID because it affect network topology and it could be easily checked. I don't know how to check "from program" current power level.

                      Ideal solution would that sketch will detect current power level and suffix sketch name with _MIN, _LOW, _HIGH, _MAX.

                      It would allow me to have only two version of "HEX firmware" for OTA: with or without repeater mode. Other things (parent level and ID) I could change "on the fly" sending command" (and maybe rebooting) to sensor.

                      Is it clear now?

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by
                      #19

                      @bilbolodz how about this? https://github.com/mysensors/MySensors/blob/726a20dad9696ed86408106061a9e0be31995b5c/core/MyTransport.h#L524

                      Sending a I_SIGNAL_REPORT_REQUEST message with the command "T" could be what you need?

                      B 2 Replies Last reply
                      0
                      • mfalkviddM mfalkvidd

                        @bilbolodz how about this? https://github.com/mysensors/MySensors/blob/726a20dad9696ed86408106061a9e0be31995b5c/core/MyTransport.h#L524

                        Sending a I_SIGNAL_REPORT_REQUEST message with the command "T" could be what you need?

                        B Offline
                        B Offline
                        bilbolodz
                        wrote on last edited by bilbolodz
                        #20

                        @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

                        Sending a I_SIGNAL_REPORT_REQUEST message with the command "T" could be what you need?

                        Unfortunately MYSController in current version doesn't support I_SIGNAL_REPORT_REQUEST message. I will try it in code, thanks

                        B 1 Reply Last reply
                        0
                        • B bilbolodz

                          @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

                          Sending a I_SIGNAL_REPORT_REQUEST message with the command "T" could be what you need?

                          Unfortunately MYSController in current version doesn't support I_SIGNAL_REPORT_REQUEST message. I will try it in code, thanks

                          B Offline
                          B Offline
                          bilbolodz
                          wrote on last edited by
                          #21
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • mfalkviddM mfalkvidd

                            @bilbolodz how about this? https://github.com/mysensors/MySensors/blob/726a20dad9696ed86408106061a9e0be31995b5c/core/MyTransport.h#L524

                            Sending a I_SIGNAL_REPORT_REQUEST message with the command "T" could be what you need?

                            B Offline
                            B Offline
                            bilbolodz
                            wrote on last edited by bilbolodz
                            #22

                            @mfalkvidd

                            /**
                            * @brief Get transport signal report
                            * @param command:
                            * R = RSSI (if available) of incoming @ref I_SIGNAL_REPORT_REQUEST message (from last hop)
                            * R! = RSSI (if available) of ACK to @ref I_SIGNAL_REPORT_REVERSE message received from last hop
                            * S = SNR (if available) of incoming @ref I_SIGNAL_REPORT_REQUEST message (from last hop)
                            * S! = SNR (if available) of ACK to @ref I_SIGNAL_REPORT_REVERSE message received from last hop
                            * P = TX powerlevel in %
                            * T = TX powerlevel in dBm
                            * U = Uplink quality (via ACK from parent node), avg. RSSI
                            * @return Signal report (if report is not available, INVALID_RSSI, INVALID_SNR, INVALID_PERCENT, or INVALID_LEVEL is sent instead)
                            */
                            int16_t transportSignalReport(const char command);
                            
                            /**
                            * @brief Get transport signal report
                            * @param signalReport
                            * @return report
                            */
                            int16_t transportGetSignalReport(const signalReport_t signalReport);
                            

                            These functions are available only in devlopment branch. Not implemented into stable code :-(

                            mfalkviddM 1 Reply Last reply
                            0
                            • B bilbolodz

                              @mfalkvidd

                              /**
                              * @brief Get transport signal report
                              * @param command:
                              * R = RSSI (if available) of incoming @ref I_SIGNAL_REPORT_REQUEST message (from last hop)
                              * R! = RSSI (if available) of ACK to @ref I_SIGNAL_REPORT_REVERSE message received from last hop
                              * S = SNR (if available) of incoming @ref I_SIGNAL_REPORT_REQUEST message (from last hop)
                              * S! = SNR (if available) of ACK to @ref I_SIGNAL_REPORT_REVERSE message received from last hop
                              * P = TX powerlevel in %
                              * T = TX powerlevel in dBm
                              * U = Uplink quality (via ACK from parent node), avg. RSSI
                              * @return Signal report (if report is not available, INVALID_RSSI, INVALID_SNR, INVALID_PERCENT, or INVALID_LEVEL is sent instead)
                              */
                              int16_t transportSignalReport(const char command);
                              
                              /**
                              * @brief Get transport signal report
                              * @param signalReport
                              * @return report
                              */
                              int16_t transportGetSignalReport(const signalReport_t signalReport);
                              

                              These functions are available only in devlopment branch. Not implemented into stable code :-(

                              mfalkviddM Offline
                              mfalkviddM Offline
                              mfalkvidd
                              Mod
                              wrote on last edited by mfalkvidd
                              #23

                              @bilbolodz yes. Everything in MySensors started off in the development branch :) It takes time and effort to code and test. What you're asking for is interesting, but historically it has not been interesting enough for anyone to "man up" and spend the time needed.

                              B 1 Reply Last reply
                              0
                              • B Offline
                                B Offline
                                bilbolodz
                                wrote on last edited by
                                #24

                                It looks that I've achieved my goal. I'm able dynamically change parent id node (proved in lab) and power level (don't have idea how to check it). You can send V_VAR1 message with number of preferred parent or V_VAR2 with requested power (values: 0 - RF24_PA_MIN, 1 - RF24_PA_LOW, 2 - RF24_PA_HIGH, RF24_PA_MAX) and then REBOOT node (required to changes take effect). Version of sketch reported to controller is changed dynamically depends of set power level.

                                My "repeater: code bellow:

                                #define SKETCH_NAME "Repeater Node L1"
                                #define SV "1.0.1" 
                                #define MY_RADIO_NRF24
                                #define MY_REPEATER_FEATURE
                                
                                int8_t myParrentNodeId;
                                int8_t myRF24PALevel;
                                
                                #define MY_PARENT_NODE_ID myParrentNodeId
                                #define MY_RF24_PA_LEVEL myRF24PALevel
                                
                                #include <MySensors.h>
                                
                                #ifndef MY_REPEATER_FEATURE
                                #define SKETCH_VERSION1 SV
                                #else
                                #define SKETCH_VERSION1 SV "R"
                                #endif
                                
                                #define SKETCH_VERSION SKETCH_VERSION1 "   "
                                
                                uint8_t SketchVersion[sizeof(SKETCH_VERSION)];
                                
                                #define EEPROM_PARENT 0
                                #define EEPROM_PA_LEVEL 1
                                
                                void before() {
                                
                                  int8_t tmpui = loadState(EEPROM_PARENT);
                                  if (tmpui == 0xFF)
                                  {
                                    myParrentNodeId = 0;
                                  }
                                  else {
                                    myParrentNodeId = tmpui;
                                  }
                                
                                  memcpy(SketchVersion, SKETCH_VERSION, sizeof(SKETCH_VERSION));
                                
                                  tmpui = loadState(EEPROM_PA_LEVEL);
                                  switch (tmpui)
                                  {
                                    case 0:
                                      myRF24PALevel = RF24_PA_MIN;
                                      memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "MIN", 3);
                                      break;
                                    case 1:
                                      myRF24PALevel = RF24_PA_LOW;
                                      memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "LOW", 3);
                                      break;
                                    case 2:
                                      myRF24PALevel = RF24_PA_HIGH;
                                      memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "HIG", 3);
                                      break;
                                    case 3:
                                      myRF24PALevel = RF24_PA_MAX;
                                      memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "MAX", 3);
                                      break;
                                    default:
                                      myRF24PALevel = RF24_PA_MAX;
                                      break;
                                  }
                                }
                                
                                void setup()
                                {
                                
                                }
                                
                                void presentation()
                                {
                                  //Send the sensor node sketch version information to the gateway
                                  //sendSketchInfo("Repeater Node L1 MAX", "1.0");
                                  sendSketchInfo(SKETCH_NAME, SketchVersion);
                                }
                                
                                void loop()
                                {
                                }
                                
                                void receive(const MyMessage &message) {
                                  if (!message.isAck()) {
                                    if (message.type == V_VAR1) {
                                      uint8_t tmpui = message.getByte();
                                      uint8_t tmpui1 = loadState(EEPROM_PARENT);
                                      if (tmpui != tmpui1)
                                      {
                                        saveState(EEPROM_PARENT, tmpui);
                                      }
                                    }
                                    else if (message.type == V_VAR2)
                                    {
                                      uint8_t tmpui = message.getByte();
                                      uint8_t tmpui1 = loadState(EEPROM_PA_LEVEL);
                                      if (tmpui >= 0 && tmpui <= 3)
                                      {
                                        if (tmpui != tmpui1)
                                        {
                                          saveState(EEPROM_PA_LEVEL, tmpui);
                                        }
                                      }
                                    }
                                  }
                                }
                                
                                1 Reply Last reply
                                2
                                • mfalkviddM mfalkvidd

                                  @bilbolodz yes. Everything in MySensors started off in the development branch :) It takes time and effort to code and test. What you're asking for is interesting, but historically it has not been interesting enough for anyone to "man up" and spend the time needed.

                                  B Offline
                                  B Offline
                                  bilbolodz
                                  wrote on last edited by
                                  #25

                                  @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

                                  Everything in MySensors started off in the development branch

                                  If you are using dev branch please test my sketch and check changing power mode with I_SIGNAL_REPORT_REQUEST message or transportGetSignalReport(const signalReport_t signalReport) function.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  9

                                  Online

                                  11.7k

                                  Users

                                  11.2k

                                  Topics

                                  113.1k

                                  Posts


                                  Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • MySensors
                                  • OpenHardware.io
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular