Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esp32 Core version 3 #2144

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

BorisKofman
Copy link
Contributor

@BorisKofman BorisKofman commented Sep 6, 2024

Fixes #2039

@NiKiZe
Copy link
Collaborator

NiKiZe commented Sep 6, 2024

Duplicate of #2040 / #2039 ?

But please provide an explanation if this has any improvements over the other.

@BorisKofman BorisKofman closed this Sep 8, 2024
@BorisKofman BorisKofman deleted the Espressif-version-3 branch September 8, 2024 11:09
@BorisKofman BorisKofman restored the Espressif-version-3 branch September 8, 2024 11:19
@BorisKofman BorisKofman reopened this Sep 8, 2024
@BorisKofman
Copy link
Contributor Author

Feature:

Make IRremoteESP8266 compatible with IDF 5.x ESP32 Version 3

@BorisKofman
Copy link
Contributor Author

BorisKofman commented Sep 8, 2024

@NiKiZe code is running on ESP32 S3 With ESP32 Version 3.0.4 without any errors

I will try to test with ESP32-DEV & ESP32-C6 this weak

@NiKiZe
Copy link
Collaborator

NiKiZe commented Sep 8, 2024

As I understand it, so is #2040, we are grateful for your PR. Just want to limit duplication if there already is a fully working implementation.

@BorisKofman
Copy link
Contributor Author

Thanks @NiKiZe,
With #2040 I get error: timer is not enabled yet
I will try to test my Code with IDF 5.x and much Boards that I can
Currently tested "IDF 5.X" with S3.
Tomorrow will try with C6 and esp32-dev.
Then I will revert to ESP32 board version 2 to test again with S3 & DEV boards
Thanks!

src/IRrecv.cpp Outdated Show resolved Hide resolved
@Jason2866
Copy link

#2040 is working perfectly fine.

@Buddy-Matt
Copy link

Buddy-Matt commented Sep 16, 2024

@Jason2866 - #2040 isn't working on the M5Stack NanoC6 under Arduino IDE. Have commented on the relevant PR

I'm able to decode my remote using this pull request

@BorisKofman
Copy link
Contributor Author

@Jason2866 Tested with ESP32-C6 WROOM1, ESP32 WROVER and the code is working on Esp32 Core version 3.
Thanks!

src/IRrecv.cpp Outdated Show resolved Hide resolved
@BorisKofman
Copy link
Contributor Author

@NiKiZe @Jason2866 Thank you for feedback did the required changes
Thanks!

src/IRrecv.cpp Outdated Show resolved Hide resolved
src/IRrecv.cpp Outdated Show resolved Hide resolved
NiKiZe added a commit to NiKiZe/IRremoteESP8266 that referenced this pull request Sep 17, 2024
NiKiZe added a commit to NiKiZe/IRremoteESP8266 that referenced this pull request Sep 17, 2024
NiKiZe added a commit to NiKiZe/IRremoteESP8266 that referenced this pull request Sep 17, 2024
NiKiZe added a commit to NiKiZe/IRremoteESP8266 that referenced this pull request Sep 17, 2024
NiKiZe added a commit to NiKiZe/IRremoteESP8266 that referenced this pull request Sep 17, 2024
NiKiZe added a commit to NiKiZe/IRremoteESP8266 that referenced this pull request Sep 17, 2024
@NiKiZe
Copy link
Collaborator

NiKiZe commented Sep 17, 2024

I would suggest this: https://github.com/crankyoldgit/IRremoteESP8266/compare/master...NiKiZe:IRremoteESP8266:ForPr2144?expand=1

Or to see my suggestions on their own: 4ef02e5

I would like to improve on the #ifdef logic further and maybe rename the old HACK one as will, but maybe not in this PR.

NiKiZe added a commit to NiKiZe/IRremoteESP8266 that referenced this pull request Sep 23, 2024
@NiKiZe
Copy link
Collaborator

NiKiZe commented Sep 23, 2024

I have updated and pushed "reverts" of lines that don't need change. (mostly indentation and comments)
Modified the corev3 define to follow the pattern of others, and also tried a rename.

@crankyoldgit if you have the time I would especially like your input of how to deal with the comments on #elif and #endif for these cases.

@NiKiZe NiKiZe requested review from crankyoldgit and removed request for Jason2866 September 23, 2024 12:33
src/IRrecv.cpp Outdated
Comment on lines 59 to 62
#if ( defined(ESP_ARDUINO_VERSION) && \
(ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)) )
#define _ESP32_ARDUINOV3
#endif // Version > 3
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cruelest of nitpicks (so feel free to ignore :-)
_ESP32_ARDUINOV3 is a poor/technically incorrect name. It's really a "V3 and/or higher" definition looking at the code.

Perhaps flip the logic and use/create _ESP32_ARDUINO_PRE_V3 (obviously changing the use of it elsewhere in the code.

Or keep it as is, and simply rename to _ESP32_ARDUINO_POST_V3_0_0 ??

Either one is fine IMHO.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have _ESP32_IRRECV_TIMER_HACK
It would probably also be wise to consider V4 etc. as well.
So yes _ESP32_ARDUINO_CORE_V3PLUS and rename _ESP32_IRRECV_TIMER_HACK to _ESP32_ARDUINO_CORE_V2PLUS ?

But for now also consider rename being done if/when moving to separate file for this logic

src/IRrecv.cpp Outdated
Comment on lines 420 to 428
#elif defined(_ESP32_ARDUINOV3)
timerWrite(timer, 0); // Reset the timer
timerDetachInterrupt(timer);
timerEnd(timer);
#elif defined(ESP32)
timerAlarmDisable(timer);
timerDetachInterrupt(timer);
timerEnd(timer);
#endif // ESP32
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Try to avoid #elsif where possible

#endif  // ESP8266
#if defined(ESP32)
  // Check for ESP32 core version and handle timer functions differently
#if defined(_ESP32_ARDUINOV3)
  // Code for Arduino cores V3 and beyond
  timerWrite(timer, 0);  // Reset the timer
  timerDetachInterrupt(timer);
  timerEnd(timer);
#else  // _ESP32_ARDUINOV3
  // Code for Arduino cores before V3
  timerAlarmDisable(timer);
  timerDetachInterrupt(timer);
  timerEnd(timer);
#endif  // _ESP32_ARDUINOV3
#endif  // ESP32

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to why? it is becoming messy quite fast, and it is used elsewhere already.
I am however considering that we should split out this logic to a separate file or something to reduce the mess a bit.

src/IRrecv.cpp Outdated
timerWrite(timer, 0); // Reset the timer (no need for timerAlarmDisable)
#else // _ESP32_ARDUINOV3
timerAlarmDisable(timer);
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@endif  // _ESP32_ARDUINOV3

src/IRrecv.cpp Outdated
#if ( defined(ESP_ARDUINO_VERSION) && \
(ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)) )
#define _ESP32_ARDUINOV3
#endif // Version > 3
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#endif // ESP_ARDUINO_VERSION >= 3
Not > 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Support for esp32 Arduino 3.0.0
5 participants