FX30S: strange happenings with GPIO24

Hello,

I am trying to use GPIO24, which is monitoring the ON/OFF (Pin 3) signal, to initiate an action.

here is the code for configuring the gpio:

powerMonitor_ChangeEventHandlerRef_t pm_ref = powerMonitor_AddChangeEventHandler(POWERMONITOR_EDGE_RISING, PowerMonitorChangeCallback, &Pin24, 0);

When I turn the ON/OFF switch “OFF”, I get varying results.

Sometimes my handler fires twice and then it won’t fire at all and then it will sometimes work again.

Any suggestions on how to make it perform a consistent action?

Thanks,
Mark