sendHeartbeat not work right


  • Hardware Contributor

    I send Heartbeat, but receive in system I_DISCOVER_RESPONSE

    Sketch code

    void loop() {
       unsigned long tick = millis();
       if (tick - previsionTime > HeartBitInterval) {
         previsionTime = tick;
         sendHeartbeat(); 
       }
    }
    

    Node log

    __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    
    ...
    
    14960 TSF:MSG:SEND,115-115-0-0,s=2,c=1,t=2,pt=1,l=1,sg=0,ft=0,st=OK:1
    48934 TSF:MSG:READ,0-0-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
    48941 TSF:MSG:BC
    49762 TSF:MSG:SEND,115-115-0-0,s=255,c=3,t=21,pt=1,l=1,sg=0,ft=0,st=OK:0
    49772 TSF:MSG:READ,0-5-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
    49780 TSF:MSG:BC
    49782 TSF:MSG:READ,0-6-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
    49788 TSF:MSG:BC
    1254332 TSF:MSG:READ,0-0-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
    1254340 TSF:MSG:BC
    1255313 TSF:MSG:SEND,115-115-0-0,s=255,c=3,t=21,pt=1,l=1,sg=0,ft=0,st=OK:0
    1255323 TSF:MSG:READ,0-5-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
    1255331 TSF:MSG:BC
    

    Log in system: MajorDomo

    2018-11-29 10:26:19 699 >> 3:Internal; Gate:1; Node:115; Sensor:255; Ack:0; Sub:21:I_DISCOVER_RESPONSE; Msg:0
    2018-11-29 10:25:47 133 >> 1:Set; Gate:1; Node:115; Sensor:2; Ack:0; Sub:2:V_STATUS; Msg:1
    
    ...
    


  • @ivan-z said in sendHeartbeat not work right:
    Not quite sure, but imo the node doesn't enter loop() at all. Sure it is registered to the controller?
    You may add some serial output when loop() is processed the first time (or use setup() routine)


  • Hardware Contributor

    This is only part of the code.

    Full version sketch
    https://github.com/Shagrat2/MSMDLed/blob/master/MSMDLed.ino



  • @ivan-z Wow, looks great!
    Nevertheless make sure, loop() is effectively entered.
    So first step for debugging might be to add a

    Serial.println("Entering  - before()");
    

    at the beginning of the corresponding subroutine (do this for before(), presentation() and setup() and at the end of setup(), I'd recommend an additional Serial.println("exiting setup()";.


  • Hardware Contributor

    before = work
    presentation = work
    setup = work

    ???



  • Is setup() also exiting correctly or only entering?
    If all this happens, add a one-time routine in loop().


Log in to reply
 

Suggested Topics

  • 3
  • 8
  • 2
  • 6
  • 6

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts