Skip to content

Commit 405fb81

Browse files
authored
Merge pull request #1755 from avanwinkle/stepper-yaml-bytes
Bugfix: Pololu Stepper status parsing
2 parents 5eaa5fd + 1f3fa45 commit 405fb81

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

mpf/platforms/pololu/pololu_ticcmd_wrapper.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import logging
44
import asyncio
55

6-
from io import StringIO
76
from threading import Thread
87
import ruamel.yaml
98

@@ -98,8 +97,10 @@ def _run_subprocess_ticcmd(self, *args):
9897
async def get_status(self):
9998
"""Return the current status of the TIC device."""
10099
cmd_return = await self._ticcmd_future('-s', '--full')
100+
self.log.debug("get_status() received cmd_return: %s", cmd_return)
101+
value = cmd_return.decode('utf-8')
101102
yaml = ruamel.yaml.YAML(typ='safe')
102-
status = yaml.load(StringIO(cmd_return))
103+
status = yaml.load(value)
103104
return status
104105

105106
def halt_and_hold(self):

mpf/tests/test_PololuTic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _ticcmd_async(self, *args):
3232
yaml = ruamel.yaml.YAML()
3333
yaml.Dumper = RoundTripDumper
3434
yaml.dump(new_status, output)
35-
return output.getvalue()
35+
return output.getvalue().encode()
3636

3737
elif args == ('--reset-command-timeout',):
3838
return ""

0 commit comments

Comments
 (0)