def pump_volume(self, volume, direction):
    volume_to_add = volume
    if (direction == 0):
        space_in_pump = (self.max_pump_capacity - self.volume_in_pump)
        if (volume_to_add > space_in_pump):
            volume_to_add = (self.max_pump_capacity - self.volume_in_pump)
        self.drive_pump(volume_to_add, direction)
    elif (direction == 1):
        if (volume_to_add > self.max_pump_capacity):
            interfaces.lcd_out('Volume > pumpable', style=constants.LCD_CENT_JUST, line=4)
            next_volume = self.volume_in_pump
            self.drive_pump(next_volume, 1)
            volume_to_add = (volume_to_add - next_volume)
            while (volume_to_add > 0):
                next_volume = min(volume_to_add, self.max_pump_capacity)
                self.drive_pump(next_volume, 0)
                self.drive_pump(next_volume, 1)
                volume_to_add -= next_volume
        elif (volume_to_add > self.volume_in_pump):
            next_volume = self.volume_in_pump
            self.drive_pump(next_volume, 1)
            volume_to_add -= next_volume
            self.drive_pump(volume_to_add, 0)
            self.drive_pump(volume_to_add, 1)
        else:
            self.drive_pump(volume_to_add, direction)
def pump_volume(self, volume, direction):
    volume_to_add = volume
    if (direction == 0):
        space_in_pump = (self.max_pump_capacity - self.volume_in_pump)
        if (volume_to_add > space_in_pump):
            volume_to_add = (self.max_pump_capacity - self.volume_in_pump)
        self.drive_pump(volume_to_add, direction)
    elif (direction == 1):
        if (volume_to_add > self.max_pump_capacity):
            interfaces.lcd_out('Volume > pumpable', style=constants.LCD_CENT_JUST, line=4)
            next_volume = self.volume_in_pump
            self.drive_pump(next_volume, 1)
            volume_to_add = (volume_to_add - next_volume)
            while (volume_to_add > 0):
                next_volume = min(volume_to_add, self.max_pump_capacity)
                self.drive_pump(next_volume, 0)
                self.drive_pump(next_volume, 1)
                volume_to_add -= next_volume
        elif (volume_to_add > self.volume_in_pump):
            next_volume = self.volume_in_pump
            self.drive_pump(next_volume, 1)
            volume_to_add -= next_volume
            self.drive_pump(volume_to_add, 0)
            self.drive_pump(volume_to_add, 1)
        else:
            self.drive_pump(volume_to_add, direction)