From 17bd263cf8b0ad4d3da36b6c5d86f18e2c2a19c3 Mon Sep 17 00:00:00 2001 From: dronus Date: Sat, 9 Nov 2019 20:49:57 +0100 Subject: [PATCH] fixed compilation for non-I2C_DISPLAY build --- MicroDexed.ino | 19 ++++++++++++++++++- UI.cpp | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index f2f3709..dfa264d 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -49,6 +49,8 @@ Bounce but[2] = {Bounce(BUT_L_PIN, BUT_DEBOUNCE_MS), Bounce(BUT_R_PIN, BUT_DEBOU elapsedMillis master_timer; uint8_t ui_state = UI_MAIN; uint8_t ui_main_state = UI_MAIN_VOICE; +#else +float mapfloat(float val, float in_min, float in_max, float out_min, float out_max); #endif AudioPlayQueue queue1; @@ -407,8 +409,9 @@ void loop() if (master_timer >= TIMER_UI_HANDLING_MS) { master_timer -= TIMER_UI_HANDLING_MS; - +#ifdef I2C_DISPLAY handle_ui(); +#endif } #endif @@ -456,7 +459,9 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) if (inValue < MAX_BANKS) { configuration.bank = inValue; +#ifdef I2C_DISPLAY handle_ui(); +#endif } break; case 1: @@ -496,27 +501,37 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) case 103: // CC 103: filter resonance effect_filter_resonance = map(inValue, 0, 127, 0, ENC_FILTER_RES_STEPS); dexed->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS; +#ifdef I2C_DISPLAY handle_ui(); +#endif break; case 104: // CC 104: filter cutoff effect_filter_cutoff = map(inValue, 0, 127, 0, ENC_FILTER_CUT_STEPS); dexed->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS; +#ifdef I2C_DISPLAY handle_ui(); +#endif break; case 105: // CC 105: delay time effect_delay_time = map(inValue, 0, 127, 0, ENC_DELAY_TIME_STEPS); delay1.delay(0, mapfloat(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); +#ifdef I2C_DISPLAY handle_ui(); +#endif break; case 106: // CC 106: delay feedback effect_delay_feedback = map(inValue, 0, 127, 0, ENC_DELAY_FB_STEPS); mixer1.gain(1, mapfloat(float(effect_delay_feedback), 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); +#ifdef I2C_DISPLAY handle_ui(); +#endif break; case 107: // CC 107: delay volume effect_delay_volume = map(inValue, 0, 127, 0, ENC_DELAY_VOLUME_STEPS); mixer2.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delay tap1 signal (with added feedback) +#ifdef I2C_DISPLAY handle_ui(); +#endif break; case 120: dexed->panic(); @@ -553,7 +568,9 @@ void handleProgramChange(byte inChannel, byte inProgram) if (inProgram < MAX_VOICES) { load_sysex(configuration.bank, inProgram); +#ifdef I2C_DISPLAY handle_ui(); +#endif } } diff --git a/UI.cpp b/UI.cpp index 2d4824e..4b5b960 100644 --- a/UI.cpp +++ b/UI.cpp @@ -583,9 +583,10 @@ void ui_show_effects_delay(void) ui_state = UI_EFFECTS_DELAY; } +#endif float mapfloat(float val, float in_min, float in_max, float out_min, float out_max) { return (val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } -#endif +