1
0
Fork 0

get list of values from preset string

This commit is contained in:
Kevin Matz 2019-07-30 11:05:08 -04:00
parent 14a11fc277
commit f17f2c0a1f
1 changed files with 9 additions and 0 deletions

View File

@ -54,6 +54,15 @@ class Robot:
return self.angle != values
return self.angle != self.target
@staticmethod
def read_preset(str):
if str.startswith('{') and str.endswith('}'):
str = str.lstrip('{').rstrip('}')
else:
return None # malformed packet
data = str.split(',')
return [int(val) for val in data]
def serial_read_handler(self, data):
data = data.strip()
if data.startswith(b'{') and data.endswith(b'}'):