From 84ac5b0146cbcec46419d4636b949f144992072e Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 25 Aug 2021 10:36:45 -0400 Subject: 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 --- klippy/extras/spi_temperature.py | 12 ++++++------ 1 file changed, 6 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 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 | -- cgit v1.2.3-70-g09d2