sendTxPowerLevel and sendSignalStrength



  • Hi, I'm interested on using the functions in the post title. I'm running Mysensors 2.2.0., and I have

    #define MY_SIGNAL_REPORT_ENABLED
    

    in my sketch.

    If I add something like

    sendSignalStrength (6);
    

    or

    sendTxPowerLevel (6);
    

    to my sketch, the Arduino compiler complains about undefined references.

    What do I need to do to get them working?

    Thanks.



  • With pleasure, too, I want comments from the founding fathers. How to use? Linker error.


  • Hardware Contributor

    Hi,

    • when you enable MY_SIGNAL_REPORT_ENABLED, it should automatically send signal quality to the controller. Ideally controller could handle this message type. It is an internal message type I_
    • I think these two functions doesn't work because they aren't implemented yet, maybe simply an oversight or an artefact 🙂

    To directly get the signal value, you can use transportGetSignalReport() .

    If report is not available for a particular mcu, or a radio module (because of not provided by the hardware itself or not implemented yet), then it should return INVALID_RSSI, INVALID_SNR, INVALID_PERCENT, or INVALID_LEVEL



  • @scalz said in sendTxPowerLevel and sendSignalStrength:

    they aren't implemented yet

    this is the most important..



  • int16_t RSSIQuality;
    typedef enum {
      I_SIGNAL_REPORT_QUALITY  = 35, //!< Device signal quality
    } custom_mysensors_internal_t;
    
    #define MY_RADIO_NRF5_ESB
    #define MY_NODE_ID 200
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC
    #define MY_TRANSPORT_UPLINK_CHECK_DISABLED
    
    #include <MySensors.h>
    #define CHILD_ID 0
    MyMessage msg(CHILD_ID, V_TEMP);
    
    void setup() {
    }
    
    void loop() {
      send(msg.set(25.0 + random(0, 30) / 10.0, 2),1);
      RSSIQuality = calculationRssiRxQuality();
      sendSignalStrength(RSSIQuality, 1);
      wait(3000, C_INTERNAL, I_SIGNAL_REPORT_QUALITY);
      CORE_DEBUG(PSTR("MyS: TEST WAIT\n"));
      wait(5000);
    }
    
    //****************************** very experimental *******************************
    
    bool sendSignalStrength(const int16_t level, const bool ack)
    {
      return _sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_SIGNAL_REPORT_QUALITY,
                              ack).set(level));
    }
    int16_t calculationRssiRxQuality() {
      int16_t nRFRSSI_temp = transportGetReceivingRSSI();
      int16_t nRFRSSI = map(nRFRSSI_temp, -85, -40, 0, 100);
      if (nRFRSSI < 0) {
        nRFRSSI = 0;
      }
      if (nRFRSSI > 100) {
        nRFRSSI = 100;
      }
      return nRFRSSI;
    }
    


  • 71539 TSF:MSG:SEND,200-200-0-0,s=255,c=3,t=35,pt=2,l=2,sg=0,ft=0,st=OK:42
    71546 TSF:MSG:READ,0-0-200,s=255,c=3,t=35,pt=2,l=2,sg=0:42
    

  • Hardware Contributor

    @berkseo
    yes, until now it has been implemented for rfm radios only, as nrf24 doesn't provide true rssi value. As usual, features appears along interests.
    So if you want it for nrf5, maybe post/PR your snippet on github 😉
    On my side no time for testing this, my mysensors HA isn't 2.4ghz based as I need longer range, and keep 2.4ghz bandwidth in case for others protocol (wifi, ble, zigbee) for limiting issues.


 

236
Online

8.4k
Users

9.3k
Topics

97.9k
Posts