From 8087f9367747ac274cc02619544d9c85aa7e3b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20Degerf=C3=A4lt?= Date: Fri, 21 Jun 2019 21:58:49 +0200 Subject: [PATCH] Use helper function for midi channel as well --- NuEVI/menu.cpp | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/NuEVI/menu.cpp b/NuEVI/menu.cpp index ea142fe..36d801e 100644 --- a/NuEVI/menu.cpp +++ b/NuEVI/menu.cpp @@ -335,6 +335,24 @@ static void drawSubBox(const char* label) display.println(label); } +static void plotSubOption(const char* label, int color) { + display.setTextColor(color); + display.setTextSize(2); + int x_pos = 91-strlen(label)*4; + display.setCursor(x_pos,33); + display.println(label); +} + +static void plotNum(int value, int color) { + int s = 0; + if(value > 99) s = 2*7; + else if(value > 9) s = 1*7; + display.setTextColor(color); + display.setTextSize(2); + display.setCursor(90-s ,33); + display.println(value); +} + static void plotTranspose(int color){ int value = transpose - 12; const char *sign = (value < 0) ? "-":"+"; @@ -383,12 +401,9 @@ static void plotOctave(int color){ display.println(abs(octave-3)); } -static void plotMIDI(int color){ - display.setTextColor(color); - display.setTextSize(2); - display.setCursor(90,33); - display.println(MIDIchannel); - if (slowMidi && color){ +static void plotMIDI(int color) { + plotNum(MIDIchannel, color); + if (slowMidi && color) { display.setTextColor(WHITE); } else { display.setTextColor(BLACK); @@ -398,25 +413,6 @@ static void plotMIDI(int color){ display.print("S"); } -static void plotSubOption(const char* label, int color) -{ - display.setTextColor(color); - display.setTextSize(2); - int x_pos = 91-strlen(label)*4; - display.setCursor(x_pos,33); - display.println(label); -} - -static void plotNum(int value, int color) { - int s = 0; - if(value > 99) s = 2*7; - else if(value > 9) s = 1*7; - display.setTextColor(color); - display.setTextSize(2); - display.setCursor(90-s ,33); - display.println(value); -} - static const char* breathCCMenuLabels[] = { "OFF", "MW", "BR", "VL", "EX", "MW+", "BR+", "VL+", "EX+", "CF", "20" };