diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-07-24 15:49:14 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-07-24 15:49:14 -0400 |
commit | 63dffd9307f4a1e69a40df69ad1f7c6bc7e6929f (patch) | |
tree | 17284fdbafcf59962a21e77b25459e96ee8ffbea | |
parent | 5b124d59f2213720288561b38441d0fc7d41b57f (diff) | |
download | kutter-63dffd9307f4a1e69a40df69ad1f7c6bc7e6929f.tar.gz kutter-63dffd9307f4a1e69a40df69ad1f7c6bc7e6929f.tar.xz kutter-63dffd9307f4a1e69a40df69ad1f7c6bc7e6929f.zip |
spi_temperature: Provide a default value for spi_speed
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>
-rw-r--r-- | config/example-extras.cfg | 4 | ||||
-rw-r--r-- | klippy/extras/spi_temperature.py | 2 | ||||
-rw-r--r-- | test/klippy/temperature.cfg | 4 |
3 files changed, 3 insertions, 7 deletions
diff --git a/config/example-extras.cfg b/config/example-extras.cfg index be2dc5d7..8dcec27f 100644 --- a/config/example-extras.cfg +++ b/config/example-extras.cfg @@ -639,9 +639,9 @@ # heater parameters. The parameters below describe sensor parameters. #sensor_type: # One of "MAX6675", "MAX31855", "MAX31856", or "MAX31865". -#spi_speed: +#spi_speed: 4000000 # The SPI speed (in hz) to use when communicating with the chip. -# This parameter must be provided. +# The default is 4000000. #sensor_pin: # The chip select line for the sensor chip. This parameter must be # provided. diff --git a/klippy/extras/spi_temperature.py b/klippy/extras/spi_temperature.py index b5dd23e9..269bba0a 100644 --- a/klippy/extras/spi_temperature.py +++ b/klippy/extras/spi_temperature.py @@ -32,7 +32,7 @@ class SensorBase: pin = pin_params['pin'] # SPI bus configuration spi_oid = mcu.create_oid() - spi_speed = config.getint('spi_speed', minval=0) + spi_speed = config.getint('spi_speed', 4000000, minval=1) mcu.add_config_cmd( "config_spi oid=%u bus=0 pin=%s mode=1 rate=%u shutdown_msg=" % ( spi_oid, pin, spi_speed)) diff --git a/test/klippy/temperature.cfg b/test/klippy/temperature.cfg index 3e82de30..fef12161 100644 --- a/test/klippy/temperature.cfg +++ b/test/klippy/temperature.cfg @@ -59,7 +59,6 @@ min_temp: 0 max_temp: 100 control: watermark sensor_type: MAX6675 -spi_speed: 100000 sensor_pin: ar2 [temperature_fan test_max31855] @@ -68,7 +67,6 @@ min_temp: 0 max_temp: 100 control: watermark sensor_type: MAX31855 -spi_speed: 100000 sensor_pin: ar5 [temperature_fan test_max31856] @@ -77,7 +75,6 @@ min_temp: 0 max_temp: 100 control: watermark sensor_type: MAX31856 -spi_speed: 100000 sensor_pin: ar7 [temperature_fan test_max31865] @@ -86,7 +83,6 @@ min_temp: 0 max_temp: 100 control: watermark sensor_type: MAX31865 -spi_speed: 100000 sensor_pin: ar13 [thermistor my_custom_thermistor] |