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. Bug Reports
  3. API documentation not up to date

API documentation not up to date

Scheduled Pinned Locked Moved Bug Reports
6 Posts 5 Posters 1.7k Views 5 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.
  • ybycodeY Offline
    ybycodeY Offline
    ybycode
    wrote on last edited by
    #1

    Hi,

    It seems the v2.0.x documentation has not been updated since the signature of the sleep function has changed:

    In v1.5.x:

    bool sleep(int interrupt, int mode, unsigned long ms=0)
    

    Whereas in v2.0.x:

    uint8_t sleep(int interrupt, int mode, unsigned long ms=0);
    

    ++

    yann

    TheoLT 1 Reply Last reply
    0
    • ybycodeY ybycode

      Hi,

      It seems the v2.0.x documentation has not been updated since the signature of the sleep function has changed:

      In v1.5.x:

      bool sleep(int interrupt, int mode, unsigned long ms=0)
      

      Whereas in v2.0.x:

      uint8_t sleep(int interrupt, int mode, unsigned long ms=0);
      

      ++

      yann

      TheoLT Offline
      TheoLT Offline
      TheoL
      Contest Winner
      wrote on last edited by TheoL
      #2

      @ybycode this what I found in the 2.0 API doc on the main page

      Sleeping
      
      To save battery it is crucial to sleep you node as much as possible. The node can wake up from external interrupts or by a timer.
      
      The following sleep your radio and Arduino (in PowerDownMode). Wakes up on timer interrupt.
      
      void sleep(unsigned long ms);
      
      ms - Number of milliseconds to sleep.
      
      The following sleeps your radio and Arduino (in PowerDownMode). Wakes up on timer interrupt or from an external interrupt.
      
      See: http://arduino.cc/en/Reference/attachInterrupt for details on modes and which pin is assigned to what interrupt. On Nano/Pro Mini: 0=Pin2, 1=Pin3
      
      bool sleep(int interrupt, int mode, unsigned long ms=0);
      
      interrupt - Interrupt that should trigger the wakeup.
      mode - RISING, FALLING, CHANGE
      ms - Number of milliseconds to sleep (or 0 to sleep forever).
      
      The sleep method returns true if wake up was triggered by pin change and false means timer woke it up.
      
      int8_t sleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2, unsigned long ms=0);
      
      interrupt1 - First interrupt that should trigger the wakeup.
      mode1 - Mode for first interrupt (RISING, FALLING, CHANGE)
      interrupt2 - Second interrupt that should trigger the wakeup.
      mode2 - Mode for second interrupt (RISING, FALLING, CHANGE)
      ms - Number of milliseconds to sleep (or 0 to sleep forever).
      
      Returns the interrupt number if wake up was triggered by pin change and negative if timer woke it up.
      
      1 Reply Last reply
      0
      • ybycodeY Offline
        ybycodeY Offline
        ybycode
        wrote on last edited by
        #3

        I agree, that's what I read too. But the function call

        sleep(int interrupt, int mode, unsigned long ms=0)
        

        doesn't return a boolean anymore, but a uint8_t, but the interrupt number if it was triggered, or -1 if timeout, or -2 if not possible because of a firmware update.

        See https://github.com/mysensors/MySensors/blob/development/core/MySensorsCore.h#L252

        yann

        1 Reply Last reply
        0
        • mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by mfalkvidd
          #4

          The doxygen documentation is correct (says int_8t) but the API documentation still says bool.

          Isn't the API documentation generated from Doxygen? @hek could you enlighten us why the documentation differs? What can we do to fix it? A pull request isn't feasible since the code already is correct.

          martinhjelmareM 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            The doxygen documentation is correct (says int_8t) but the API documentation still says bool.

            Isn't the API documentation generated from Doxygen? @hek could you enlighten us why the documentation differs? What can we do to fix it? A pull request isn't feasible since the code already is correct.

            martinhjelmareM Offline
            martinhjelmareM Offline
            martinhjelmare
            Plugin Developer
            wrote on last edited by
            #5

            @mfalkvidd

            I think the mysensors site is manually updated.

            I suggest looking into converting the site source to github pages, which would enable the whole community helping keeping the site docs up to date.

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

              Yes, the site is manually updated (improvements is on its way). Must have missed the sleep updates when doing the overview.

              Doxygen is always the best place/most correct place to look. And we'll probably move over to pure doxygen once it covers a majority of the library.

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


              21

              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