shaper: fix issue with re

This commit is contained in:
alfrix 2023-09-12 01:02:12 -03:00
parent d5bf8c21cb
commit 42c33d1b43

View File

@ -166,7 +166,9 @@ class Panel(ScreenPanel):
# Recommended shaper_type_y = ei, shaper_freq_y = 48.4 Hz
if 'recommended shaper_type_' in data:
results = re.search(r'shaper_type_(?P<axis>[xy])\s*=\s*(?P<shaper_type>.*?), shaper_freq_.\s*=\s*('
r'?P<shaper_freq>[0-9.]+)', data).groupdict()
r'?P<shaper_freq>[0-9.]+)', data)
if results:
results.groupdict()
self.freq_xy_adj['shaper_freq_' + results['axis']].set_value(float(results['shaper_freq']))
self.freq_xy_combo['shaper_type_' + results['axis']].set_active(SHAPERS.index(results['shaper_type']))
if self.calibrating_axis == results['axis'] or (self.calibrating_axis == "both" and results['axis'] == 'y'):
@ -176,6 +178,8 @@ class Panel(ScreenPanel):
# shaper_type_y:ei shaper_freq_y:48.400 damping_ratio_y:0.100000
if 'shaper_type_' in data:
results = re.search(r'shaper_type_(?P<axis>[xy]):(?P<shaper_type>.*?) shaper_freq_.:('
r'?P<shaper_freq>[0-9.]+)', data).groupdict()
r'?P<shaper_freq>[0-9.]+)', data)
if results:
results.groupdict()
self.freq_xy_adj['shaper_freq_' + results['axis']].set_value(float(results['shaper_freq']))
self.freq_xy_combo['shaper_type_' + results['axis']].set_active(SHAPERS.index(results['shaper_type']))