machine.idle vs machine.sleep
-
What is the difference between these calls? The docs only mention machine.idle, but help(machine) shows both.
-
@Eric24
do you mean
machine.deepsleep?from docs - https://docs.pycom.io/pycom_esp32/library/machine.html
machine.idle()
Gates the clock to the CPU, useful to reduce power consumption at any time during short or long periods. Peripherals continue working and execution resumes as soon as any interrupt is triggered (on many ports this includes system timer interrupt occurring at regular intervals on the order of millisecond).machine.deepsleep([time_ms])
Stops the CPU and all peripherals (including networking interfaces, if any). Execution is resumed from the main script, just as with a reset. If a value in milliseconds is given then the device will wake up after that period of time, otherwise it will remain in deep sleep until the reset button is pressedas described above
idleonly reduce power consumption
butdeepsleep"restart" the board - near the same as pressing reset button -
@livius Thanks, but I actually mean machine.sleep(). Maybe it does nothing, but it is a valid function on the machine object, per help(machine).
-
@Eric24 machine.sleep() does nothing. Here is the code:
STATIC mp_obj_t machine_sleep (void) { // TODO return mp_const_none; } -
@robert-hh Aha! That explains it. By the way, is that code you're showing available to look at somewhere (having it would probably answer a lot of questions and cut down on stupid questions)?
-
@Eric24
you have here whole source code
https://github.com/pycom/pycom-micropython-sigfox
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login