From 47aadf559d359d7e270eb4b5451ee68cd6d1d464 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Mon, 24 Jul 2017 14:51:03 -0600 Subject: [PATCH 01/11] Update Contributors.md (#488) --- Contributors.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Contributors.md b/Contributors.md index bf1e64dbd..1bed7b6d4 100644 --- a/Contributors.md +++ b/Contributors.md @@ -3,7 +3,6 @@ These are the active contributors of this project that you may contact if there - [z3t0](https://github.com/z3t0) : Active Contributor and currently also the main contributor. * Email: zetoslab@gmail.com - * Skype: polarised16 - [shirriff](https://github.com/shirriff) : An amazing person who worked to create this awesome library and provide unending support - [AnalysIR](https:/github.com/AnalysIR): Active contributor and is amazing with providing support! - [Informatic](https://github.com/Informatic) : Active contributor From 1154607b690aca0ec2d6822e10ce53be3f1c5f1b Mon Sep 17 00:00:00 2001 From: PaulStoffregen Date: Mon, 4 Sep 2017 20:48:37 -0700 Subject: [PATCH 02/11] Fix minor compiler warnings in examples --- examples/IRrecord/IRrecord.ino | 2 +- examples/IRtest2/IRtest2.ino | 6 +++--- examples/LGACSendDemo/LGACSendDemo.ino | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/IRrecord/IRrecord.ino b/examples/IRrecord/IRrecord.ino index 7fc5cfd39..a121e590d 100644 --- a/examples/IRrecord/IRrecord.ino +++ b/examples/IRrecord/IRrecord.ino @@ -45,7 +45,7 @@ int toggle = 0; // The RC5/6 toggle state // Most of this code is just logging void storeCode(decode_results *results) { codeType = results->decode_type; - int count = results->rawlen; + //int count = results->rawlen; if (codeType == UNKNOWN) { Serial.println("Received unknown code, saving as raw"); codeLen = results->rawlen - 1; diff --git a/examples/IRtest2/IRtest2.ino b/examples/IRtest2/IRtest2.ino index 56b8a4d2a..22a8fa2f8 100644 --- a/examples/IRtest2/IRtest2.ino +++ b/examples/IRtest2/IRtest2.ino @@ -61,7 +61,7 @@ void setup() // Wait for the gap between tests, to synchronize with // the sender. // Specifically, wait for a signal followed by a gap of at last gap ms. -void waitForGap(int gap) { +void waitForGap(unsigned long gap) { Serial.println("Waiting for gap"); while (1) { while (digitalRead(RECV_PIN) == LOW) { @@ -125,7 +125,7 @@ void dump(decode_results *results) { // The motivation behind this method is that the sender and the receiver // can do the same test calls, and the mode variable indicates whether // to send or receive. -void test(char *label, int type, unsigned long value, int bits) { +void test(const char *label, int type, unsigned long value, int bits) { if (mode == SENDER) { Serial.println(label); if (type == NEC) { @@ -175,7 +175,7 @@ void test(char *label, int type, unsigned long value, int bits) { // Test raw send or receive. This is similar to the test method, // except it send/receives raw data. -void testRaw(char *label, unsigned int *rawbuf, int rawlen) { +void testRaw(const char *label, unsigned int *rawbuf, int rawlen) { if (mode == SENDER) { Serial.println(label); irsend.sendRaw(rawbuf, rawlen, 38 /* kHz */); diff --git a/examples/LGACSendDemo/LGACSendDemo.ino b/examples/LGACSendDemo/LGACSendDemo.ino index da5db37eb..e3c7dfa3d 100644 --- a/examples/LGACSendDemo/LGACSendDemo.ino +++ b/examples/LGACSendDemo/LGACSendDemo.ino @@ -192,12 +192,12 @@ void loop() ac_activate(AC_TEMPERATURE, AC_FLOW); break; case 2: - if ( b == 0 | b == 1 ) { + if ( b == 0 || b == 1 ) { ac_change_air_swing(b); } break; case 3: // 1 : clean on, power on - if ( b == 0 | b == 1 ) { + if ( b == 0 || b == 1 ) { ac_air_clean(b); } break; From 7734a90db3a65541563801691288f491624a185f Mon Sep 17 00:00:00 2001 From: "alastair.mccormack" Date: Thu, 23 Nov 2017 15:44:56 +0100 Subject: [PATCH 03/11] Added Sparkfun Pro Micro pinouts Used -DARDUINO_AVR_PROMICRO to determine which timers are available and pin mapping. Also removed separate ifdef in --- boarddefs.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/boarddefs.h b/boarddefs.h index 17e25513e..917cd7c54 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -70,8 +70,14 @@ // switch IRremote to use a different timer. // +// Sparkfun Pro Micro +#if defined(ARDUINO_AVR_PROMICRO) + //#define IR_USE_TIMER1 // tx = pin 9 + #define IR_USE_TIMER3 // tx = pin 5 + //#define IR_USE_TIMER4_HS // tx = pin 5 + // Arduino Mega -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //#define IR_USE_TIMER1 // tx = pin 11 #define IR_USE_TIMER2 // tx = pin 9 //#define IR_USE_TIMER3 // tx = pin 5 @@ -246,19 +252,19 @@ # define TIMER_PWM_PIN CORE_OC1A_PIN // Teensy #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) # define TIMER_PWM_PIN 11 // Arduino Mega -#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) -# define TIMER_PWM_PIN 13 // MegaCore +#elif #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ || defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \ -|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) -# define TIMER_PWM_PIN 13 // MightyCore -#elif defined(__AVR_ATtiny84__) -# define TIMER_PWM_PIN 6 +|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) \ +|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) +# define TIMER_PWM_PIN 13 // MightyCore, // MegaCore +#elif defined(__AVR_ATtiny84__) || +# define TIMER_PWM_PIN 6 #else -# define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, etc +# define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, Sparkfun Pro Micro etc #endif // ATmega48, ATmega88, ATmega168, ATmega328 //--------------------------------------------------------- @@ -291,8 +297,8 @@ //----------------- #if defined(CORE_OC3A_PIN) # define TIMER_PWM_PIN CORE_OC3A_PIN // Teensy -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 5 // Arduino Mega +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(ARDUINO_AVR_PROMICRO) +# define TIMER_PWM_PIN 5 // Arduino Mega, Sparkfun Pro Micro #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) # define TIMER_PWM_PIN 6 // MightyCore #else @@ -339,6 +345,8 @@ //----------------- #if defined(CORE_OC4A_PIN) # define TIMER_PWM_PIN CORE_OC4A_PIN // Teensy +#elif defined(ARDUINO_AVR_PROMICRO) +# define TIMER_PWM_PIN 5 // Sparkfun Pro Micro #elif defined(__AVR_ATmega32U4__) # define TIMER_PWM_PIN 13 // Leonardo #else From c2d25b4dd96563c3f38e5ca4f43ffc4715e38705 Mon Sep 17 00:00:00 2001 From: "alastair.mccormack" Date: Thu, 23 Nov 2017 17:30:25 +0100 Subject: [PATCH 04/11] Added Sparkfun timer and pins information --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 00a4b03be..b6018993e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Whether you use the Adafruit Neopixel lib, or FastLED, interrupts get disabled o - ATtiny 84 / 85 - ESP32 (receive only) - ESP8266 is supported in a fork based on an old codebase that isn't as recent, but it works reasonably well given that perfectly timed sub millisecond interrupts are different on that chip. See https://github.com/markszabo/IRremoteESP8266 +- Sparkfun Pro Micro We are open to suggestions for adding support to new boards, however we highly recommend you contact your supplier first and ask them to provide support from their side. @@ -56,6 +57,7 @@ We are open to suggestions for adding support to new boards, however we highly r | [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/) | **1**, 16, 25 | 1, **2**, 3 | | [Teensy 3.0 / 3.1](https://www.pjrc.com/teensy/) | **5** | **CMT** | | [Teensy-LC](https://www.pjrc.com/teensy/) | **16** | **TPM1** | +| [Sparkfun Pro Micro](https://www.sparkfun.com/products/12640) | 9, **5**, 5 | 1, **3**, 4 | ### Experimental patches From 20bc39a68f0b161179604d80ac03e06bcaabf4f2 Mon Sep 17 00:00:00 2001 From: "alastair.mccormack" Date: Sun, 3 Dec 2017 20:09:23 +0000 Subject: [PATCH 05/11] Corrected TIMER4_HS output on Sparkfun Pro Micro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use O̅C̅4̅A̅ (complimentary output pin) to output to pin 5 (shared with OC3A) on Sparkfun Pro Micro --- README.md | 2 +- boarddefs.h | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b6018993e..9acb9d76b 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ We are open to suggestions for adding support to new boards, however we highly r | [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/) | **1**, 16, 25 | 1, **2**, 3 | | [Teensy 3.0 / 3.1](https://www.pjrc.com/teensy/) | **5** | **CMT** | | [Teensy-LC](https://www.pjrc.com/teensy/) | **16** | **TPM1** | -| [Sparkfun Pro Micro](https://www.sparkfun.com/products/12640) | 9, **5**, 5 | 1, **3**, 4 | +| [Sparkfun Pro Micro](https://www.sparkfun.com/products/12640) | 9, **5**, 5 | 1, **3**, 4_HS | ### Experimental patches diff --git a/boarddefs.h b/boarddefs.h index 917cd7c54..896f0740a 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -252,7 +252,6 @@ # define TIMER_PWM_PIN CORE_OC1A_PIN // Teensy #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) # define TIMER_PWM_PIN 11 // Arduino Mega -#elif #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ @@ -261,7 +260,7 @@ || defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) \ || defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) # define TIMER_PWM_PIN 13 // MightyCore, // MegaCore -#elif defined(__AVR_ATtiny84__) || +#elif defined(__AVR_ATtiny84__) # define TIMER_PWM_PIN 6 #else # define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, Sparkfun Pro Micro etc @@ -311,12 +310,21 @@ #elif defined(IR_USE_TIMER4_HS) #define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) -#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) + +#if defined(ARDUINO_AVR_PROMICRO) // Sparkfun Pro Micro + #define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A0)) // Use complimentary O̅C̅4̅A̅ output on pin 5 + #define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A0))) // (Pro Micro does not map PC7 (32/ICP3/CLK0/OC4A) + // of ATmega32U4 ) +#else + #define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) + #define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) +#endif + #define TIMER_ENABLE_INTR (TIMSK4 = _BV(TOIE4)) #define TIMER_DISABLE_INTR (TIMSK4 = 0) #define TIMER_INTR_NAME TIMER4_OVF_vect + #define TIMER_CONFIG_KHZ(val) ({ \ const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ TCCR4A = (1< Date: Sun, 3 Dec 2017 20:19:16 +0000 Subject: [PATCH 06/11] Supported board order Correct Sparkfun Pro Micro position in supported board order --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9acb9d76b..188be38bf 100644 --- a/README.md +++ b/README.md @@ -52,12 +52,12 @@ We are open to suggestions for adding support to new boards, however we highly r | [ATmega64, ATmega128](https://github.com/MCUdude/MegaCore) | **13** | **1** | | ATmega1280, ATmega2560 | 5, 6, **9**, 11, 46 | 1, **2**, 3, 4, 5 | | [ESP32](http://esp32.net/) | N/A (not supported) | **1** | +| [Sparkfun Pro Micro](https://www.sparkfun.com/products/12640) | 9, **5**, 5 | 1, **3**, 4_HS | | [Teensy 1.0](https://www.pjrc.com/teensy/) | **17** | **1** | | [Teensy 2.0](https://www.pjrc.com/teensy/) | 9, **10**, 14 | 1, 3, **4_HS** | | [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/) | **1**, 16, 25 | 1, **2**, 3 | | [Teensy 3.0 / 3.1](https://www.pjrc.com/teensy/) | **5** | **CMT** | | [Teensy-LC](https://www.pjrc.com/teensy/) | **16** | **TPM1** | -| [Sparkfun Pro Micro](https://www.sparkfun.com/products/12640) | 9, **5**, 5 | 1, **3**, 4_HS | ### Experimental patches From 06d06019a6e0488b605ba299b1efd54d3bd70767 Mon Sep 17 00:00:00 2001 From: "alastair.mccormack" Date: Sun, 3 Dec 2017 20:22:37 +0000 Subject: [PATCH 07/11] Removed whitespace --- boarddefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boarddefs.h b/boarddefs.h index 896f0740a..6f5cc13eb 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -261,7 +261,7 @@ || defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) # define TIMER_PWM_PIN 13 // MightyCore, // MegaCore #elif defined(__AVR_ATtiny84__) -# define TIMER_PWM_PIN 6 +# define TIMER_PWM_PIN 6 #else # define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, Sparkfun Pro Micro etc #endif // ATmega48, ATmega88, ATmega168, ATmega328 From 46b7a72da0d8814fb5c6b604f8322f95176f33c6 Mon Sep 17 00:00:00 2001 From: "alastair.mccormack" Date: Sun, 3 Dec 2017 20:36:49 +0000 Subject: [PATCH 08/11] Sparkfun Pro Micro credit --- boarddefs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boarddefs.h b/boarddefs.h index 6f5cc13eb..30ddb00fa 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -15,6 +15,8 @@ // // JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post) // Whynter A/C ARC-110WD added by Francesco Meschia + +// Sparkfun Pro Micro support by Alastair McCormack //****************************************************************************** #ifndef boarddefs_h From 5a2ded839c4bac700bed9caa47257ca29a820797 Mon Sep 17 00:00:00 2001 From: "alastair.mccormack" Date: Sun, 3 Dec 2017 21:27:35 +0000 Subject: [PATCH 09/11] Typo Removed erroneous `//` --- boarddefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boarddefs.h b/boarddefs.h index 30ddb00fa..a61dd856f 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -261,7 +261,7 @@ || defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \ || defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) \ || defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) -# define TIMER_PWM_PIN 13 // MightyCore, // MegaCore +# define TIMER_PWM_PIN 13 // MightyCore, MegaCore #elif defined(__AVR_ATtiny84__) # define TIMER_PWM_PIN 6 #else From a6b9cc277be35960e8c45f1252a10c6e822fd1d8 Mon Sep 17 00:00:00 2001 From: LSUPERMAN735 Date: Mon, 12 Mar 2018 18:11:55 +0100 Subject: [PATCH 10/11] Create readmdFrench.md French translation by @Lsuperman735 --- readmdFrench.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 readmdFrench.md diff --git a/readmdFrench.md b/readmdFrench.md new file mode 100644 index 000000000..e531e9442 --- /dev/null +++ b/readmdFrench.md @@ -0,0 +1,97 @@ +## IRremote Library + + +Cette bibliothèque vous permet d'envoyer et de recevoir des signaux infrarouges sur un Arduino. +Des tutoriels et plus d'informations seront disponibles sur la page d'accueil officielle. + +## Version - 2.2.3 + +## Installation +1. Allez à la [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page. +2. Téléchargez la dernière version. +3. Extraire le fichier zip +4. Déplacez le dossier "IRremote" vers vos bibliothèques. +5. Assurez-vous de supprimer Arduino_Root / libraries / RobotIRremote. Où Arduino_Root fait référence au répertoire d'installation d'Arduino. La bibliothèque RobotIRremote a des définitions similaires à IRremote et provoque des erreurs. + + +## FAQ +Je ne travaille pas correctement en utilisant Neopixels (aka WS2811 / WS2812 / WS2812B) +Que vous utilisiez la librairie Adafruit Neopixel ou FastLED, les interruptions sont désactivées sur de nombreux processeurs bas de gamme comme les arduinos de base. À son tour, cela empêche le gestionnaire IR de s'exécuter quand il le faut. Il y a quelques solutions à ce processus, voir cette page de Marc MERLIN +[cette page de Marc MERLIN](http://marc.merlins.org/perso/arduino/post_2017-04-03_Arduino-328P-Uno-Teensy3_1-ESP8266-ESP32-IR-and-Neopixels.html) + + +## Conseils pris en charge + +- Teensy 1.0 / 1.0++ / 2.0 / 2++ / 3.0 / 3.1 / Teensy-LC; Crédits: @PaulStoffregen (Teensy Team) +- Sanguino +- ATmega8, 48, 88, 168, 328 +- ATmega8535, 16, 32, 164, 324, 644, 1284, +- ATmega64, 128 +- ATtiny 84 / 85 +- ESP32 (recevoir seulement) +- ESP8266 est basé sur un ancien code qui n'est pas très récent, mais cela fonctionne raisonnablement bien. Voir https://github.com/markszabo/IRremoteESP8266 +Sparkfun Pro Micro + + + + +Nous sommes ouverts aux suggestions d'ajout de support pour les nouveaux tableaux, cependant, nous vous recommandons fortement de contacter votre fournisseur et de fournir un soutien de leur côté. + + +## Spécifications matérielles + + +| Carte/CPU | Envoyer Pin | Compteurs | +|--------------------------------------------------------------------------|---------------------|-------------------| +| [ATtiny84](https://github.com/SpenceKonde/ATTinyCore) | **6** | **1** | +| [ATtiny85](https://github.com/SpenceKonde/ATTinyCore) | **1** | **TINY0** | +| [ATmega8](https://github.com/MCUdude/MiniCore) | **9** | **1** | +| Atmega32u4 | 5, 9, **13** | 1, 3, **4** | +| [ATmega48, ATmega88, ATmega168, ATmega328](https://github.com/MCUdude/MiniCore) | **3**, 9 | 1, **2** | +| [ATmega1284](https://github.com/MCUdude/MightyCore) | 13, 14, 6 | 1, **2**, 3 | +| [ATmega164, ATmega324, ATmega644](https://github.com/MCUdude/MightyCore) | 13, **14** | 1, **2** | +| [ATmega8535 ATmega16, ATmega32](https://github.com/MCUdude/MightyCore) | **13** | **1** | +| [ATmega64, ATmega128](https://github.com/MCUdude/MegaCore) | **13** | **1** | +| ATmega1280, ATmega2560 | 5, 6, **9**, 11, 46 | 1, **2**, 3, 4, 5 | +| [ESP32](http://esp32.net/) | N/A (insupporté) | **1** | +| [Sparkfun Pro Micro](https://www.sparkfun.com/products/12640) | 9, **5**, 5 | 1, **3**, 4_HS | +| [Teensy 1.0](https://www.pjrc.com/teensy/) | **17** | **1** | +| [Teensy 2.0](https://www.pjrc.com/teensy/) | 9, **10**, 14 | 1, 3, **4_HS** | +| [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/) | **1**, 16, 25 | 1, **2**, 3 | +| [Teensy 3.0 / 3.1](https://www.pjrc.com/teensy/) | **5** | **CMT** | +| [Teensy-LC](https://www.pjrc.com/teensy/) | **16** | **TPM1** | + + +## Patchs expérimentaux + +Voici les correctifs strictement pris en charge qui n'ont pas encore été intégrés. Si vous avez des questions, n'hésitez pas à demander ici. Si cela fonctionne, faites le nous savoir! + +[Arduino 101](https://github.com/z3t0/Arduino-IRremote/pull/481#issuecomment-311243146) + +Le tableau ci-dessus répertorie les temporisations actuellement supportées et les broches d'envoi correspondantes, beaucoup de ces broches supplémentaires sont ouvertes. + + +## Utilisation +- À faire TODO (Vérifier les exemples pour l'instant) + + +## Contribution +Si vous voulez contribuer à ce projet: +- Signaler les bogues et les erreurs +- Demander des améliorations +- Créer des problèmes et tirer des requêtes +- Parlez de cette bibliothèque à d'autres personnes +- Contribuer de nouveaux protocoles +Vérifiez ici [ici](Contributing.md) pour quelques guidelines + + +## Contact +Email: zetoslab@gmail.com +Please only email me if it is more appropriate than creating an Issue / PR. I **will** not respond to requests for adding support for particular boards, unless of course you are the creator of the board and would like to cooperate on the project. I will also **ignore** any emails asking me to tell you how to implement your ideas. However, if you have a private inquiry that you would only apply to you and you would prefer it to be via email, by all means. + +## Contributeurs +Check [here](Contributors.md) +@Lsuperman735 French translation + +## Copyright +Copyright 2009-2012 Ken Shirriff From 83e29c8473e9b5e05ace4973074ab842fdafc782 Mon Sep 17 00:00:00 2001 From: Phil <> Date: Fri, 28 Dec 2018 22:08:36 +0100 Subject: [PATCH 11/11] Moving ISR to IRAM on ESP32, changed switch statements to if/elseif to avoid PANIC/reboot in ESP32 --- IRremote.cpp | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/IRremote.cpp b/IRremote.cpp index e811cfc7b..6b164b050 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -124,7 +124,7 @@ int MATCH_SPACE (int measured_ticks, int desired_us) // Gap width is recorded; Ready is cleared; New logging starts // #ifdef IR_TIMER_USE_ESP32 -void IRTimer() +IRAM_ATTR void IRTimer() #else ISR (TIMER_INTR_NAME) #endif @@ -138,9 +138,9 @@ ISR (TIMER_INTR_NAME) irparams.timer++; // One more 50uS tick if (irparams.rawlen >= RAWBUF) irparams.rcvstate = STATE_OVERFLOW ; // Buffer overflow - switch(irparams.rcvstate) { - //...................................................................... - case STATE_IDLE: // In the middle of a gap + //Switch case would be much more appropriate. However, it creates a PANIC in ESP32 + //which reads as "Cache disabled but cached memory region accessed". -- Phil5555 + if (irparams.rcvstate==STATE_IDLE) { if (irdata == MARK) { if (irparams.timer < GAP_TICKS) { // Not big enough to be a gap. irparams.timer = 0; @@ -154,17 +154,13 @@ ISR (TIMER_INTR_NAME) irparams.rcvstate = STATE_MARK; } } - break; - //...................................................................... - case STATE_MARK: // Timing Mark + } else if (irparams.rcvstate==STATE_MARK) { if (irdata == SPACE) { // Mark ended; Record time irparams.rawbuf[irparams.rawlen++] = irparams.timer; irparams.timer = 0; irparams.rcvstate = STATE_SPACE; } - break; - //...................................................................... - case STATE_SPACE: // Timing Space + } else if (irparams.rcvstate==STATE_SPACE) { if (irdata == MARK) { // Space just ended; Record time irparams.rawbuf[irparams.rawlen++] = irparams.timer; irparams.timer = 0; @@ -177,16 +173,11 @@ ISR (TIMER_INTR_NAME) // Don't reset timer; keep counting Space width irparams.rcvstate = STATE_STOP; } - break; - //...................................................................... - case STATE_STOP: // Waiting; Measuring Gap + } else if (irparams.rcvstate==STATE_STOP) { if (irdata == MARK) irparams.timer = 0 ; // Reset gap timer - break; - //...................................................................... - case STATE_OVERFLOW: // Flag up a read overflow; Stop the State Machine + } else if (irparams.rcvstate==STATE_OVERFLOW) { irparams.overflow = true; irparams.rcvstate = STATE_STOP; - break; } // If requested, flash LED while receiving IR data