Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. How does it work? Sleep , WDG ..

How does it work? Sleep , WDG ..

Scheduled Pinned Locked Moved General Discussion
sleep timewatchdog
10 Posts 2 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dzairo
    wrote on last edited by
    #1

    Hi.
    I want ask for more detail about few function .
    Sleep - what timer is used and on what mode??
    Watch dog - if set in MCU fuse bit Watch dog always On .. how to set WDG in MySensor ?

    regards.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dzairo
      wrote on last edited by
      #2

      ....em ... why you not write to me that Watch dog is not possible to use because is used for sleep function..

      now better understand it..

      regards..

      gw.process(); is result true or false .. what depend what is result?
      and how to check ACK if sens pakcet to gateway??

      regards...

      1 Reply Last reply
      0
      • hekH Offline
        hekH Offline
        hek
        Admin
        wrote on last edited by
        #3

        It returns true if there is a (none-internal) message available destined for this node. But usually you would want to use the call-back functionality to pick up the messages.

        https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MySensor.cpp#L378

        Regarding sleep.. not forbidden to look in the code you know... ;)

        https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MySensor.cpp#L462

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dzairo
          wrote on last edited by
          #4

          hi hek ..
          Yes I look to source code to understand how it working ..
          for sleep function I understand for 100% .. is used watchdog as timer ..and INT0,INT1 for wake up from sleep ..

          but for ACK .. pls write the practical code how to check if send packet from (for example : BinarySwitchSleep ) node to gateway check ACK , that packet delivery for 100% to gateway.. I need to know this ...

          pls help me with this code ..

          regards ..

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #5

            https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/examples/RelayWithButtonActuator/RelayWithButtonActuator.ino

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dzairo
              wrote on last edited by
              #6

              good.. but problem is not possible for battery operated..
              I want make binary switch sleep with ack function.. is it possible??
              If send command to gateway want inform user that packet delivery for 100%.. but battery operated..

              in my house I use rf switch on the wall .. not working for 100% and are only one way (not inform if command 100% delivery) then I want new one ..
              battery operated device with ACK..

              regards

              1 Reply Last reply
              0
              • hekH Offline
                hekH Offline
                hek
                Admin
                wrote on last edited by
                #7

                Then you myst wait and call process() for a while before going to sleep or resend message.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dzairo
                  wrote on last edited by
                  #8

                  yes.. I know must wait some time .. but I don't know how to do it .. I can use some timer for waiting .. but need help with this .. then use example for relay actuator .. and if send packet from button (int0 for example) then wait some time (100ms for example) if not received ACK then beep or blink led..

                  regards

                  1 Reply Last reply
                  0
                  • hekH Offline
                    hekH Offline
                    hek
                    Admin
                    wrote on last edited by hek
                    #9

                    No need to introduce times... just use millis().

                    Pseudo code:

                    unit saved_time;
                    loop() {
                        gw.process()
                        if (value-changed-and-time-to-send) {
                             send-some-value-with-ack
                             saved_time = millis();
                        }
                        if (millis()-saved_time > 500)   // 0.5 sec
                            gotosleep
                    }
                    
                    
                    
                    
                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      dzairo
                      wrote on last edited by
                      #10

                      yeah , I will test it .. thanks . If button change then send packet with ACK , and wait .. if not ack received then error ..

                      rebards

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      14

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular