From 21e45cac645c85ce0c8ef4f29bbdb4b6ea7df832 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 27 Feb 2019 13:14:23 -0500 Subject: [PATCH] spi_temperature: Wrap code to 80 columns Signed-off-by: Kevin O'Connor --- klippy/extras/spi_temperature.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/klippy/extras/spi_temperature.py b/klippy/extras/spi_temperature.py index ff4b10e4..89d3772b 100644 --- a/klippy/extras/spi_temperature.py +++ b/klippy/extras/spi_temperature.py @@ -289,7 +289,8 @@ class MAX31865(SensorBase): if fault & 0x40: self.fault("Max31865 RTD input is shorted") if fault & 0x20: - self.fault("Max31865 VREF- is greater than 0.85 * VBIAS, FORCE- open") + self.fault( + "Max31865 VREF- is greater than 0.85 * VBIAS, FORCE- open") if fault & 0x10: self.fault("Max31865 VREF- is less than 0.85 * VBIAS, FORCE- open") if fault & 0x08: @@ -300,16 +301,16 @@ class MAX31865(SensorBase): self.fault("Max31865 Unspecified error") adc = adc >> 1 # remove fault bit R_rtd = (self.reference_r * adc) / VAL_ADC_MAX - temp = ( - (( ( -1 * self.rtd_nominal_r ) * VAL_A ) + - math.sqrt( ( self.rtd_nominal_r * self.rtd_nominal_r * VAL_A * VAL_A ) - - ( 4 * self.rtd_nominal_r * VAL_B * ( self.rtd_nominal_r - R_rtd ) ))) - / (2 * self.rtd_nominal_r * VAL_B)) + temp = ((( ( -1 * self.rtd_nominal_r ) * VAL_A ) + + math.sqrt( ( self.rtd_nominal_r**2 * VAL_A * VAL_A ) + - ( 4 * self.rtd_nominal_r * VAL_B + * ( self.rtd_nominal_r - R_rtd ) ))) + / (2 * self.rtd_nominal_r * VAL_B)) return temp def calc_adc(self, temp): R_rtd = temp * ( 2 * self.rtd_nominal_r * VAL_B ) R_rtd = math.pow( ( R_rtd + ( self.rtd_nominal_r * VAL_A ) ), 2) - R_rtd = -1 * ( R_rtd - ( self.rtd_nominal_r * self.rtd_nominal_r * VAL_A * VAL_A ) ) + R_rtd = -1 * ( R_rtd - (self.rtd_nominal_r**2 * VAL_A * VAL_A ) ) R_rtd = R_rtd / ( 4 * self.rtd_nominal_r * VAL_B ) R_rtd = ( -1 * R_rtd ) + self.rtd_nominal_r adc = int( ( ( R_rtd * VAL_ADC_MAX ) / self.reference_r) + 0.5 )