diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-02-04 09:30:26 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-02-04 09:30:26 -0500 |
commit | cd8678aa6d2b02d7dd35fd74eddd4052afe96ac4 (patch) | |
tree | f5f738807fd8907ea49168147370ae7be30ceac9 /klippy/extras/spi_temperature.py | |
parent | 5b9ce328e59b25757c0c8872cdf97008d320eb3b (diff) | |
download | kutter-cd8678aa6d2b02d7dd35fd74eddd4052afe96ac4.tar.gz kutter-cd8678aa6d2b02d7dd35fd74eddd4052afe96ac4.tar.xz kutter-cd8678aa6d2b02d7dd35fd74eddd4052afe96ac4.zip |
spi_temperature: Fix order of init
Commit c3efcd9c moved the config_spi setup to a build_config callback.
It's also necessary to move the config_thermocouple to a build_config
callback as well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/spi_temperature.py')
-rw-r--r-- | klippy/extras/spi_temperature.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/klippy/extras/spi_temperature.py b/klippy/extras/spi_temperature.py index 9fec6178..6dbb0b94 100644 --- a/klippy/extras/spi_temperature.py +++ b/klippy/extras/spi_temperature.py @@ -23,6 +23,7 @@ REPORT_TIME = 0.300 class SensorBase: def __init__(self, config, chip_type, config_cmd=None): self.printer = config.get_printer() + self.chip_type = chip_type self._callback = None self.min_sample_value = self.max_sample_value = 0 self._report_clock = 0 @@ -33,9 +34,6 @@ class SensorBase: self.mcu = mcu = self.spi.get_mcu() # Reader chip configuration self.oid = oid = mcu.create_oid() - mcu.add_config_cmd( - "config_thermocouple oid=%u spi_oid=%u chip_type=%u" % ( - oid, self.spi.get_oid(), chip_type)) mcu.register_msg(self._handle_spi_response, "thermocouple_result", oid) mcu.register_config_callback(self._build_config) def setup_minmax(self, min_temp, max_temp): @@ -47,6 +45,9 @@ class SensorBase: def get_report_time_delta(self): return REPORT_TIME def _build_config(self): + self.mcu.add_config_cmd( + "config_thermocouple oid=%u spi_oid=%u chip_type=%u" % ( + self.oid, self.spi.get_oid(), self.chip_type)) clock = self.mcu.get_query_slot(self.oid) self._report_clock = self.mcu.seconds_to_clock(REPORT_TIME) self.mcu.add_config_cmd( |