|
|
|
@ -221,8 +221,6 @@ void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bo |
|
|
|
|
void lcd_display_bar_int(const char* title, uint32_t value, float factor, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init); |
|
|
|
|
void lcd_display_bar_float(const char* title, float value, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init); |
|
|
|
|
void lcd_display_meter_float(const char* title, float value, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init); |
|
|
|
|
void lcd_display_bar_int_N(const char* title, uint32_t value, float diff, float factor, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init); |
|
|
|
|
void lcd_display_bar_float_N(const char* title, float value, float diff, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init); |
|
|
|
|
void lcd_special_chars(uint8_t mode); |
|
|
|
|
|
|
|
|
|
// normal menu
|
|
|
|
@ -979,7 +977,7 @@ void UI_func_chorus_frequency(uint8_t param) |
|
|
|
|
{ |
|
|
|
|
// setup function
|
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar_float_N("Chorus Frq.", configuration.chorus_frequency, float(ENCODER[ENC_R].speed()), 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, true); |
|
|
|
|
lcd_display_bar_float("Chorus Frq.", configuration.chorus_frequency, 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
@ -995,13 +993,9 @@ void UI_func_chorus_frequency(uint8_t param) |
|
|
|
|
else if (LCDML.BT_checkUp()) |
|
|
|
|
configuration.chorus_frequency = constrain(configuration.chorus_frequency - ENCODER[ENC_R].speed(), CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX); |
|
|
|
|
|
|
|
|
|
chorus_modulator.frequency(configuration.chorus_frequency / 10.0); |
|
|
|
|
|
|
|
|
|
lcd_display_bar_float_N("Chorus Frq.", configuration.chorus_frequency, float(ENCODER[ENC_R].speed()), 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, false); |
|
|
|
|
lcd_display_bar_float("Chorus Frq.", configuration.chorus_frequency, 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, false); |
|
|
|
|
|
|
|
|
|
/*lcd.setCursor(0, 1);
|
|
|
|
|
lcd_display_float(configuration.chorus_frequency / 10.0, 2, 1, false, true, false); |
|
|
|
|
lcd.print(F(" Hz"));*/ |
|
|
|
|
chorus_modulator.frequency(configuration.chorus_frequency / 10.0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3257,106 +3251,12 @@ inline void lcd_display_bar_int(const char* title, uint32_t value, float factor, |
|
|
|
|
|
|
|
|
|
void lcd_display_bar_float(const char* title, float value, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init) |
|
|
|
|
{ |
|
|
|
|
float _v = float((value - min_value) * LCD_cols) / (max_value - min_value); |
|
|
|
|
float _vi = 0.0; |
|
|
|
|
uint8_t vf = uint8_t(modff(_v, &_vi) * 10.0 + 0.5); |
|
|
|
|
uint8_t vi = uint8_t(_vi + 0.5); |
|
|
|
|
uint8_t size = 0; |
|
|
|
|
|
|
|
|
|
if (size_fraction == 0) |
|
|
|
|
size = size_number; |
|
|
|
|
else |
|
|
|
|
size = size_number + size_fraction + 1; |
|
|
|
|
|
|
|
|
|
if (brackets == true) |
|
|
|
|
size += 2; |
|
|
|
|
|
|
|
|
|
if (init == true) |
|
|
|
|
{ |
|
|
|
|
// show initial title, value and bar
|
|
|
|
|
LCDML.DISP_clear(); |
|
|
|
|
lcd.show(0, 0, LCD_cols - 1, title); |
|
|
|
|
lcd.setCursor(LCD_cols - size, 0); |
|
|
|
|
lcd_display_float(value * factor, size_number, size_fraction, zeros, brackets, sign); |
|
|
|
|
lcd.setCursor(0, 1); |
|
|
|
|
|
|
|
|
|
if (vi == 0 && uint8_t(vf / 2) == 0) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(0, 1); |
|
|
|
|
lcd.write((uint8_t)0); // minimal block
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
for (uint8_t i = 0; i < LCD_cols; i++) |
|
|
|
|
{ |
|
|
|
|
if (i <= vi) |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
else |
|
|
|
|
lcd.print(F(" ")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (vf > 1) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(vi , 1); |
|
|
|
|
lcd.write((uint8_t)int(vf / 2) - 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// show only changed value and changed part of the bar
|
|
|
|
|
uint8_t ca = uint8_t (float(LCD_cols - 1) / float(max_value)) + 1; |
|
|
|
|
|
|
|
|
|
lcd.setCursor(LCD_cols - size, 0); |
|
|
|
|
lcd_display_float(value * factor, size_number, size_fraction, zeros, brackets, sign); |
|
|
|
|
|
|
|
|
|
if (vi == 0 && uint8_t(vf / 2) == 0) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(0, 1); |
|
|
|
|
lcd.write((uint8_t)0); // minimal block
|
|
|
|
|
for (uint8_t n = 1; n <= ca; n++) |
|
|
|
|
lcd.print(F(" ")); |
|
|
|
|
} |
|
|
|
|
else if (vi == LCD_cols - 1 && uint8_t(vf / 2) == 0) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(LCD_cols - 1 - ca, 1); |
|
|
|
|
for (uint8_t n = LCD_cols - 1 - ca; n < LCD_cols; n++) |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
uint8_t b = max(0, vi - ca); |
|
|
|
|
uint8_t e = min(LCD_cols - 1, vi + ca); |
|
|
|
|
|
|
|
|
|
for (uint8_t n = b; n <= e; n++) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(n, 1); |
|
|
|
|
if (n < vi) |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
else if (n == vi && uint8_t(vf / 2) != 0) |
|
|
|
|
lcd.write(uint8_t(vf / 2) - 1); |
|
|
|
|
else |
|
|
|
|
lcd.print(F(" ")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
inline void lcd_display_bar_int_N(const char* title, uint32_t value, int16_t diff, float factor, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init) |
|
|
|
|
{ |
|
|
|
|
lcd_display_bar_float_N(title, float(value), float(diff), factor, min_value, max_value, size, 0, zeros, brackets, sign, init); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void lcd_display_bar_float_N(const char* title, float value, float diff, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init) |
|
|
|
|
{ |
|
|
|
|
uint8_t size = 0; |
|
|
|
|
float value_old = value + diff; |
|
|
|
|
float v = float((value - min_value) * LCD_cols) / (max_value - min_value); |
|
|
|
|
float _vi = 0.0; |
|
|
|
|
uint8_t vf = uint8_t(modff(v, &_vi) * 10.0 + 0.5); |
|
|
|
|
uint8_t vi = uint8_t(_vi); |
|
|
|
|
float v_o = float((value - min_value) * LCD_cols) / (max_value - min_value); |
|
|
|
|
uint8_t vf_o = uint8_t(modff(v, &_vi) * 10.0 + 0.5); |
|
|
|
|
uint8_t vi_o = uint8_t(_vi); |
|
|
|
|
|
|
|
|
|
if (size_fraction == 0) |
|
|
|
|
size = size_number; |
|
|
|
@ -3374,7 +3274,7 @@ void lcd_display_bar_float_N(const char* title, float value, float diff, float f |
|
|
|
|
lcd.setCursor(0, 0); |
|
|
|
|
lcd.print(title); |
|
|
|
|
|
|
|
|
|
// Value
|
|
|
|
|
// Value-Brackets
|
|
|
|
|
if (brackets == true) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(LCD_cols - size, 0); |
|
|
|
@ -3382,59 +3282,31 @@ void lcd_display_bar_float_N(const char* title, float value, float diff, float f |
|
|
|
|
lcd.setCursor(LCD_cols - 1, 0); |
|
|
|
|
lcd.print(F("]")); |
|
|
|
|
} |
|
|
|
|
lcd.setCursor(LCD_cols - size, 0); |
|
|
|
|
lcd_display_float(value * factor, size_number, size_fraction, zeros, brackets, sign); |
|
|
|
|
|
|
|
|
|
// Bar
|
|
|
|
|
lcd.setCursor(0, 1); |
|
|
|
|
if (vi == 0) |
|
|
|
|
lcd.write((uint8_t)vf / 2.0); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
for (uint8_t i = 0; i < vi; i++) |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
if (vi < LCD_cols) |
|
|
|
|
lcd.write((uint8_t)vf / 2.0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
// Value
|
|
|
|
|
lcd.setCursor(LCD_cols - size, 0); |
|
|
|
|
lcd_display_float(value * factor, size_number, size_fraction, zeros, brackets, sign); |
|
|
|
|
|
|
|
|
|
// Bar
|
|
|
|
|
lcd.setCursor(0, 1); |
|
|
|
|
|
|
|
|
|
if (vi == 0) |
|
|
|
|
{ |
|
|
|
|
if (vf / 2.0 == 0) |
|
|
|
|
lcd.write((uint8_t)0); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
lcd.write((uint8_t)vf / 2.0); |
|
|
|
|
for (uint8_t i = vi; i < LCD_cols; i++) |
|
|
|
|
lcd.print(F(" ")); // empty block
|
|
|
|
|
} |
|
|
|
|
lcd.write((uint8_t)vf / 2.0 - 0.5); |
|
|
|
|
lcd.print(F(" ")); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
for (uint8_t i = 0; i < vi; i++) |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
if (vi < LCD_cols) |
|
|
|
|
lcd.write((uint8_t)vf / 2.0); |
|
|
|
|
if (vi < LCD_cols - 1) |
|
|
|
|
for (uint8_t i = vi; i < LCD_cols; i++) |
|
|
|
|
lcd.write((uint8_t)vf / 2.0 - 0.5); |
|
|
|
|
for (uint8_t i = LCD_cols - vi; i < LCD_cols; i++) |
|
|
|
|
lcd.print(F(" ")); // empty block
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
lcd.setCursor(n, 1); |
|
|
|
|
lcd.write((uint8_t)0); // minimal block
|
|
|
|
|
cd.write((uint8_t)4); // full block
|
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void lcd_display_meter_float(const char* title, float value, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init) |
|
|
|
|
{ |
|
|
|
|
; |
|
|
|
|