From 715eb142f83c8f1ed38b4550ed6d37c2c2705700 Mon Sep 17 00:00:00 2001 From: Bryan Mayland Date: Fri, 28 Jun 2013 11:23:40 -0400 Subject: [PATCH] gcodeToEvent can only fire one event per gcode function anyway. <1% performance increase. --- octoprint/util/comm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/octoprint/util/comm.py b/octoprint/util/comm.py index 5f8b37fd..512c6640 100644 --- a/octoprint/util/comm.py +++ b/octoprint/util/comm.py @@ -914,9 +914,9 @@ class MachineCom(object): gfunc = re.search('([GM][0-9]+)', cmd) if gfunc: gfunc = gfunc.group(1) - for gcode in gcodeToEvent.keys(): - if gcode == gfunc: - eventManager().fire(gcodeToEvent[gcode]) + + if gfunc in gcodeToEvent: + eventManager().fire(gcodeToEvent[gfunc]) if (gfunc == "G0" or gfunc == "G1") and 'Z' in cmd: z = float(re.search('Z([0-9\.]*)', cmd).group(1))