Closed piontec closed 2 years ago
HI Piontec,
i have merged your commit into the latest beta branch 2.3.1, but cannot get it run on my esp32.
[ 489][E][Wire.cpp:283] setClock(): Bus is in Slave Mode [ 490][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode [ 490][E][Wire.cpp:331] endTransmission(): Bus is in Slave Mode
Acccording to the FAQ pin remapping is not supported on esp32: https://github.com/olikraus/u8g2/blob/master/doc/faq.txt
Q: Why does the hardware I2C accept clock and data pins? The hardware I2C constructor looks like this: U8G2_
_HW_I2C(rotation, [reset [, clock, data]]) This means there are three options to use this constructor:
- U8G2_
_HW_I2C(rotation) - U8G2_
_HW_I2C(rotation, reset) - U8G2_
_HW_I2C(rotation, reset, clock, data) Hardware I2C usually is possible only with fixed pins. This means, the first or second form of the constructor must be used. As of today only the ESP8266 support pin remapping. In such a case, also the third form can be used.
Hey Tobias! This is weird. Just to make sure that it builds, I just cleaned & built and everything works. I think we might have different libs, I'm attaching my log below. As for "should it work", I think it should: AFAIR ESP32 has a configurable PIN multiplexer inside and it doesn't really care which pins you use as long as you're not over what the hardware can provide. Upstream project uses that constructor as well and they don't seem to make this possible for ESP8266 only.
My dependencies list:
Resolving esp32_usb dependencies...
Platform espressif32 @ 3.5.0 (required: espressif32 @ ^3)
├── framework-arduinoespressif32 @ 3.10006.210326 (required: platformio/framework-arduinoespressif32 @ ~3.10006.0)
├── tool-esptoolpy @ 1.30100.210531 (required: platformio/tool-esptoolpy @ ~1.30100.0)
├── tool-mkspiffs @ 2.230.0 (required: platformio/tool-mkspiffs @ ~2.230.0)
├── tool-openocd-esp32 @ 2.1000.20210721 (required: platformio/tool-openocd-esp32 @ ~2.1000.0)
└── toolchain-xtensa32 @ 2.50200.97 (required: platformio/toolchain-xtensa32 @ ~2.50200.0)
Libraries
├── Blynk @ 1.1.0 (required: blynkkk/Blynk @ ^1.0.1)
├── FastLED @ 3.5.0 (required: fastled/FastLED @ ^3.4.0)
├── HX711_ADC_fix @ 1.2.12+sha.08271b6 (required: git+https://github.com/medlor/HX711_ADC#1.2.12_pcp_v1)
├── MAX6675 library @ 1.1.0 (required: adafruit/MAX6675 library @ ^1.1.0)
│ └── LiquidCrystal @ 1.5.0 (required: LiquidCrystal)
├── PubSubClient @ 2.8.0 (required: knolleary/PubSubClient @ ^2.8)
├── RemoteDebug @ 3.0.5 (required: joaolopesf/RemoteDebug @ ^3.0.5)
├── U8g2 @ 2.33.4 (required: olikraus/U8g2 @ ^2.28.8)
├── VL53L0X @ 1.3.1 (required: pololu/VL53L0X @ ^1.3.0)
└── ZACwire for TSic fix @ 1.3.3+sha.bc02f3c (required: git+https://github.com/medlor/ZACwire-Library#improve_esp32_support)
All deps are updated in the latest beta (see Readme.md). Here are the ones I have:
Processing esp32_usb (platform: espressif32@^5; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (5.1.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 3.20004.220818 (2.0.4)
- tool-esptoolpy @ 1.30300.0 (3.3.0)
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
Converting rancilio-pid.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ strict
Found 43 compatible libraries
Scanning dependencies...
Dependency Graph
|-- RemoteDebug @ 3.0.5+sha.7fdf57b
| |-- WiFi @ 2.0.0
| |-- SPI @ 2.0.0
| |-- WiFiClientSecure @ 2.0.0
| | |-- WiFi @ 2.0.0
|-- ZACwire for TSic @ 2.0.0+sha.f195b43
|-- U8g2 @ 2.32.6
| |-- SPI @ 2.0.0
| |-- Wire @ 2.0.0
|-- Blynk @ 1.0.1
| |-- WiFi @ 2.0.0
|-- PubSubClient @ 2.8.0
|-- VL53L0X @ 1.3.0
| |-- Wire @ 2.0.0
|-- FastLED @ 3.5.0
| |-- SPI @ 2.0.0
|-- MAX6675 library @ 1.1.0
|-- HX711_ADC @ 1.2.12+sha.08271b6
|-- ArduinoOTA @ 2.0.0
| |-- Update @ 2.0.0
| |-- WiFi @ 2.0.0
| |-- ESPmDNS @ 2.0.0
| | |-- WiFi @ 2.0.0
|-- Wire @ 2.0.0
|-- SPI @ 2.0.0
|-- EEPROM @ 2.0.0
|-- Preferences @ 2.0.0
|-- WiFi @ 2.0.0
I seem to have slightly newer versions of some of the libs. With the dependencies below and the userConfig.h
attached, the 3.2.1-beta branch builds fine for me and runs on my esp32 without issues. Can you please try the same config and libs and build once again?
BTW, I had to disable water level sensor, as that doesn't compile for me anymore.
Dependencies:
Processing esp32_ota_LIVE (platform: espressif32@^5; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (5.1.1) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 3.20004.220825 (2.0.4)
- tool-esptoolpy @ 1.30300.0 (3.3.0)
- tool-mkfatfs @ 2.0.1
- tool-mklittlefs @ 1.203.210628 (2.3)
- tool-mkspiffs @ 2.230.0 (2.30)
- tool-openocd-esp32 @ 2.1100.20220706 (11.0)
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
Converting rancilio-pid.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ strict
Found 42 compatible libraries
Scanning dependencies...
Dependency Graph
|-- RemoteDebug @ 3.0.5+sha.1b94343
| |-- WiFi @ 2.0.0
| |-- SPI @ 2.0.0
| |-- WiFiClientSecure @ 2.0.0
| | |-- WiFi @ 2.0.0
|-- ZACwire for TSic @ 2.0.0+sha.54a72b8
|-- U8g2 @ 2.33.9
| |-- SPI @ 2.0.0
| |-- Wire @ 2.0.0
|-- Blynk @ 1.1.0
| |-- WiFi @ 2.0.0
|-- PubSubClient @ 2.8.0
|-- VL53L0X @ 1.3.1
| |-- Wire @ 2.0.0
|-- FastLED @ 3.5.0
| |-- SPI @ 2.0.0
|-- MAX6675 library @ 1.1.0
|-- HX711_ADC @ 1.2.12+sha.08271b6
|-- ArduinoOTA @ 2.0.0
| |-- Update @ 2.0.0
| |-- WiFi @ 2.0.0
| |-- ESPmDNS @ 2.0.0
| | |-- WiFi @ 2.0.0
|-- Wire @ 2.0.0
|-- SPI @ 2.0.0
|-- EEPROM @ 2.0.0
|-- Preferences @ 2.0.0
|-- WiFi @ 2.0.0
Building in release mode
PS. with #define WATER_LEVEL_SENSOR_ENABLE 1
I get the following error - do you as well?
Building in release mode
Compiling .pio/build/esp32_usb/src/PIDBias.cpp.o
Compiling .pio/build/esp32_usb/src/rancilio-pid.ino.cpp.o
/home/piontec/devel/bleeding-edge-ranciliopid/rancilio-pid/rancilio-pid.ino: In function 'void setup()':
/home/piontec/devel/bleeding-edge-ranciliopid/rancilio-pid/rancilio-pid.ino:2526:17: error: 'WATER_LEVEL_SENSOR_ADDR' was not declared in this scope
Wire1.begin(WATER_LEVEL_SENSOR_ADDR, WATER_LEVEL_SENSOR_SDA, WATER_LEVEL_SENSOR_SCL,
^~~~~~~~~~~~~~~~~~~~~~~
/home/piontec/devel/bleeding-edge-ranciliopid/rancilio-pid/rancilio-pid.ino:2526:17: note: suggested alternative: 'WATER_LEVEL_SENSOR_SDA'
Wire1.begin(WATER_LEVEL_SENSOR_ADDR, WATER_LEVEL_SENSOR_SDA, WATER_LEVEL_SENSOR_SCL,
^~~~~~~~~~~~~~~~~~~~~~~
WATER_LEVEL_SENSOR_SDA
*** [.pio/build/esp32_usb/src/rancilio-pid.ino.cpp.o] Error 1
Thanks. The latest U8G2 lib fixed that issue. I have adapted the version requirements accordingly and pushed a new commit (beta 3).
WATER_LEVEL_SENSOR_ADDR is not to be found in my code? Can you please fetcch the latest beta 3 and recheck if WATER_LEVEL_SENSOR_ENABLE=1 works? (for me it does)
Sorry, WATER_LEVEL_SENSOR_ADDR
is a leftover from my other experiments; I'll clean it up and test beta 3 today/tomorrow.
Sorry,
WATER_LEVEL_SENSOR_ADDR
is a leftover from my other experiments; I'll clean it up and test beta 3 today/tomorrow.
OK, WATER_LEVEL_SENSOR_ENABLE=1
works again and I see you merged the OLED I2C pin config already, we're good! :) Feel free to close this PR when OK for you :)
merged
By default, I2C bus 1 pins are configured for OLED, but this PR allows a user to move them elsewhere. I have mine OLED on arbitrary pins and everything works fine (and left ToF sensor on I2C bus 1).