- Settings split on heater index

-General impl of hookRegistered functions
-registerRegexMsg recevies a compiled regex
-single regex for all pid types of respond
This commit is contained in:
sergiuToporjinschi
2022-02-04 10:14:46 +02:00
parent c3f86acc7d
commit 8b6cc8c444
9 changed files with 168 additions and 61 deletions
+2 -2
View File
@@ -88,7 +88,7 @@ class Hooks():
if command is None or not reg.match(command.upper()):
self._logger.warn("registerGCodeAnswer: Attempt to register gCodeAnswer without a function or valid gCode command")
return
self.registerRegexMsg(".*\s*(?P<gCode>[M,G]\d{1,4})", func, *arguments)
self.registerRegexMsg(reg, func, *arguments)
def registerRegexMsg(self, regex, func, *arguments):
if regex is None or func is None or not isinstance(func, collections.Callable):
@@ -96,7 +96,7 @@ class Hooks():
return
self.gCodeWaiters.append({
"regex": re.compile(regex),
"regex": regex,
"func": func,
"args": arguments,
"callCount": 0