Coder Social home page Coder Social logo

Comments (3)

marcelstoer avatar marcelstoer commented on June 10, 2024

@benoitm974 what is your take on this? I ask for your opinion as you contributed the code in question back then.

from esp8266-oled-ssd1306.

nyanpasu64 avatar nyanpasu64 commented on June 10, 2024

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 (void)_i2cBus isn't too ugly of a change to make.

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?

from esp8266-oled-ssd1306.

benoitm974 avatar benoitm974 commented on June 10, 2024

@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?

#if !defined(ARDUINO_ARCH_ESP32) //assert on trying to use a second wire on non-ESP32 platform. assert(_i2cBus!=I2C_ONE) this->_wire = &Wire; #else this->_wire = (_i2cBus==I2C_ONE) ? &Wire : &Wire1; #endif

Benoit

from esp8266-oled-ssd1306.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.