diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-08-25 10:36:45 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-08-25 10:36:45 -0400 |
commit | 84ac5b0146cbcec46419d4636b949f144992072e (patch) | |
tree | 81aaefd6ea5f939b9ad23935bdfbfaf4eefcb3b3 /klippy/extras/spi_temperature.py | |
parent | 75183bfb86c7003d3bac0116dba7765e4a4ab241 (diff) | |
download | kutter-84ac5b0146cbcec46419d4636b949f144992072e.tar.gz kutter-84ac5b0146cbcec46419d4636b949f144992072e.tar.xz kutter-84ac5b0146cbcec46419d4636b949f144992072e.zip |
configfile: Support config.getchoice() with integer keys
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>
Diffstat (limited to 'klippy/extras/spi_temperature.py')
-rw-r--r-- | klippy/extras/spi_temperature.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/klippy/extras/spi_temperature.py b/klippy/extras/spi_temperature.py index 31efea58..1a45a624 100644 --- a/klippy/extras/spi_temperature.py +++ b/klippy/extras/spi_temperature.py @@ -167,13 +167,13 @@ class MAX31856(SensorBase): } value = config.getchoice('tc_type', types, default="K") averages = { - "1" : MAX31856_CR1_AVGSEL1, - "2" : MAX31856_CR1_AVGSEL2, - "4" : MAX31856_CR1_AVGSEL4, - "8" : MAX31856_CR1_AVGSEL8, - "16" : MAX31856_CR1_AVGSEL16 + 1 : MAX31856_CR1_AVGSEL1, + 2 : MAX31856_CR1_AVGSEL2, + 4 : MAX31856_CR1_AVGSEL4, + 8 : MAX31856_CR1_AVGSEL8, + 16 : MAX31856_CR1_AVGSEL16 } - value |= config.getchoice('tc_averaging_count', averages, "1") + value |= config.getchoice('tc_averaging_count', averages, 1) cmds.append(value) value = (MAX31856_MASK_VOLTAGE_UNDER_OVER_FAULT | |