Optimized code
- Removed unneccesary variable changes - Redesigned IF clauses to improve binary code size after compile Current binary size: 2092 bytes
This commit is contained in:
parent
d224488f2b
commit
be4a1b0488
1 changed files with 9 additions and 8 deletions
|
@ -52,12 +52,10 @@ void loop() {
|
||||||
case 0:
|
case 0:
|
||||||
digitalWrite(PINLIGHT, HIGH);
|
digitalWrite(PINLIGHT, HIGH);
|
||||||
effLight = 1;
|
effLight = 1;
|
||||||
sleepBool = false;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
effLight = 2;
|
effLight = 2;
|
||||||
sleepBool = false;
|
|
||||||
effStrobo = geninterval();
|
effStrobo = geninterval();
|
||||||
stroboMillis = millis();
|
stroboMillis = millis();
|
||||||
break;
|
break;
|
||||||
|
@ -65,8 +63,6 @@ void loop() {
|
||||||
case 2:
|
case 2:
|
||||||
digitalWrite(PINLIGHT, LOW);
|
digitalWrite(PINLIGHT, LOW);
|
||||||
effLight = 0;
|
effLight = 0;
|
||||||
effStrobo = 0;
|
|
||||||
sleepBool = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,10 +75,10 @@ void loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((effLight == 0) && (effLaser == 0) && (!sleepBool)) {
|
// if((effLight == 0) && (effLaser == 0) && (!sleepBool)) {
|
||||||
sleepBool = true;
|
// sleepBool = true;
|
||||||
sleepMillis = millis();
|
// sleepMillis = millis();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(sleepBool) {
|
if(sleepBool) {
|
||||||
if(millis() - sleepMillis > 200) {
|
if(millis() - sleepMillis > 200) {
|
||||||
|
@ -101,6 +97,11 @@ void loop() {
|
||||||
PCMSK = 0; // We disabled PCINT so we don't need to know what kind of PCINT we should listen to
|
PCMSK = 0; // We disabled PCINT so we don't need to know what kind of PCINT we should listen to
|
||||||
sei(); // Cleanup done, enable interrupt handling again.
|
sei(); // Cleanup done, enable interrupt handling again.
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if((effLight == 0) && (effLaser == 0)) {
|
||||||
|
sleepBool = true;
|
||||||
|
sleepMillis = millis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue