def detect_damper_position(self, calibrate):
    resp2 = self.spi.xfer2([17, 0, 0])
    resp2a = int((resp2.pop(1) / 2))
    resp2b = int(resp2.pop(1))
    self.damper_position = ((int(resp2a) * 2) * 8)
    if (calibrate == False):
        self.current_damper_percent = int(((self.damper_night_position - self.damper_position) / ((self.damper_night_position - self.damper_day_position) / 100)))
        if (self.current_damper_percent >= 95):
            self.reported_damper_percent = 100
        elif ((self.current_damper_percent < 95) and (self.current_damper_percent >= 85)):
            self.reported_damper_percent = 90
        elif ((self.current_damper_percent < 85) and (self.current_damper_percent >= 75)):
            self.reported_damper_percent = 80
        elif ((self.current_damper_percent < 75) and (self.current_damper_percent >= 65)):
            self.reported_damper_percent = 70
        elif ((self.current_damper_percent < 65) and (self.current_damper_percent >= 55)):
            self.reported_damper_percent = 60
        elif ((self.current_damper_percent < 55) and (self.current_damper_percent >= 45)):
            self.reported_damper_percent = 50
        elif ((self.current_damper_percent < 45) and (self.current_damper_percent >= 35)):
            self.reported_damper_percent = 40
        elif ((self.current_damper_percent < 35) and (self.current_damper_percent >= 25)):
            self.reported_damper_percent = 30
        elif ((self.current_damper_percent < 25) and (self.current_damper_percent >= 15)):
            self.reported_damper_percent = 20
        elif ((self.current_damper_percent < 15) and (self.current_damper_percent >= 5)):
            self.reported_damper_percent = 10
        else:
            self.reported_damper_percent = 0
def detect_damper_position(self, calibrate):
    resp2 = self.spi.xfer2([17, 0, 0])
    resp2a = int((resp2.pop(1) / 2))
    resp2b = int(resp2.pop(1))
    self.damper_position = ((int(resp2a) * 2) * 8)
    if (calibrate == False):
        self.current_damper_percent = int(((self.damper_night_position - self.damper_position) / ((self.damper_night_position - self.damper_day_position) / 100)))
        if (self.current_damper_percent >= 95):
            self.reported_damper_percent = 100
        elif ((self.current_damper_percent < 95) and (self.current_damper_percent >= 85)):
            self.reported_damper_percent = 90
        elif ((self.current_damper_percent < 85) and (self.current_damper_percent >= 75)):
            self.reported_damper_percent = 80
        elif ((self.current_damper_percent < 75) and (self.current_damper_percent >= 65)):
            self.reported_damper_percent = 70
        elif ((self.current_damper_percent < 65) and (self.current_damper_percent >= 55)):
            self.reported_damper_percent = 60
        elif ((self.current_damper_percent < 55) and (self.current_damper_percent >= 45)):
            self.reported_damper_percent = 50
        elif ((self.current_damper_percent < 45) and (self.current_damper_percent >= 35)):
            self.reported_damper_percent = 40
        elif ((self.current_damper_percent < 35) and (self.current_damper_percent >= 25)):
            self.reported_damper_percent = 30
        elif ((self.current_damper_percent < 25) and (self.current_damper_percent >= 15)):
            self.reported_damper_percent = 20
        elif ((self.current_damper_percent < 15) and (self.current_damper_percent >= 5)):
            self.reported_damper_percent = 10
        else:
            self.reported_damper_percent = 0