-
Notifications
You must be signed in to change notification settings - Fork 643
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
Unused variable warning on ESP8266 #381
Comments
@benoitm974 what is your take on this? I ask for your opinion as you contributed the code in question back then. |
I actually feel the "unused arguments" warning is too noisy and turn it off in my personal projects, but it's difficult to set custom compiler flags on Arduino IDE v1, and reducing the warning level turns off other useful warnings as well. In this case I think In any case, should the _i2cBus argument even exist outside of ESP32? Though removing the argument on some platforms can break code on a platform-dependent basis, which is even worse than leaving it in. Should the HW_I2C type only define I2C_TWO on ESP32, and otherwise be a one-value enum to prevent users from passing in I2C_TWO on ESP8266 which is silently ignored? Or is it better to leave I2C_TWO in? |
@marcelstoer Thanks for the head up and kind attention on this contribution. Since this code is executed at init only why don't we secure it by adding a test/assert in case someone is trying to use a second wire on another ESP32 platform with no 2nd Wire?
Benoit |
Describe the bug
On platforms other than ESP32, I get an unused variable warning in the
SSD1306Wire
constructor, since only theARDUINO_ARCH_ESP32
branch references the_i2cBus
parameter.To Reproduce
Steps to reproduce the behavior:
Sample code
Provide a MCVE below.
Expected behavior
No compiler warning. Perhaps mark the parameter
[[maybe_unused]]
(since C++17), or add a(void)_i2cBus
statement, either in the#if !defined(ARDUINO_ARCH_ESP32)
branch or globally?Screenshots
If applicable, add screenshots to help explain your problem.
esp8266-oled-ssd1306/src/SSD1306Wire.h
Lines 75 to 85 in f96fd6a
Versions (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: