ESP8266 offline loop



  • Dear all,

    I would like to make my ESP gateway to be able to do something even though if it is offline/trying to connect to wifi or MQTT.

    I've made a test, I restart my router but the ESP gives an error and restart itself.
    Here is the log: (the repetative 6,3,1 is the WiFi.status() printed)

    Ȥl⸮⸮⸮H⸮⸮⸮D:h⸮?⸮⸮0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGE--,VER=2.1.1
    sta config unchangedscandone
    f 0, scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 2
    cnt 
    6
    .6
    
    connected with Xiaomi, channel 1
    ip:192.168.1.202,mask:255.255.255.0,gw:192.168.1.1
    wifi evt: 0
    wifi evt: 3
    .WIFI connected - IP: 192.168.1.202
    0;255;3;0;9;MCO:BGN:STP
    Booting
    OTA server at: esp8266-30dde1.local:8266
    Ready
    0;255;3;0;9;MCO:REG:NOT NEEDED
    3
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
    WIFI connected - IP: 192.168.1.202
    0;255;3;0;9;Attempting MQTT connection...
    :ref 1
    :wr
    :sent 22
    :rn 4
    :ww
    :c0 1, 4
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mygateway-out/1/255/0/0/17
    :wr
    :sent 35
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/255/3/0/11
    3
    :wr
    :sent 54
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/255/3/0/12
    :wr
    :sent 33
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/0/0/0/3
    :wr
    :sent 27
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/1/0/0/3
    :wr
    :sent 27
    :ww
    :wr
    :sent 29
    :rn 5
    3
    :ww
    Request old state
    0;255;3;0;9;Sending message on topic: mygateway-out/1/0/2/0/2
    :wr
    :sent 27
    :ww
    :c0 1, 5
    :rn 27
    :c0 1, 27
    0;255;3;0;9;Message arrived on topic: mygateway-in/1/0/1/0/2
    -----------START SEND TO HARDWARE-------------------------
    relay no.:0, relay pin no.:5, new relay state:0
    -----------END SEND TO HARDWARE-------------------------
    Incoming change for sensor:0, New status: 0
    3
    3
    0;255;3;0;9;Sending message on topic: mygateway-out/1/1/2/0/2
    :wr
    :sent 27
    :ww
    :rn 27
    :c0 1, 27
    0;255;3;0;9;Message arrived on topic: mygateway-in/1/1/1/0/2
    -----------START SEND TO HARDWARE-------------------------
    relay no.:1, relay pin no.:0, new relay state:0
    -----------END SEND TO HARDWARE-------------------------
    Incoming change for sensor:1, New status: 0
    3
    3
    3
    3
    3
    3 -- this the WiFi.status() printed to serial approx every sec
    3
    3
    3
    3
    3
    3
    3
    pm open,type:2 0
    3
    3
    3
    ////// SOMEWHERE HERE I REBOOTED MY ROUTER SWITCHING OFF IT'S WIFI
    3
    3
    3
    3
    bcn_timout,ap_probe_send_start // GIVES THIS ERROR FIRST
    3
    3
    3
    3
    3
    ap_probe_send over, rest wifi status to disassoc
    state: 5 -> 0 (1)
    rm 0
    pm close 7
    f r0, wifi evt: 1
    STA disconnect: 200
    :ur 1
    :close
    :del
    :ur 1
    
    Panic C:\Users\M⸮rk\Documents\Arduino\libraries\MySensors/core/MyMainESP8266.cpp:140 loop_task // then it resets itself
    
    ctx: sys 
    sp: 3ffffdd0 end: 3fffffb0 offset: 01b0
    
    >>>stack>>>  ///Sometimes this stack is much longer
    3fffff80:  4021f672 3fffdab0 00000000 3ffeefd0  
    3fffff90:  00000000 3fffdad0 3ffeefbc 402023e0  
    3fffffa0:  40000f49 40000f49 3fffdab0 40000f49  
    <<<stack<<<
    ⸮⸮⸮⸮L⸮⸮DH⸮0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGE--,VER=2.1.1
    sta config unchangedscandone
    f 0, scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    6
    reconnect
    f -180, .6
    .6
    .6
    .6
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f r0, .6
    .6
    .6
    .6
    .scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f 0, 1
    .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f -180, .1
    .1
    .1
    .1
    .scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f r0, 1
    .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f 0, .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    .reconnect
    f -180, 1
    .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f r0, .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    .reconnect
    f 0, 1
    .1
    .1
    .1
    .scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    1
    reconnect
    f -180, .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f r0, .1
    .1
    .1
    .1
    .scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    1
    reconnect
    f 0, .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f -180, .1
    .1
    .1
    .1
    .scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f r0, 1
    .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f 0, .1
    .1
    .1
    .1
    .scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f -180, 1
    .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f r0, .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    .reconnect
    f 0, 1
    .1
    .1
    .1
    .1
    scandone
    no Xiaomi found, reconnect after 1s
    wifi evt: 1
    STA disconnect: 201
    reconnect
    f -180, .1
    .1
    .1
    .1
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 1
    cnt 
    chg_B1:-140
    .6
    
    connected with Xiaomi, channel 1
    ip:192.168.1.202,mask:255.255.255.0,gw:192.168.1.1
    wifi evt: 0
    wifi evt: 3
    .WIFI connected - IP: 192.168.1.202
    0;255;3;0;9;MCO:BGN:STP
    Booting
    OTA server at: esp8266-30dde1.local:8266
    Ready
    0;255;3;0;9;MCO:REG:NOT NEEDED
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
    3
    WIFI connected - IP: 192.168.1.202
    0;255;3;0;9;Attempting MQTT connection...
    chg_B1:-100
    chg_B1:-60
    :err -8
    3
    Request old state
    WIFI connected - IP: 192.168.1.202
    0;255;3;0;9;Attempting MQTT connection...
    :ref 1
    3
    :wr
    :sent 22
    :rn 4
    :ww
    :c0 1, 4
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mygateway-out/1/255/0/0/17
    :wr
    :sent 35
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/255/3/0/11
    :wr
    :sent 54
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/255/3/0/12
    :wr
    :sent 33
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/0/0/0/3
    3
    :wr
    :sent 27
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/1/0/0/3
    :wr
    :sent 27
    :ww
    :wr
    :sent 29
    :rn 5
    :ww
    0;255;3;0;9;Sending message on topic: mygateway-out/1/1/2/0/2
    :wr
    :sent 27
    :ww
    :c0 1, 5
    :rn 27
    :c0 1, 27
    0;255;3;0;9;Message arrived on topic: mygateway-in/1/1/1/0/2
    -----------START SEND TO HARDWARE-------------------------
    relay no.:1, relay pin no.:0, new relay state:0
    -----------END SEND TO HARDWARE-------------------------
    3
    Incoming change for sensor:1, New status: 0
    pm open,type:2 0
    3
    3
    3
    

    What should I do to be able to still run the loop while it is trying to reconnect?

    Thank you!
    Mark





  • @blacksheepinc anyone?



  • @blacksheepinc It is a watchdog reset, thats fix. But idk if it's software or hardware.
    The booting init (baud rate 115000) says it is hardware reset, but system_get_rst_info() says it is Software watchdog reset. Which is probably not true, because it resets it's GPIO states.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.