moved trigger processing from interrupt to main loop