@@ -347,7 +347,7 @@ bool PulseSensorPlayground::setupInterrupt(){
347347 #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
348348
349349 // check to see if the Servo library is in use
350- #if defined Servo_h
350+ #if __has_include (<Servo.h>)
351351 // Initializes Timer2 to throw an interrupt every 2mS
352352 // Interferes with PWM on pins 3 and 11
353353 #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
@@ -396,7 +396,7 @@ bool PulseSensorPlayground::setupInterrupt(){
396396 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
397397
398398 // check to see if the Servo library is in use
399- #if defined Servo_h
399+ #if __has_include (<Servo.h>)
400400 // Initializes Timer1 to throw an interrupt every 2mS.
401401 // Interferes with PWM on pins 9 and 10
402402 TCCR1A = 0x00 ; // Disable PWM and go into CTC mode
@@ -519,7 +519,7 @@ bool PulseSensorPlayground::enableInterrupt(){
519519#if USE_HARDWARE_TIMER
520520 #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
521521 // check to see if the Servo library is in use
522- #if defined Servo_h
522+ #if __has_include (<Servo.h>)
523523 #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
524524 DISABLE_PULSE_SENSOR_INTERRUPTS ;
525525 TIMSK2 = 0x02 ; // Enable OCR2A match interrupt
@@ -541,7 +541,7 @@ bool PulseSensorPlayground::enableInterrupt(){
541541
542542 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
543543 // check to see if the Servo library is in use
544- #if defined Servo_h
544+ #if __has_include (<Servo.h>)
545545 DISABLE_PULSE_SENSOR_INTERRUPTS ;
546546 TIMSK1 = 0x02 ; // Enable OCR1A match interrupt
547547 ENABLE_PULSE_SENSOR_INTERRUPTS ;
@@ -602,7 +602,7 @@ bool PulseSensorPlayground::disableInterrupt(){
602602#if USE_HARDWARE_TIMER
603603 #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
604604 // check to see if the Servo library is in use
605- #if defined Servo_h
605+ #if __has_include (<Servo.h>)
606606 #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
607607 DISABLE_PULSE_SENSOR_INTERRUPTS ;
608608 TIMSK2 = 0x00 ; // Disable OCR2A match interrupt
@@ -624,7 +624,7 @@ bool PulseSensorPlayground::disableInterrupt(){
624624
625625 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
626626 // check to see if the Servo library is in use
627- #if defined Servo_h
627+ #if __has_include (<Servo.h>)
628628 DISABLE_PULSE_SENSOR_INTERRUPTS ;
629629 TIMSK1 = 0x00 ; // Disable OCR1A match interrupt
630630 ENABLE_PULSE_SENSOR_INTERRUPTS ;
0 commit comments