Closed vranisimo closed 2 years ago
Hey @vranisimo,
I know my answer is long past overdue and that you've probably moved on to other projects, but I actually got around to implement the changes you proposed (and discovered an major bug at the same occasion).
There is now a new method called dormant_with_modes
that supports both the possibilities you mentioned.
Here is the excerpt from the updated README:
The lower-level dormant_with_modes
allows to set different wake-up conditions for each individual pin.
For convenience, lowpower
exposes the four possibles wake-up conditions as the constants EDGE_LOW
, EDGE_HIGH
, LEVEL_LOW
and LEVEL_HIGH
.
Example:
import lowpower
DORMANT_PIN1 = 16
DORMANT_PIN2 = 17
print("before dormant")
lowpower.dormant_with_modes({
DORMANT_PIN1: (lowpower.EDGE_LOW | lowpower.EDGE_HIGH),
DORMANT_PIN2: lowpower.LEVEL_HIGH,
})
print("after dormant") # only print after receiving the correct signal on one of the pins
Cheers!
Hi,
I am trying to achieve a dormant mode that will wake up when water floater (in the pool) changed its state (0 to 1 or 1 to 0).
So basically, I would need a dormant mode that waits for:
OR (as an alternative)
The current API allows us to add multiple GPIO pins but with the same parameters for waiting logic.
Do you think it is technically possible to implement a different logic for each pin, due to board limitations and a way how dormant mode works?