From b156a5935df0c5d7134ce1b3c2d156bfd21f5cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20Degerf=C3=A4lt?= Date: Sat, 22 Jun 2019 00:17:08 +0200 Subject: [PATCH] Moved status led blink to function --- NuEVI/menu.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/NuEVI/menu.cpp b/NuEVI/menu.cpp index 17b74bc..bf3af12 100644 --- a/NuEVI/menu.cpp +++ b/NuEVI/menu.cpp @@ -1171,6 +1171,17 @@ static void checkForPatchView(int buttons) { } } +// This should be moved to a separate file/process that handles only led +void statusBlink() { + digitalWrite(statusLedPin,LOW); + delay(150); + digitalWrite(statusLedPin,HIGH); + delay(150); + digitalWrite(statusLedPin,LOW); + delay(150); + digitalWrite(statusLedPin,HIGH); +} + //*********************************************************** void menu() { @@ -1276,24 +1287,12 @@ void menu() { legacyBrAct = !legacyBrAct; dipSwBits = dipSwBits ^ (1<<2); writeSetting(DIPSW_BITS_ADDR,dipSwBits); - digitalWrite(statusLedPin,LOW); - delay(150); - digitalWrite(statusLedPin,HIGH); - delay(150); - digitalWrite(statusLedPin, LOW); - delay(150); - digitalWrite(statusLedPin,HIGH); + statusBlink(); } else if ((exSensor >= ((extracThrVal+extracMaxVal)/2))) { // switch pb pad activated legacy settings control on/off legacy = !legacy; dipSwBits = dipSwBits ^ (1<<1); writeSetting(DIPSW_BITS_ADDR,dipSwBits); - digitalWrite(statusLedPin,LOW); - delay(150); - digitalWrite(statusLedPin,HIGH); - delay(150); - digitalWrite(statusLedPin,LOW); - delay(150); - digitalWrite(statusLedPin,HIGH); + statusBlink(); } else if (pinkyKey && !specialKey){ //hold pinky key for rotator menu, and if too high touch sensing blocks regular menu, touching special key helps display.ssd1306_command(SSD1306_DISPLAYON); state = ROTATOR_MENU;