Allow whitespace after : in M114 responses

Closes #2839
This commit is contained in:
Gina Häußge committed 2018-10-18 17:32:32 +02:00
1 parent efa556a812
commit 7b5d2e3e0c
2 files changed
+8 -2

No files matched your search

+2 -2
View File
@@ -126,7 +126,7 @@ Groups will be as follows:
* ``target``: new target temperature (float)
"""
regex_position = re.compile("X:(?P<x>{float})\s*Y:(?P<y>{float})\s*Z:(?P<z>{float})\s*((E:(?P<e>{float}))|(?P<es>(E\d+:{float}\s*)+))".format(float=regex_float_pattern))
regex_position = re.compile("X:\s*(?P<x>{float})\s*Y:\s*(?P<y>{float})\s*Z:\s*(?P<z>{float})\s*((E:\s*(?P<e>{float}))|(?P<es>(E\d+:\s*{float}\s*)+))".format(float=regex_float_pattern))
"""Regex for matching position reporting.
Groups will be as follows:
@@ -138,7 +138,7 @@ Groups will be as follows:
* ``es``: multiple E coordinates if present, to be parsed further with regex_e_positions
"""
regex_e_positions = re.compile("E(?P<id>\d+):(?P<value>{float})".format(float=regex_float_pattern))
regex_e_positions = re.compile("E(?P<id>\d+):\s*(?P<value>{float})".format(float=regex_float_pattern))
"""Regex for matching multiple E coordinates in a position report.
Groups will be as follows:
+6
View File
@@ -333,6 +333,12 @@ class TestCommHelpers(unittest.TestCase):
e4=0.0,
e5=0.0)),
# whitespace after the :, e.g. AlfaWise U20, see #2839
("X:150.0 Y:150.0 Z: 0.7 E: 0.0", dict(x=150.0,
y=150.0,
z=0.7,
e=0.0)),
# invalid
("", None),
("X:62.417 Y:64.781 Z:0.2", None)