Lautstärke-Änderungen in 2er-Schritten.
This commit is contained in:
parent
aed9c416bf
commit
9a39b00a65
@ -12,12 +12,17 @@ void Controller::handle() {
|
|||||||
void Controller::handle_buttons() {
|
void Controller::handle_buttons() {
|
||||||
if (is_button_pressed(PIN_BTN_VOL_UP)) {
|
if (is_button_pressed(PIN_BTN_VOL_UP)) {
|
||||||
log_i("BTN_VOL_UP pressed");
|
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);
|
log_d("Setting new volume %d", vol);
|
||||||
audio.setVolume(vol);
|
audio.setVolume(vol);
|
||||||
} else if (is_button_pressed(PIN_BTN_VOL_DOWN)) {
|
} else if (is_button_pressed(PIN_BTN_VOL_DOWN)) {
|
||||||
log_i("BTN_VOL_DOWN pressed");
|
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);
|
log_d("Setting new volume %d", vol);
|
||||||
audio.setVolume(vol);
|
audio.setVolume(vol);
|
||||||
} else if (is_button_pressed(PIN_BTN_TRACK_NEXT)) {
|
} else if (is_button_pressed(PIN_BTN_TRACK_NEXT)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user