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?
@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!
-
@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
@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!
-
@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!
@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?
-
@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?
@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?
-
@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?
@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.
-
@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?
@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?
-
@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?
@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
-
@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
-
@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?
/** * @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 :-(
-
/** * @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 :-(
@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.
-
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); } } } } } -
@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.
@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.