AP_MSP: handle utf-8 in string display

This commit is contained in:
Andrew Tridgell 2020-09-01 08:59:26 +10:00
parent 8ca9af72e0
commit 5358c1e476
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
author: Alex Apostoli
@ -335,19 +336,18 @@ class PyMSP:
bf.append(checksum)
return bf
def evaluateCommand(self, cmd, dataSize):
if cmd in self.MESSAGES:
# most messages are parsed from the MESSAGES list
self.MESSAGES[cmd].parse(self, dataSize)
elif cmd == self.MSP_NAME:
s = ''
s = bytearray()
for i in range(0,dataSize,1):
b = self.read8()
if b == 0:
break
s += chr(b)
self.msp_name['name'] = s
s.append(b)
self.msp_name['name'] = s.decode("utf-8")
elif cmd == self.MSP_ACC_CALIBRATION:
x = None