moved gcode logic into a thread to improve responsiveness