novatech409b: log sim commands, style

This commit is contained in:
Robert Jördens 2016-03-10 16:50:18 +01:00
parent 878ab9a39b
commit 01e919dad8
1 changed files with 8 additions and 7 deletions

View File

@ -65,7 +65,7 @@ class Novatech409B:
# ser_send("F0 1.0") # sets the freq of channel 0 to 1.0 MHz # ser_send("F0 1.0") # sets the freq of channel 0 to 1.0 MHz
if self.simulation: if self.simulation:
print(cmd) logger.info("simulation _ser_send(\"%s\")", cmd)
else: else:
self.port.flushInput() self.port.flushInput()
self.port.write((cmd + "\r\n").encode()) self.port.write((cmd + "\r\n").encode())
@ -81,7 +81,8 @@ class Novatech409B:
errstr = self.error_codes[result] errstr = self.error_codes[result]
except KeyError: except KeyError:
errstr = "Unrecognized reply: '{}'".format(result) errstr = "Unrecognized reply: '{}'".format(result)
s = "Error Code = {ec}, {ecs}".format(ec=result, ecs=errstr) s = "Error Code = {ec}, {ecs}".format(
ec=result, ecs=errstr)
raise UnexpectedResponse(s) raise UnexpectedResponse(s)
else: else:
pass pass
@ -171,10 +172,10 @@ class Novatech409B:
def get_status(self): def get_status(self):
if self.simulation: if self.simulation:
return ["00989680 2000 01F5 0000 00000000 00000000 000301", return ["00989680 2000 01F5 0000 00000000 00000000 000301",
"00989680 2000 01F5 0000 00000000 00000000 000301", "00989680 2000 01F5 0000 00000000 00000000 000301",
"00989680 2000 01F5 0000 00000000 00000000 000301", "00989680 2000 01F5 0000 00000000 00000000 000301",
"00989680 2000 01F5 0000 00000000 00000000 000301", "00989680 2000 01F5 0000 00000000 00000000 000301",
"80 BC0000 0000 0102 21"] "80 BC0000 0000 0102 21"]
else: else:
# status message is multi-line # status message is multi-line
self.port.flushInput() self.port.flushInput()