Skip to content

machine.xxxsleep(): Inconsistent behavior with a negative number as argument. #13042

@robert-hh

Description

@robert-hh

When the argument to machine.lightsleep() or machine.deepsleep() is negative, the ports behave different. Even if that is an unreasonable value, the behavior should be consistent and well behaving.

stm32: return shortly after the call. The time seems not to depend on the value.
renesas-ra: treat negative numbers like 4 ms.
rp2: wait in a call to mp_hal_delay_ms() until the numbers match.
mimxrt: behave as if being called without an argument. Get woken by an interrupt at the WAKEUP pin.
samd: behave as if being called without an argument. Wake up if a Pin irq happens.
esp32: Ignore the value and return immediately
esp8266; Ignore the value and return immediately

So the best options are either a) raising an error or b ) silent immediate return. I can make a PR for any of them, and I prefer b).

Metadata

Metadata

Assignees

No one assigned

    Labels

    portsRelates to multiple ports, or a new/proposed port

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy