From 5ca4d2f721bc262b37c6478e603a692c478ca084 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Mon, 9 Sep 2019 11:18:37 +0200 Subject: [PATCH] TTGO T-Beam v10 PMU init bugfix --- src/i2cscan.cpp | 7 +------ src/main.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/i2cscan.cpp b/src/i2cscan.cpp index e3deb9f0..7ce0f6b0 100644 --- a/src/i2cscan.cpp +++ b/src/i2cscan.cpp @@ -14,12 +14,7 @@ int i2c_scan(void) { for (addr = 8; addr <= 119; addr++) { -// scan i2c bus with no more to 100KHz -#ifdef HAS_DISPLAY - Wire.begin(MY_OLED_SDA, MY_OLED_SCL, 100000); -#else - Wire.begin(SDA, SCL, 100000); -#endif + // scan i2c bus with no more to 100KHz Wire.beginTransmission(addr); Wire.write(addr); i2c_ret = Wire.endTransmission(); diff --git a/src/main.cpp b/src/main.cpp index 2c5fc606..2937f793 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -169,6 +169,13 @@ void setup() { ESP_LOGI(TAG, "TinyGPS+ version %s", TinyGPSPlus::libraryVersion()); #endif +// open i2c bus +#ifdef HAS_DISPLAY + Wire.begin(MY_OLED_SDA, MY_OLED_SCL, 100000); +#else + Wire.begin(SDA, SCL, 100000); +#endif + // setup power on boards with power management logic #ifdef EXT_POWER_SW pinMode(EXT_POWER_SW, OUTPUT); @@ -180,6 +187,7 @@ void setup() { strcat_P(features, " PMU"); #endif + // scan i2c bus for devices i2c_scan(); #endif // verbose