aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-02-04 09:30:26 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-02-04 09:30:26 -0500
commitcd8678aa6d2b02d7dd35fd74eddd4052afe96ac4 (patch)
treef5f738807fd8907ea49168147370ae7be30ceac9
parent5b9ce328e59b25757c0c8872cdf97008d320eb3b (diff)
downloadkutter-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>
-rw-r--r--klippy/extras/spi_temperature.py7
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(