by Tze Zhao Chong
New: Checks Device orientation 3 times after proximity sensor is activated. Reverts back to proximity sensor after all 3 times are false.
Multi thread loop.
This flow allows the device to automatically turn on when picked up from a screen down position, and can automatically turn off when placed screen side down.