* The main decode function, attempts to decode the recently receive IR signal. * The set of decoders used is determined by active definitions of the DECODE_ macros. * Results of decoding are stored in IrReceiver.decodedIRData.* like e.g. IrReceiver.decodedIRData.command. * @return false if no IR receiver data available, true if data available. */
| 561 | * @return false if no IR receiver data available, true if data available. |
| 562 | */ |
| 563 | bool IRrecv::decode() { |
| 564 | if (irparams.StateForISR != IR_REC_STATE_STOP) { |
| 565 | return false; |
| 566 | } |
| 567 | |
| 568 | /* |
| 569 | * Support for old examples, which do not use the default IrReceiver instance |
| 570 | */ |
| 571 | if (this != &IrReceiver) { |
| 572 | decodedIRData.initialGapTicks = irparams.initialGapTicks; |
| 573 | decodedIRData.rawlen = irparams.rawlen; |
| 574 | } |
| 575 | |
| 576 | initDecodedIRData(); // sets IRDATA_FLAGS_WAS_OVERFLOW |
| 577 | |
| 578 | if (decodedIRData.flags & IRDATA_FLAGS_WAS_OVERFLOW) { |
| 579 | /* |
| 580 | * Set OverflowFlag flag and return true here, to let the loop call resume or print raw data. |
| 581 | */ |
| 582 | decodedIRData.protocol = UNKNOWN; |
| 583 | return true; |
| 584 | } |
| 585 | |
| 586 | #if defined(DECODE_NEC) || defined(DECODE_ONKYO) |
| 587 | TRACE_PRINTLN(F("Attempting NEC/Onkyo decode")); |
| 588 | if (decodeNEC()) { |
| 589 | return true; |
| 590 | } |
| 591 | #endif |
| 592 | |
| 593 | #if defined(DECODE_KASEIKYO) |
| 594 | TRACE_PRINTLN(F("Attempting Panasonic/Kaseikyo decode")); |
| 595 | if (decodeKaseikyo()) { |
| 596 | return true; |
| 597 | } |
| 598 | #endif |
| 599 | |
| 600 | #if defined(DECODE_DENON) |
| 601 | TRACE_PRINTLN(F("Attempting Denon/Sharp decode")); |
| 602 | if (decodeDenon()) { |
| 603 | return true; |
| 604 | } |
| 605 | #endif |
| 606 | |
| 607 | #if defined(DECODE_SONY) |
| 608 | TRACE_PRINTLN(F("Attempting Sony decode")); |
| 609 | if (decodeSony()) { |
| 610 | return true; |
| 611 | } |
| 612 | #endif |
| 613 | |
| 614 | #if defined(DECODE_RC5) || defined(DECODE_MARANTZ) |
| 615 | # if defined(DECODE_RC5) && !defined(DECODE_MARANTZ) |
| 616 | TRACE_PRINTLN(F("Attempting RC5 decode")); |
| 617 | # elif !defined(DECODE_RC5) && defined(DECODE_MARANTZ) |
| 618 | TRACE_PRINTLN(F("Attempting Marantz decode")); |
| 619 | # else |
| 620 | TRACE_PRINTLN(F("Attempting RC5 and Marantz decode")); |
nothing calls this directly
no outgoing calls
no test coverage detected