machine.idle vs machine.sleep
-
What is the difference between these calls? The docs only mention machine.idle, but help(machine) shows both.
-
@Eric24
you have here whole source code
https://github.com/pycom/pycom-micropython-sigfox
-
@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 machine.sleep() does nothing. Here is the code:
STATIC mp_obj_t machine_sleep (void) { // TODO return mp_const_none; }
-
@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
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
idle
only reduce power consumption
butdeepsleep
"restart" the board - near the same as pressing reset button