lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.16k stars 206 forks source link

build failure against the latest arduino-esp32 #153

Closed estshorter closed 3 years ago

estshorter commented 3 years ago

From commit https://github.com/espressif/arduino-esp32/commit/f87107dedb6aff148622672376ae6a4aefdfd80c in arduino-esp32, TwoWire::readTransmission and TwoWire::writeTransmission have been removed and this causes build failure in LovyanGFX.

The following is a build log.

.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp: In function 'bool lgfx::v0::i2c::writeBytes(int, uint16_t, const uint8_t*, uint8_t)':
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp:379:27: error: 'class TwoWire' has no member named 'writeTransmission'; did you mean 'beginTransmission'?
       return 0 == twowire.writeTransmission(addr, const_cast<uint8_t*>(data), len);
                           ^~~~~~~~~~~~~~~~~
                           beginTransmission
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp: In function 'bool lgfx::v0::i2c::writeReadBytes(int, uint16_t, const uint8_t*, uint8_t, uint8_t*, uint8_t)':
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp:399:24: error: 'class TwoWire' has no member named 'writeTransmission'; did you mean 'beginTransmission'?
       if (0 != twowire.writeTransmission(addr, const_cast<uint8_t*>(writedata), writelen)) return false;
                        ^~~~~~~~~~~~~~~~~
                        beginTransmission
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp:400:28: error: 'class TwoWire' has no member named 'readTransmission'; did you mean 'endTransmission'?
       return (0 == twowire.readTransmission(addr, readdata, readlen));
                            ^~~~~~~~~~~~~~~~
                            endTransmission
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp: In function 'bool lgfx::v0::i2c::readRegister(int, uint16_t, uint8_t, uint8_t*, uint8_t)':
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp:423:24: error: 'class TwoWire' has no member named 'writeTransmission'; did you mean 'beginTransmission'?
       if (0 != twowire.writeTransmission(addr, tmp, 1)) return false;
                        ^~~~~~~~~~~~~~~~~
                        beginTransmission
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp:424:28: error: 'class TwoWire' has no member named 'readTransmission'; did you mean 'endTransmission'?
       return (0 == twowire.readTransmission(addr, data, len));
                            ^~~~~~~~~~~~~~~~
                            endTransmission
*** [.pio\build\m5paper\libc1d\LovyanGFX\lgfx\v0\platforms\esp32_common.cpp.o] Error 1
lovyan03 commented 3 years ago

@estshorter Thank you for reporting this problem ! I fixed it in the develop branch. Please check it out.

estshorter commented 3 years ago

Thank you for your quick response! But, it seems that I2C_ERROR_OK is not declared. Could you look into this again?

.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp: In function 'bool lgfx::v0::i2c::writeBytes(int, uint16_t, const uint8_t*, uint8_t)':
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp:382:14: error: 'I2C_ERROR_OK' was not declared in this scope
       return I2C_ERROR_OK == twowire.endTransmission();
              ^~~~~~~~~~~~
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp: In function 'bool lgfx::v0::i2c::writeReadBytes(int, uint16_t, const uint8_t*, uint8_t, uint8_t*, uint8_t)':
.pio/libdeps/m5paper/LovyanGFX/src/lgfx/v0/platforms/esp32_common.cpp:404:11: error: 'I2C_ERROR_OK' was not declared in this scope
       if (I2C_ERROR_OK != twowire.endTransmission(false))
           ^~~~~~~~~~~~
Compiling .pio\build\m5paper\libc1d\LovyanGFX\lgfx\v1\panel\Panel_Device.cpp.o
*** [.pio\build\m5paper\libc1d\LovyanGFX\lgfx\v0\platforms\esp32_common.cpp.o] Error 1
lovyan03 commented 3 years ago

@estshorter I'm sorry. I was missing the include. I was able to fix it, so please try again.

estshorter commented 3 years ago

Same error occured: I2C_ERROR_OK is not declared. It seems that the arduino-esp32 dev team also has removed i2c_err_t.

see: https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-i2c.h

https://github.com/espressif/arduino-esp32/blob/5b207104aaeccfde1557017ae30d51e31ae0a2bb/libraries/Wire/src/Wire.cpp#L248-L271

lovyan03 commented 3 years ago

@estshorter sorry again... I gave up on using the defined value and replaced it with 0.

estshorter commented 3 years ago

Thank you for the fix! Now I can build flawlessly!