From 9a39b00a65df4ffebbb99eb0cd9cfbf4ad00611e Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Sun, 21 Aug 2022 17:42:58 +0200 Subject: [PATCH] =?UTF-8?q?Lautst=C3=A4rke-=C3=84nderungen=20in=202er-Schr?= =?UTF-8?q?itten.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 473eabc..a40667d 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -12,12 +12,17 @@ void Controller::handle() { void Controller::handle_buttons() { if (is_button_pressed(PIN_BTN_VOL_UP)) { log_i("BTN_VOL_UP pressed"); - uint8_t vol = min(audio.getVolume()+1, 21); + uint8_t vol = min(audio.getVolume()+2, 21); log_d("Setting new volume %d", vol); audio.setVolume(vol); } else if (is_button_pressed(PIN_BTN_VOL_DOWN)) { log_i("BTN_VOL_DOWN pressed"); - uint8_t vol = max(audio.getVolume()-1, 1); + uint8_t vol; + if ((vol = audio.getVolume()) >= 3) { + vol -= 2; + } else { + vol = 1; + } log_d("Setting new volume %d", vol); audio.setVolume(vol); } else if (is_button_pressed(PIN_BTN_TRACK_NEXT)) {