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

[BUG] ESP32-C3: Fix reboot/crashes on ESP32-C3s when receiving. #1768

Merged
merged 5 commits into from Mar 8, 2022

Conversation

crankyoldgit
Copy link
Owner

@crankyoldgit crankyoldgit commented Mar 4, 2022

  • Seems an irrecv gpio of 14 was a poor default for the ESP-C3. Using it causes a reboot.
    • Using 10 for the input GPIO avoids the reboot.
  • Ensure when we allocate/use a system timer, that it actually succeeds.
    • ESP32-C3 only has two system timers (0 & 1). Try to automatically cater for that scenario.
    • Add extra debug messages
    • Add a run-time assert to check it succeeded.

Fixes #1751

Seems `14` was a poor default for the ESP-C3. Using it causes a reboot.
Using `10` for the input GPIO avoids the crash.

Fixes #1751
@crankyoldgit crankyoldgit added enhancement ESP32 ESP32 only issue Pending Confirmation Waiting for confirmation from user labels Mar 4, 2022
@crankyoldgit crankyoldgit requested a review from NiKiZe March 4, 2022 11:41
@crankyoldgit crankyoldgit self-assigned this Mar 4, 2022
@crankyoldgit crankyoldgit mentioned this pull request Mar 4, 2022
@NiKiZe
Copy link
Collaborator

NiKiZe commented Mar 4, 2022

Maybe use ifdef instead of ifndef to make it easier to read and also add any other special things in the future.

Per review feedback.
@crankyoldgit
Copy link
Owner Author

crankyoldgit commented Mar 5, 2022

Maybe use ifdef instead of ifndef to make it easier to read and also add any other special things in the future.

Would you believe that's what I originally had, then I changed it to #ifndef so it left the old/most common default first.

I've changed it to a plain #ifdef per suggestion.

Done.

Please take another look.

* Add debug messages & a runtime assert to ensure we correctly allocated a system timer in `IRrecv::enableIRIn()`.
* Limit the max number of the system timer to the appropriate size for the ESP32. ESP32-C3's only have two system timers (0-1), the rest have 4 (0-3).
* Done in such a way it should be correct for future ESP32 models.

Ref: https://docs.espressif.com/projects/arduino-esp32/en/latest/api/timer.html

Fixes #1751
Fixes a compile error on older/normal ESP32 Arduino framework/cores.

For #1751
@crankyoldgit crankyoldgit changed the title ESP32-C3: Use different default receive pin to avoid reboot. ESP32-C3: Fix reboot/crashes on ESP32-C3s when receiving. Mar 5, 2022
@crankyoldgit crankyoldgit changed the title ESP32-C3: Fix reboot/crashes on ESP32-C3s when receiving. [BUG] ESP32-C3: Fix reboot/crashes on ESP32-C3s when receiving. Mar 5, 2022
@crankyoldgit crankyoldgit requested a review from NiKiZe March 5, 2022 22:03
@crankyoldgit
Copy link
Owner Author

crankyoldgit commented Mar 5, 2022

@NiKiZe Please take another look. This PR has been significantly extended.

@crankyoldgit crankyoldgit merged commit d2fa206 into master Mar 8, 2022
@crankyoldgit crankyoldgit deleted the espc3 branch March 9, 2022 09:24
crankyoldgit added a commit that referenced this pull request Mar 14, 2022
_v2.8.2 (20220314)_

**[Bug Fixes]**
- ESP32-C3: Fix reboot/crashes on ESP32-C3s when receiving. (#1768 #1751)

**[Features]**
- HITACHI_AC296: Add `IRac` class support & tests. (#1776 #1758 #1757)
- Support for Hitachi RAS-70YHA3 (remote RAR-3U3) (#1758 #1757)
- LG: Add Swing Toggle support for Model `LG6711A20083V` (#1771 #1770)
- IRMQTTServer: add `MQTT_SERVER_AUTODETECT_ENABLE` via mqtt mDNS (#1769)
- Experimental basic support for Kelon 168 bit / 21 byte protocol. (#1747 #1745 #1744)
- MitsubishiAC: Tweak repeat gap timing. (#1760 #1759)
- Gree YAP0F8 (Detected as Kelvinator) vertical position set support (#1756)
- Make KELON (48 bit) protocol decoding stricter. (#1746 #1744)
- IRMQTTServer V1.6.1 (#1740 #1739 #1729)
- HITACHI_AC264: Add minimal detailed support. (#1735 #1729)
- LG2: Improve Light toggle msg handling. (#1738 #1737)
- MIDEA: Add support for Quiet, Clean & Freeze Protect controls. (#1734 #1733)
- Add basic support for HITACHI_AC264 264bit protocol. (#1730 #1729)
- ESP32-C3: Work around for some C3 specific compiler issues again. (#1732 #1695)

**[Misc]**
- MIDEA: Update supported devices (#1774 #1773 #1716)
- Update devices supported by ELECTRA_AC (#1766 #1765)
- Improve documentation for `encodePioneer()` (#1761 #1749)
- Update (un)supported DAIKIN128 devices. (#1752)
- Refactor `decodeCOOLIX()` code & add another test case. (#1750 #1748)
- Simplify code based on state_t being initialised by default. (#1736 #1699)
- Add comments to help Teknopoint users. (#1731 #1728)
- Fix library version string calculation. (#1727 #1725)
- Confirm we can reproduce `TurnOnFujitsuAC.ino` via IRac/IRMQTTServer. (#1726 #1701)
@crankyoldgit crankyoldgit mentioned this pull request Mar 14, 2022
crankyoldgit added a commit that referenced this pull request Mar 15, 2022
##_v2.8.2 (20220314)_

**[Bug Fixes]**
- ESP32-C3: Fix reboot/crashes on ESP32-C3s when receiving. (#1768 #1751)

**[Features]**
- HITACHI_AC296: Add `IRac` class support & tests. (#1776 #1758 #1757)
- Support for Hitachi RAS-70YHA3 (remote RAR-3U3) (#1758 #1757)
- LG: Add Swing Toggle support for Model `LG6711A20083V` (#1771 #1770)
- IRMQTTServer: add `MQTT_SERVER_AUTODETECT_ENABLE` via mqtt mDNS (#1769)
- Experimental basic support for Kelon 168 bit / 21 byte protocol. (#1747 #1745 #1744)
- MitsubishiAC: Tweak repeat gap timing. (#1760 #1759)
- Gree YAP0F8 (Detected as Kelvinator) vertical position set support (#1756)
- Make KELON (48 bit) protocol decoding stricter. (#1746 #1744)
- IRMQTTServer V1.6.1 (#1740 #1739 #1729)
- HITACHI_AC264: Add minimal detailed support. (#1735 #1729)
- LG2: Improve Light toggle msg handling. (#1738 #1737)
- MIDEA: Add support for Quiet, Clean & Freeze Protect controls. (#1734 #1733)
- Add basic support for HITACHI_AC264 264bit protocol. (#1730 #1729)
- ESP32-C3: Work around for some C3 specific compiler issues again. (#1732 #1695)

**[Misc]**
- MIDEA: Update supported devices (#1774 #1773 #1716)
- Update devices supported by ELECTRA_AC (#1766 #1765)
- Improve documentation for `encodePioneer()` (#1761 #1749)
- Update (un)supported DAIKIN128 devices. (#1752)
- Refactor `decodeCOOLIX()` code & add another test case. (#1750 #1748)
- Simplify code based on state_t being initialised by default. (#1736 #1699)
- Add comments to help Teknopoint users. (#1731 #1728)
- Fix library version string calculation. (#1727 #1725)
- Confirm we can reproduce `TurnOnFujitsuAC.ino` via IRac/IRMQTTServer. (#1726 #1701)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug enhancement ESP32 ESP32 only issue Pending Confirmation Waiting for confirmation from user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

esp32c3
2 participants