pytec: narrow down exception catching range

pull/41/head
topquark12 2021-01-06 10:25:44 +08:00
parent bfcb91d2c0
commit 9e215830aa
1 changed files with 10 additions and 9 deletions

View File

@ -246,18 +246,19 @@ def main():
try:
ch = data[channel]
temperature = ch['temperature']
if (tuner.run(temperature, ch['time'])):
break
tuner_out = tuner.output()
tec.set_param("pwm", channel, "i_set", tuner_out)
# Sometimes report_mode may yeild empty object
except KeyError:
pass
temperature = ch['temperature']
if (tuner.run(temperature, ch['time'])):
break
tuner_out = tuner.output()
tec.set_param("pwm", channel, "i_set", tuner_out)
tec.set_param("pwm", channel, "i_set", 0)