From 9e215830aa034b13606d861bb6f384839efc8f05 Mon Sep 17 00:00:00 2001 From: topquark12 Date: Wed, 6 Jan 2021 10:25:44 +0800 Subject: [PATCH] pytec: narrow down exception catching range --- pytec/autotune.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pytec/autotune.py b/pytec/autotune.py index b8b8b3d..8dd96dd 100644 --- a/pytec/autotune.py +++ b/pytec/autotune.py @@ -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)