From 756514adef4fcbd7e42e6e3e398a465923117cba Mon Sep 17 00:00:00 2001 From: Ricardo Amezquita Date: Sun, 17 Jun 2018 19:59:29 -0500 Subject: thermocouple: Add support for MAX6675 chip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MAX6675 chip has a different read sequence than the MAX31855 chip. Signed-off-by: Ricardo Amézquita Signed-off-by: Kevin O'Connor --- klippy/extras/spi_temperature.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'klippy/extras/spi_temperature.py') diff --git a/klippy/extras/spi_temperature.py b/klippy/extras/spi_temperature.py index 96b2d1f6..a020f3e4 100644 --- a/klippy/extras/spi_temperature.py +++ b/klippy/extras/spi_temperature.py @@ -15,9 +15,10 @@ SAMPLE_COUNT_DEFAULT = 8 REPORT_TIME_DEFAULT = 0.300 VALID_SPI_SENSORS = { - 'MAX6675' : 1, 'MAX31855' : 1, + 'MAX31855' : 1, 'MAX31856' : 2, - 'MAX31865' : 4 + 'MAX31865' : 4, + 'MAX6675' : 8 } class error(Exception): @@ -180,18 +181,26 @@ class Thermocouple(SensorBase): if chip_type == "MAX31856": self.val_a = 0.0078125 self.scale = 5 + elif chip_type == "MAX6675": + self.val_a = 0.25 + self.scale = 3 else: self.val_a = 0.25 self.scale = 18 SensorBase.__init__(self, config, is_spi = True, sample_count = 1) def _check_faults_simple(self, val): - if not self.chip_type == "MAX31856": + if self.chip_type == "MAX6675": + if val & 0x02: + raise self.error("Max6675 : Device ID error") + if val & 0x04: + raise self.error("Max6675 : Thermocouple Open Fault") + elif not self.chip_type == "MAX31856": if val & 0x1: - raise self.error("MAX6675/MAX31855 : Open Circuit") + raise self.error("MAX31855 : Open Circuit") if val & 0x2: - raise self.error("MAX6675/MAX31855 : Short to GND") + raise self.error("MAX31855 : Short to GND") if val & 0x4: - raise self.error("MAX6675/MAX31855 : Short to Vcc") + raise self.error("MAX31855 : Short to Vcc") def check_faults(self, fault): if self.chip_type == "MAX31856": if fault & MAX31856_FAULT_CJRANGE: -- cgit v1.2.3-70-g09d2