@@ -388,8 +388,10 @@ void setup() {
388388 /* **** LED SEGMENT INITIALISATION *****/
389389
390390 /* **** BUTTONS INITIALISATION *****/
391- PCMSK0 |= (1 << PCINT4); // set PCINT4 (PIN 12) to trigger an interrupt on state change
392- PCMSK2 |= (1 << PCINT20); // set PCINT20 (PIN 4) to trigger an interrupt on state change
391+ #ifdef DEEP_SLEEP
392+ PCMSK0 = (1 << PCINT4); // set PCINT4 (PIN 12) to trigger an interrupt on state change
393+ PCMSK2 = (1 << PCINT20); // set PCINT20 (PIN 4) to trigger an interrupt on state change
394+ #endif
393395
394396 // link the Main button functions.
395397 mainButton.setClickTicks (CLICK);
@@ -443,7 +445,9 @@ void loop() {
443445 if (actionMode) {
444446 delay (500 );
445447 actionMode = false ;
448+ #ifdef LIGHT_EFFECTS
446449 TIMSK2 = 0 ;
450+ #endif
447451 dfplayer.playPhysicalTrack (soundFont.getPowerOff ());
448452 changeMenu = false ;
449453 ignition = false ;
@@ -544,7 +548,7 @@ void loop() {
544548#endif
545549
546550 sndSuppress = millis ();
547-
551+ # ifdef LIGHT_EFFECTS
548552 /*
549553 * Interrupt Timer2 configuration
550554 */
@@ -554,6 +558,7 @@ void loop() {
554558 TCCR2B |= (1 << CS21) | (1 << CS22);
555559 // start timer2 compare interrupt:
556560 TIMSK2 |= (1 << OCIE2A);
561+ #endif
557562
558563 // Get the initial position of the motion detector
559564 motionEngine ();
@@ -943,7 +948,9 @@ void loop() {
943948
944949 if (ignition) { // we just leaved Action Mode
945950 detachInterrupt (0 );
946- TIMSK2 = 0 ;
951+ #ifdef LIGHT_EFFECTS
952+ TIMSK2 &= ~(1 <<OCIE2A);
953+ #endif
947954 dfplayer.playPhysicalTrack (soundFont.getPowerOff ());
948955 changeMenu = false ;
949956 ignition = false ;
@@ -1287,6 +1294,7 @@ void fadeAccent() {
12871294 * each 22 µs this method is called and modifies the blade brightness
12881295 * The parameter is defined in ignition block
12891296 */
1297+ #ifdef LIGHT_EFFECTS
12901298ISR (TIMER2_COMPA_vect, ISR_NOBLOCK) {
12911299
12921300#ifdef LEDSTRINGS
@@ -1421,7 +1429,8 @@ ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) {
14211429 FoCOff (FoCSTRING);
14221430#endif
14231431 blink++;
1424- } else if (blink == 24 ) {
1432+ }
1433+ else if (blink == 24 ) {
14251434#ifdef LUXEON
14261435 getColor (currentColor, storage.mainColor );
14271436 lightOn (ledPins, currentColor);
@@ -1436,6 +1445,7 @@ ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) {
14361445 blink = 0 ;
14371446 blaster--;
14381447 }
1448+
14391449 } else if (lowBattery) {
14401450 uint8_t brightness;
14411451 if (blink == 0 ) {
@@ -1461,3 +1471,4 @@ ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) {
14611471
14621472}
14631473
1474+ #endif // LIGHT_EFFECTS
0 commit comments