From 69f8a443091f7e89ce14ea951d232ae979310c78 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 1 Oct 2018 13:25:49 +0200 Subject: [PATCH] Small fixes for displaying volume. --- UI.cpp | 19 ++++++++++++++----- config.h | 6 +++--- dexed_sysex.cpp | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/UI.cpp b/UI.cpp index bedbcdd..7214d43 100644 --- a/UI.cpp +++ b/UI.cpp @@ -198,11 +198,20 @@ void ui_show_volume(void) lcd.show(0, 0, LCD_CHARS, "Volume"); lcd.show(0, LCD_CHARS - 3, 3, vol * 100); - for (uint8_t i = 0; i < map(vol * 100, 0, 100, 0, LCD_CHARS); i++) - lcd.show(1, i, 1, "*"); - for (uint8_t i = map(vol * 100, 0, 100, 0, LCD_CHARS); i < LCD_CHARS; i++) - lcd.show(1, i, 1, " "); - + if (vol == 0.0) + lcd.show(1, 0, LCD_CHARS , " "); + else + { + if (vol < (float(LCD_CHARS) / 100)) + lcd.show(1, 0, LCD_CHARS, "*"); + else + { + for (uint8_t i = 0; i < map(vol * 100, 0, 100, 0, LCD_CHARS); i++) + lcd.show(1, i, 1, "*"); + for (uint8_t i = map(vol * 100, 0, 100, 0, LCD_CHARS); i < LCD_CHARS; i++) + lcd.show(1, i, 1, " "); + } + } ui_state = UI_VOLUME; } diff --git a/config.h b/config.h index 74fb2f3..16d5bde 100644 --- a/config.h +++ b/config.h @@ -66,7 +66,7 @@ // Debug output #define SERIAL_SPEED 38400 -#define DEBUG 1 +//#define DEBUG 1 #define SHOW_MIDI_EVENT 1 #define SHOW_XRUN 1 #define SHOW_CPU_LOAD_MSEC 5000 @@ -99,8 +99,8 @@ #define UI_AUTO_BACK_MS 2000 // Encoder with button -#define ENC_VOL_STEPS 50 -#define TIMER_UI_HANDLING_MS 50 +#define ENC_VOL_STEPS 43 +#define TIMER_UI_HANDLING_MS 100 #define NUM_ENCODER 2 #define ENC_L_PIN_A 3 #define ENC_L_PIN_B 2 diff --git a/dexed_sysex.cpp b/dexed_sysex.cpp index d28015f..1066c39 100644 --- a/dexed_sysex.cpp +++ b/dexed_sysex.cpp @@ -257,8 +257,8 @@ bool load_sysex(uint8_t b, uint8_t v) #endif return (dexed->loadSysexVoice(data)); } - else #ifdef DEBUG + else Serial.println(F("E : Cannot load voice data")); #endif }