Wrap status led usage in neat functions
This commit is contained in:
parent
6f976ea14d
commit
a5385a9ec1
1 changed files with 34 additions and 27 deletions
|
@ -305,11 +305,8 @@ void setup() {
|
||||||
vibThrBiteLo = vibZeroBite + vibSquelchBite;
|
vibThrBiteLo = vibZeroBite + vibSquelchBite;
|
||||||
|
|
||||||
if(!fastBoot) {
|
if(!fastBoot) {
|
||||||
digitalWrite(statusLedPin, LOW);
|
statusLedFlash(500);
|
||||||
delay(250);
|
statusLedOff();
|
||||||
digitalWrite(statusLedPin,HIGH);
|
|
||||||
delay(250);
|
|
||||||
digitalWrite(statusLedPin,LOW);
|
|
||||||
|
|
||||||
showVersion();
|
showVersion();
|
||||||
|
|
||||||
|
@ -328,7 +325,7 @@ void setup() {
|
||||||
|
|
||||||
//Serial.begin(9600); // debug
|
//Serial.begin(9600); // debug
|
||||||
|
|
||||||
digitalWrite(statusLedPin,HIGH); // Switch on the onboard LED to indicate power on/ready
|
statusLedOn(); // Switch on the onboard LED to indicate power on/ready
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,9 +697,9 @@ void loop() {
|
||||||
// this is one of the big reasons the display is for setup use only
|
// this is one of the big reasons the display is for setup use only
|
||||||
drawSensorPixels(); // live sensor monitoring for the setup screens
|
drawSensorPixels(); // live sensor monitoring for the setup screens
|
||||||
if (rotatorOn || slurSustain || parallelChord || subOctaveDouble || gateOpen) {
|
if (rotatorOn || slurSustain || parallelChord || subOctaveDouble || gateOpen) {
|
||||||
digitalWrite(statusLedPin, !digitalRead(statusLedPin));
|
statusLedFlip();
|
||||||
} else if (!digitalRead(statusLedPin)) {
|
} else {
|
||||||
digitalWrite(statusLedPin, HIGH);
|
statusLedOn();
|
||||||
}
|
}
|
||||||
pixelUpdateTime = millis();
|
pixelUpdateTime = millis();
|
||||||
}
|
}
|
||||||
|
@ -944,10 +941,10 @@ void pitch_bend() {
|
||||||
pitchBend = constrain(pitchBend, 0, 16383);
|
pitchBend = constrain(pitchBend, 0, 16383);
|
||||||
|
|
||||||
if (subVibSquelch && (8192 != pitchBend)) {
|
if (subVibSquelch && (8192 != pitchBend)) {
|
||||||
digitalWrite(statusLedPin, LOW);
|
statusLedOff();
|
||||||
vibLedOff = 1;
|
vibLedOff = 1;
|
||||||
} else if (vibLedOff) {
|
} else if (vibLedOff) {
|
||||||
digitalWrite(statusLedPin, HIGH);
|
statusLedOn();
|
||||||
vibLedOff = 0;
|
vibLedOff = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,25 +969,14 @@ void doorKnobCheck() {
|
||||||
if ((touchValue[K4Pin] < ctouchThrVal) && (touchValue[R1Pin] < ctouchThrVal) && (touchValue[R2Pin] < ctouchThrVal) && (touchValue[R3Pin] < ctouchThrVal)) { // doorknob grip on canister
|
if ((touchValue[K4Pin] < ctouchThrVal) && (touchValue[R1Pin] < ctouchThrVal) && (touchValue[R2Pin] < ctouchThrVal) && (touchValue[R3Pin] < ctouchThrVal)) { // doorknob grip on canister
|
||||||
if (!gateOpen && (pbUp > ((pitchbMaxVal + pitchbThrVal) / 2))) {
|
if (!gateOpen && (pbUp > ((pitchbMaxVal + pitchbThrVal) / 2))) {
|
||||||
gateOpen = 1;
|
gateOpen = 1;
|
||||||
digitalWrite(statusLedPin, LOW);
|
statusLedFlash(100);
|
||||||
delay(50);
|
|
||||||
digitalWrite(statusLedPin, HIGH);
|
|
||||||
delay(50);
|
|
||||||
} else if (gateOpen && (pbDn > ((pitchbMaxVal + pitchbThrVal) / 2))) {
|
} else if (gateOpen && (pbDn > ((pitchbMaxVal + pitchbThrVal) / 2))) {
|
||||||
gateOpen = 0;
|
gateOpen = 0;
|
||||||
midiPanic();
|
midiPanic();
|
||||||
digitalWrite(statusLedPin, LOW);
|
statusLedFlash(100);
|
||||||
delay(50);
|
statusLedFlash(100);
|
||||||
digitalWrite(statusLedPin, HIGH);
|
statusLedFlash(100);
|
||||||
delay(50);
|
delay(600);
|
||||||
digitalWrite(statusLedPin, LOW);
|
|
||||||
delay(50);
|
|
||||||
digitalWrite(statusLedPin, HIGH);
|
|
||||||
delay(50);
|
|
||||||
digitalWrite(statusLedPin, LOW);
|
|
||||||
delay(50);
|
|
||||||
digitalWrite(statusLedPin, HIGH);
|
|
||||||
delay(700);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (gateOpen) {
|
} else if (gateOpen) {
|
||||||
|
@ -1184,3 +1170,24 @@ void readSwitches() {
|
||||||
}
|
}
|
||||||
lastFingering = fingeredNoteRead;
|
lastFingering = fingeredNoteRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void statusLedOn() {
|
||||||
|
digitalWrite(statusLedPin, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void statusLedOff() {
|
||||||
|
digitalWrite(statusLedPin, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void statusLedFlip() {
|
||||||
|
digitalWrite(statusLedPin, !digitalRead(statusLedPin));
|
||||||
|
}
|
||||||
|
|
||||||
|
void statusLedFlash(uint16_t delayTime) {
|
||||||
|
statusLedOff();
|
||||||
|
delay(delayTime/2);
|
||||||
|
statusLedOn();
|
||||||
|
delay(delayTime/2);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue