I have been doing some tests and the conclusion is that i cannot switch twice wifi on/off, because it seems that when i switch ON the wifi once, then, if i turn it off and i write another "if [ ${WIFI} -eq 1 ]; then" 10 secs later, even if i have not switched on the wifi again it passes through it after 10 secs and it continues with the next lines. It seems that "if [ ${WIFI} -eq 0 ]; then" does not work. It happens also if i use GPIO 43, which is supposed to be the physical button of the wifi.
It would be great to do something like "wifi on->mode/power button (to switch to photo mode)->take one photo->wifi off", but i don't know the GPIO of the power button, can someone give me more info about the GPIOs?
Thanks!