Fixed volume control limits and steps

remotes/origin/extra-event-options v0.0.1
Phil Howard 2019-10-10 16:08:19 +01:00
parent 4c9be3f665
commit b2863fd2a3
1 changed files with 4 additions and 2 deletions

View File

@ -76,10 +76,12 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
def handle_volume_up(self): def handle_volume_up(self):
volume = self.core.playback.volume.get() volume = self.core.playback.volume.get()
volume += 10 volume += 5
volume = min(volume, 100)
self.core.playback.volume = volume self.core.playback.volume = volume
def handle_volume_down(self): def handle_volume_down(self):
volume = self.core.playback.volume.get() volume = self.core.playback.volume.get()
volume -= 10 volume -= 5
volume = max(volume, 0)
self.core.playback.volume = volume self.core.playback.volume = volume