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

io_pin_remap fixes for the Arduino Nano ESP32 #8489

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

pillo79
Copy link
Contributor

@pillo79 pillo79 commented Aug 4, 2023

@me-no-dev

Description of Change

  • dec6db6 fixes a minor issue: the pin-remapping macros force tone() to have 3 parameters, while the Arduino API dictates the third is optional.

  • 9b402f0 adds an error and warnings to detect issues with bad or non-standard #define combinations for the variants with defined custom pin-mapping. No noticeable effects on a normal core build.

Tests scenarios

Applicable to Arduino Nano ESP32 board only (other variants not using custom pin numbering are unaffected).
Tested that now:

  • Removing the -DARDUINO_CORE_BUILD lines in platform.txt stops the build with an error
  • Removing the -DBOARD_HAS_PIN_REMAP macro in boards.txt triggers a warning
  • Defining the -DBOARD_USES_HW_GPIO_PIN_NUMBERS macro at compile time triggers a warning

Related links

The changes have been discussed in the PlatformIO repo here and is related to PR #8488 (fixing the original issue).

Since tone() can have either 2 or 3 parameters, pass any argument after the
first to the actual function implementation.
Building with BOARD_HAS_PIN_REMAP but without setting ARDUINO_CORE_BUILD
on core files is absolutely forbidden, as this would lead to multiple
pin remappings being silently applied on the same numbers.

Also advise the user when, on a board that has a custom pin mapping,
- the core is being built without pin mapping support, or
- the user explictly asked to use GPIO pin numbers.
@me-no-dev me-no-dev merged commit 369e974 into espressif:release/v2.x Aug 4, 2023
34 checks passed
@pillo79 pillo79 deleted the io_pin_remap_fixes branch August 4, 2023 13:56
me-no-dev pushed a commit that referenced this pull request Sep 4, 2023
* io_pin_remap: fix tone() function mapping declaration

Since tone() can have either 2 or 3 parameters, pass any argument after the
first to the actual function implementation.

* io_pin_remap: add sanity checks to the core build

Building with BOARD_HAS_PIN_REMAP but without setting ARDUINO_CORE_BUILD
on core files is absolutely forbidden, as this would lead to multiple
pin remappings being silently applied on the same numbers.

Also advise the user when, on a board that has a custom pin mapping,
- the core is being built without pin mapping support, or
- the user explictly asked to use GPIO pin numbers.
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.

2 participants