@@ -445,15 +445,13 @@ void RCSwitch::enableReceive() {
445
445
if (this ->nReceiverInterrupt != -1 ) {
446
446
RCSwitch::nReceivedValue = NULL ;
447
447
RCSwitch::nReceivedBitlength = NULL ;
448
- attachInterrupt (this ->nReceiverInterrupt , handleInterrupt, CHANGE);
449
448
}
450
449
}
451
450
452
451
/* *
453
452
* Disable receiving data
454
453
*/
455
454
void RCSwitch::disableReceive () {
456
- detachInterrupt (this ->nReceiverInterrupt );
457
455
this ->nReceiverInterrupt = -1 ;
458
456
}
459
457
@@ -558,40 +556,6 @@ bool RCSwitch::receiveProtocol2(unsigned int changeCount){
558
556
}
559
557
560
558
}
561
- void RCSwitch::handleInterrupt () {
562
-
563
- static unsigned int duration;
564
- static unsigned int changeCount;
565
- static unsigned long lastTime;
566
- static unsigned int repeatCount;
567
-
568
-
569
- long time = micros ();
570
- duration = time - lastTime;
571
-
572
- if (duration > 5000 && duration > RCSwitch::timings[0 ] - 200 && duration < RCSwitch::timings[0 ] + 200 ) {
573
- repeatCount++;
574
- changeCount--;
575
- if (repeatCount == 2 ) {
576
- if (receiveProtocol1 (changeCount) == false ){
577
- if (receiveProtocol2 (changeCount) == false ){
578
- // failed
579
- }
580
- }
581
- repeatCount = 0 ;
582
- }
583
- changeCount = 0 ;
584
- } else if (duration > 5000 ) {
585
- changeCount = 0 ;
586
- }
587
-
588
- if (changeCount >= RCSWITCH_MAX_CHANGES) {
589
- changeCount = 0 ;
590
- repeatCount = 0 ;
591
- }
592
- RCSwitch::timings[changeCount++] = duration;
593
- lastTime = time ;
594
- }
595
559
596
560
/* *
597
561
* Turns a decimal value to its binary representation
0 commit comments