MYSController REQUEST_PRESENTATION thing on build 3314



  • One for @TEKKA I suppose

    I'm having a problem getting request_presentation to work it looks like that if you have more than one send command it transmits over the request presentation message and hence you never receive it.

    This code dosen't work

    send(rtc.set(timeBuff));
    send(temp.set(celsius, 2));
    send(vbattery.set(voltage, 2));
    sendBatteryLevel(batLevel);

    smartSleep(digitalPinToInterrupt(INTERRUPT_PIN),FALLING,0);

    This code does work

    send(rtc.set(timeBuff));
    wait(100);
    send(temp.set(celsius, 2));
    send(vbattery.set(voltage, 2));
    sendBatteryLevel(batLevel);

    smartSleep(digitalPinToInterrupt(INTERRUPT_PIN),FALLING,0);

    It seems that the wait I have put in there between the sends allows the presentation message through as it seems to be sent after the first message is received and maybe it should be sent after the I_HEARTBEAT_RESPONSE instead.

    Got any thoughts on this


  • Mod


  • Admin

    @doug This is not MYSController related, but as @mfalkvidd hinted at, a GW speed issue (RX FIFO full & GW too slow to process all messages)



  • My apologies I'm not sure I explained the issue very well can I try again.

    What happens on MYSController 3314 is that the request presentation message is sent after the first message has been received. Hence it is transmitting at the same time as the node sends/transmits the next sensors data.

    I guess the code extract from MySensorsCore.cpp below shows that the waiting period for the presentation message from the controller starts after the heartbeat is sent. This methodology of sending the heartbeat after all the messages have been sent tells the controller that it is ok now to respond as I'm not going to send anything else and its safe to send me something.

    int8_t smartSleep(unsigned long ms) {
    // notify controller about going to sleep
    sendHeartbeat();
    // listen for incoming messages
    wait(MY_SMART_SLEEP_WAIT_DURATION);
    return sleep(ms);
    }

    Hence I guess any controller should really wait until the heartbeat is sent before transmitting the request presentation message rather than replying after the first send is received.

    The messing around with the wait(100) between sends was really just to confirm that the request presentation message was being received before the heartbeat was being sent which it confirms as it works. I.e it gives a window where the message can be received before the second sensor sends its data.

    I must say though that I do love this application and thanks for putting the effort into creating it.


  • Admin

    @doug I see, there are still some changes pending to rhe smartsleep function and a dedicated message type indicating the node is going to sleep (and waiting for a short time for commands). I will adjust MYSController thereafter.


Log in to reply
 

Suggested Topics

55
Online

11.4k
Users

11.1k
Topics

112.7k
Posts