You've got way too much stuff going on with the interrupt handler detached. All that you should be doing is making a copy of the variables that the interrupt handler modifies. Do all the processing AFTER reattaching the interrupt handler.
You've got way too much stuff going on with the interrupt handler detached. All that you should be doing is making a copy of the variables that the interrupt handler modifies. Do all the processing AFTER reattaching the interrupt handler.