From 83635fc80e32dea108fa9b7573a9435f3a9cd94d Mon Sep 17 00:00:00 2001 From: positionhigh Date: Sat, 26 Jun 2021 20:52:12 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI.hpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/UI.hpp b/UI.hpp index e8cdd06..7968a3f 100644 --- a/UI.hpp +++ b/UI.hpp @@ -110,7 +110,8 @@ elapsedMillis back_from_volume; uint8_t instance_num[8][8]; const char accepted_chars[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-abcdefghijklmnopqrstuvwxyz"; uint8_t active_perform_page = 1; - +uint8_t orig_attack_values[2][7]; +uint8_t orig_release_values[2][7]; #ifdef I2C_DISPLAY #include @@ -4110,36 +4111,49 @@ void UI_func_volume(uint8_t param) if (LCDML.BT_checkDown() ) { + if (perform_attack_mod[selected_instance_id] == 0) + for (uint8_t i = 0; i < 6; i++) { + orig_attack_values[selected_instance_id][i] = MicroDexed[selected_instance_id]->getRateOP(i, ATTACK); + } perform_attack_mod[selected_instance_id] = constrain(perform_attack_mod[selected_instance_id] + ENCODER[ENC_L].speed(), -MAX_PERF_MOD, MAX_PERF_MOD); for (uint8_t i = 0; i < 6; i++) - MicroDexed[selected_instance_id]->setRateOP(i, ATTACK, MicroDexed[selected_instance_id]->getRateOP(i, ATTACK) - perform_attack_mod[selected_instance_id] ); + MicroDexed[selected_instance_id]->setRateOP(i, ATTACK, orig_attack_values[selected_instance_id][i] - perform_attack_mod[selected_instance_id] ); } else if (LCDML.BT_checkUp() ) { + if (perform_attack_mod[selected_instance_id] == 0) // Save initial Values + for (uint8_t i = 0; i < 6; i++) { + orig_attack_values[selected_instance_id][i] = MicroDexed[selected_instance_id]->getRateOP(i, ATTACK); + } + perform_attack_mod[selected_instance_id] = constrain(perform_attack_mod[selected_instance_id] - ENCODER[ENC_L].speed(), -MAX_PERF_MOD, MAX_PERF_MOD); for (uint8_t i = 0; i < 6; i++) - MicroDexed[selected_instance_id]->setRateOP(i, ATTACK, MicroDexed[selected_instance_id]->getRateOP(i, ATTACK) - perform_attack_mod[selected_instance_id] ); - + MicroDexed[selected_instance_id]->setRateOP(i, ATTACK, orig_attack_values[selected_instance_id][i] - perform_attack_mod[selected_instance_id] ); } - } else if (active_perform_page == 3) { //Release if (LCDML.BT_checkDown() ) { + if (perform_release_mod[selected_instance_id] == 0) // Save initial Values + for (uint8_t i = 0; i < 6; i++) { + orig_release_values[selected_instance_id][i] = MicroDexed[selected_instance_id]->getRateOP(i, RELEASE); + } perform_release_mod[selected_instance_id] = constrain(perform_release_mod[selected_instance_id] + ENCODER[ENC_L].speed(), -MAX_PERF_MOD, MAX_PERF_MOD); for (uint8_t i = 0; i < 6; i++) - MicroDexed[selected_instance_id]->setRateOP(i, RELEASE, MicroDexed[selected_instance_id]->getRateOP(i, RELEASE) - perform_release_mod[selected_instance_id] ); - + MicroDexed[selected_instance_id]->setRateOP(i, RELEASE, orig_release_values[selected_instance_id][i] - perform_release_mod[selected_instance_id] ); } else if (LCDML.BT_checkUp() ) { + if (perform_release_mod[selected_instance_id] == 0) + for (uint8_t i = 0; i < 6; i++) { + orig_release_values[selected_instance_id][i] = MicroDexed[selected_instance_id]->getRateOP(i, RELEASE); + } perform_release_mod[selected_instance_id] = constrain(perform_release_mod[selected_instance_id] - ENCODER[ENC_L].speed(), -MAX_PERF_MOD, MAX_PERF_MOD); for (uint8_t i = 0; i < 6; i++) - MicroDexed[selected_instance_id]->setRateOP(i, RELEASE, MicroDexed[selected_instance_id]->getRateOP(i, RELEASE) - perform_release_mod[selected_instance_id] ); - + MicroDexed[selected_instance_id]->setRateOP(i, RELEASE, orig_release_values[selected_instance_id][i] - perform_release_mod[selected_instance_id] ); } } }