Again...
Arrch: PreviousSwitchState is never updated.
I presume you are trying to detect the signal edge, yes?