S_COMBO to merge multiple sensors input



  • S_COMBO/V_COMBO new mode in order to merge multiple sensors value in a single message
    The basic structure should be like this:

    When type is S_COMBO/V_COMBO, the payload is made with multiple (uint8 variable-type, uint8 data[]) tuple, up to 24 bytes.
    For example, if you have a node that's temperature and humidity capable, it would send a message like this:

    MyMessage msg(CHILD_ID, V_COMBO);
    uint8 msgTemplate[] = { V_TEMP, 0, V_HUM, 0 };
    [...]
    msgTemplate[1] = readCurTemp(); msgTemplate[3] = readCurHum();
    gw.send(msg.set(msgTemplate));
    

    This would require almost no modification to the current software.
    The main advantage is saving power, only a single packet is sent (instead of multiple packets for each sensor, plus ACK).
    This limits however each type payload to one byte.
    Another improvement would be to reuse the existing parsing code by adding a MyMessage.set/get method like this:

    inline bool isCombo() const { return type == V_COMBO; }
    MyMessage & setCombo(uint8_t pos, uint8_t type, uint8_t value) 
    { 
        data[pos*2] = type; data[pos*2+1] = value; 
        return *this; 
    }
    

    On the gateway, an additional case should be taken when serializing to/from Ethernet or Serial so it appears not like a combo.


  • Admin

    @X-Ryl669

    Why not just send multiple packages, one for each sensor type?



  • @tbowmo Each packages would use a single message. Here, the idea is that a single message of 32 bytes does not take more power to send than a message of 12 bytes (what's power hungry is waking up the radio, transmitting a burst). For battery powered device, it makes a difference


  • Admin

    Interesting idea,

    Maybe you could let gateway unpack the COMBO message before handing it over to controller. This way no additional changes is needed on that side.

    I would appreciate if you wanted to create a github pull request (on the development branch) with your verified changes.


Log in to reply
 

Suggested Topics

2
Online

11.4k
Users

11.1k
Topics

112.7k
Posts