aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/spi_temperature.py
Commit message (Collapse)AuthorAgeFilesLines
* thermocouple: Only shutdown on multiple consecutive sensor errorsKevin O'Connor2022-09-231-6/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Separate out fault handling from temperature calculationKevin O'Connor2022-09-231-26/+35
| | | | | | | Introduce a new handle_fault() method to handle processing of sensor faults. This simplifies the calc_temp() methods. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* thermocouple: Report fault information in fault fieldKevin O'Connor2022-09-231-6/+6
| | | | | | | Send the fault information explicitly in the query_thermocouple fault field for max6675, max31855, and max31865. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Support config.getchoice() with integer keysKevin O'Connor2021-08-251-6/+6
| | | | | | | | If the choice mapping uses integer keys then lookup the config option using self.getint(). This simplifies the callers and improves the encoding of the printer.configfile.settings export. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Improve handling of min_temp/max_temp overflowsKevin O'Connor2021-02-011-3/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Fix incorrect max31856 spi initializationKevin O'Connor2020-11-231-2/+0
| | | | | | | | | | Writes to the max31856 chip use "burst mode", so only one address during the initialization sequence can be sent. This fixes erroneous "Cold Junction Fault" errors. Reported by @NBouquain. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Simplify and comment MAX31865 temperature calculationsKevin O'Connor2020-09-021-18/+21
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: fix MAX31865 temperature conversion (#3274)Adrian Keet2020-09-021-1/+1
| | | Signed-off-by: Adrian Keet <arkeet@gmail.com>
* extras: Use "from . import module" for relative importsKevin O'Connor2020-06-151-1/+1
| | | | | | Use alternate import syntax to improve Python3 compatibility. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename try_load_module() to load_object()Kevin O'Connor2020-05-081-1/+1
| | | | | | | | Rename try_load_module() so that it uses consistent naming for "printer objects". Change the function to raise an error by default if the specified module does not exist. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heaters: Make heater.py an "extras" moduleKevin O'Connor2020-04-251-2/+2
| | | | | | | The heater logic is an independent module that does not need to be treated as part of the "core" klipper code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Rename register_callback() to register_response()Kevin O'Connor2019-06-211-1/+2
| | | | | | Rename the method and use that name in the mcu class as well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: MAX6675 and MAX31855 should use spi mode 0Kevin O'Connor2019-05-221-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* thermocouple: Define thermocouple types using enumerationsKevin O'Connor2019-03-171-11/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Wrap code to 80 columnsKevin O'Connor2019-02-271-7/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Rename add_sensor() to add_sensor_factory()Kevin O'Connor2019-02-251-1/+1
| | | | | Signed-off-by: Douglas Hammond <wizhippo@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Fix order of initKevin O'Connor2019-02-041-3/+4
| | | | | | | | 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>
* spi_temperature: Use bus.py helper code for spiKevin O'Connor2018-11-211-16/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Rename add_config_object() to register_config_callback()Kevin O'Connor2018-09-031-2/+2
| | | | | | | | | Change the name of the config registration method and pass an explicit reference to the callback to the new method. This makes the relationship between mcu registration and build_config() more clear in the calling code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Explicitly pass can_invert and can_pullup to lookup_pin()Kevin O'Connor2018-07-261-2/+1
| | | | | | | | | | | | Don't pass pin_type to lookup_pin() - instead, if a pin can be inverted or can have a pullup, then the caller must explicitly specify that when calling lookup_pin(). This simplifies the code for the cases where it is not valid to invert or pullup. Explicitly pass the pin_type to setup_pin() and have ppins.setup_pin() apply default pullup and invert flags. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: The query_thermocouple command is an init commandKevin O'Connor2018-07-241-1/+1
| | | | | | | Make sure to use is_init=True when sending query_thermocouple - otherwise, the config CRC is likely to mismatch on every connection. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Provide a default value for spi_speedKevin O'Connor2018-07-241-1/+1
| | | | | | | All of the Maxim chips support a 4Mhz spi transfer rate, so use that as a default spi speed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Remove spi_mode parameterKevin O'Connor2018-07-241-4/+2
| | | | | | All of the Maxim chips can use SPI mode 1, so no need to configure it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Don't raise error on a fault - invoke a shutdownKevin O'Connor2018-07-241-24/+23
| | | | | | | | Raising an error from the background message reception thread isn't well defined. Instead, on a temperature fault, invoke a printer shutdown. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Eliminate get_configs() callbackKevin O'Connor2018-07-241-39/+33
| | | | | | | | | Those chips that require an spi init sequence can generate the message directly in the chip specific class. Also, don't send an spi init message for chips that are read-only. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Eliminate self.chip_type variableKevin O'Connor2018-07-241-17/+12
| | | | | | The chip type is now always unique in each class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Eliminate check_faults() callbackKevin O'Connor2018-07-241-15/+6
| | | | | | The faults can be checked from the calc_temp() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Break up thermocouple code into individual classesKevin O'Connor2018-07-241-74/+115
| | | | | | | Break the Thermocouple() class into MAX31856(), MAX31855(), and MAX6675() classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Use setup_minmax() to set the temperature rangeKevin O'Connor2018-07-241-8/+5
| | | | | | | Use setup_minmax() instead of directly reading the min/max temperature from the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spi_temperature: Remove non-spi flags from SensorBaseKevin O'Connor2018-07-241-50/+30
| | | | | | | The SensorBase class is used exclusively for SPI transfers, so no need to track non-spi settings. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* thermocouple: Add support for MAX6675 chipRicardo Amezquita2018-07-241-6/+15
| | | | | | | The MAX6675 chip has a different read sequence than the MAX31855 chip. Signed-off-by: Ricardo Amézquita <ramezquitao@cihologramas.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* thermocouple: Add initial support for common SPI temperature sensing chipsKevin O'Connor2018-07-241-0/+350
Signed-off-by: Petri Honkala <cruwaller@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>