Dynamic wakeup-pin on esp32

I would like to ask if there is a way to set a dynamic wakeup pin in deep sleep? What I mean is to have a pin work as a wakeup pin only when a virtual switch is on but to not trigger a wakeup when the switch is of. So it would be like two different deep sleep modes.

If the device is asleep you can’t change anything.

The device will still wake up with the run duration and sleep duration but what I am talking about is for example to have a device that will sleep for 10min and run for 20s, but when a virtual switch is flipped a pin on the device will function as a wakeup pin. It will not be always asleep as it will wake up every 10min and run for 20s. While running it will see that the state of the virtual switch is on and change the pin to function as a wakeup pin. What I am asking here is if there is a way for a pin to be wakeup pin only when some condition is satisfied.

Got you now. Perhaps this could be done in a lambda? But you’d have to look at the c++ code.