def readFromDevice(self):
    if (self.ser.in_waiting > 0):
        self.inbuffer += self.ser.read(self.ser.in_waiting).decode().replace('\r', '')
    chunks = self.inbuffer.split('\n', 1)
    if (len(chunks) > 1):
        cmd = chunks[0]
        self.inbuffer = chunks[1]
        if self.debug:
            print(('Received: ' + cmd))
        return cmd
    return None
def readFromDevice(self):
    if (self.ser.in_waiting > 0):
        self.inbuffer += self.ser.read(self.ser.in_waiting).decode().replace('\r', )
    chunks = self.inbuffer.split('\n', 1)
    if (len(chunks) > 1):
        cmd = chunks[0]
        self.inbuffer = chunks[1]
        if self.debug:
            print(('Received: ' + cmd))
        return cmd
    return None