diff --git a/docs/source/Hardware/Device_I2CBusSelection.png b/docs/source/Hardware/Device_I2CBusSelection.png index bf281fe3c..6ca58ae7a 100644 Binary files a/docs/source/Hardware/Device_I2CBusSelection.png and b/docs/source/Hardware/Device_I2CBusSelection.png differ diff --git a/docs/source/Hardware/Device_I2CBusSelection3.png b/docs/source/Hardware/Device_I2CBusSelection3.png index c8b3a37c2..72fef73fb 100644 Binary files a/docs/source/Hardware/Device_I2CBusSelection3.png and b/docs/source/Hardware/Device_I2CBusSelection3.png differ diff --git a/docs/source/Hardware/Device_I2CBusSelectionReload.png b/docs/source/Hardware/Device_I2CBusSelectionReload.png index 5bae79a2f..9df0f42af 100644 Binary files a/docs/source/Hardware/Device_I2CBusSelectionReload.png and b/docs/source/Hardware/Device_I2CBusSelectionReload.png differ diff --git a/docs/source/Hardware/Hardware.rst b/docs/source/Hardware/Hardware.rst index 3a44ba7b3..8ae97b475 100644 --- a/docs/source/Hardware/Hardware.rst +++ b/docs/source/Hardware/Hardware.rst @@ -52,7 +52,7 @@ ESPEasy has a separate setting for Slow I2C devices, and per I2C device this slo - `I2C-bus.org - Clock Stretching `_ - `ESPeasy wiki - Basics: The I2C Bus `_ -This setting is only available for the first I2C Bus, as not many devices (should) need this set, and the devices that do need this should then be connected to I2C Bus 1. +This setting is only available for the first I2C Bus, as not many devices (should) need this set, and the devices that do need this should then be connected to I2C Bus 0. .. image:: Hardware_I2CBus.png diff --git a/docs/source/Hardware/Hardware_I2CBus.png b/docs/source/Hardware/Hardware_I2CBus.png index 615223104..8492da54d 100644 Binary files a/docs/source/Hardware/Hardware_I2CBus.png and b/docs/source/Hardware/Hardware_I2CBus.png differ diff --git a/docs/source/Hardware/Hardware_I2CBus2.png b/docs/source/Hardware/Hardware_I2CBus2.png index 72b7102f8..380928911 100644 Binary files a/docs/source/Hardware/Hardware_I2CBus2.png and b/docs/source/Hardware/Hardware_I2CBus2.png differ diff --git a/docs/source/Hardware/Hardware_PCFMCP_I2CSelector.png b/docs/source/Hardware/Hardware_PCFMCP_I2CSelector.png index 1db3ad564..ee18bcb5c 100644 Binary files a/docs/source/Hardware/Hardware_PCFMCP_I2CSelector.png and b/docs/source/Hardware/Hardware_PCFMCP_I2CSelector.png differ diff --git a/docs/source/Tools/images/Tools_I2Cscan_multipleBuses.png b/docs/source/Tools/images/Tools_I2Cscan_multipleBuses.png index 43bf831ec..17dc6fc56 100644 Binary files a/docs/source/Tools/images/Tools_I2Cscan_multipleBuses.png and b/docs/source/Tools/images/Tools_I2Cscan_multipleBuses.png differ diff --git a/docs/source/Tools/images/Tools_RTC_I2CSelector.png b/docs/source/Tools/images/Tools_RTC_I2CSelector.png index 1e088acb0..e908cba1b 100644 Binary files a/docs/source/Tools/images/Tools_RTC_I2CSelector.png and b/docs/source/Tools/images/Tools_RTC_I2CSelector.png differ diff --git a/docs/source/Tools/images/Tools_WD_I2CSelector.png b/docs/source/Tools/images/Tools_WD_I2CSelector.png index f5090f439..d7b5f6701 100644 Binary files a/docs/source/Tools/images/Tools_WD_I2CSelector.png and b/docs/source/Tools/images/Tools_WD_I2CSelector.png differ diff --git a/src/src/Commands/i2c.cpp b/src/src/Commands/i2c.cpp index 0a728f1f4..b7ca59f61 100644 --- a/src/src/Commands/i2c.cpp +++ b/src/src/Commands/i2c.cpp @@ -17,7 +17,7 @@ void i2c_scanI2Cbus(bool dbg, int8_t channel, uint8_t i2cBus) { #if FEATURE_I2CMULTIPLEXER if (-1 == channel) { - serialPrintln(concat(F("Standard I2C bus "), i2cBus + 1)); + serialPrintln(concat(F("Standard I2C bus "), i2cBus)); } else { serialPrintln(concat(F("Multiplexer channel "), channel)); } diff --git a/src/src/Helpers/Hardware_I2C.cpp b/src/src/Helpers/Hardware_I2C.cpp index 2285552e5..1f0603f37 100644 --- a/src/src/Helpers/Hardware_I2C.cpp +++ b/src/src/Helpers/Hardware_I2C.cpp @@ -35,7 +35,7 @@ void initI2C() { #if !FEATURE_I2C_MULTIPLE addLog(LOG_LEVEL_INFO, F("INIT : I2C Bus")); #else // if !FEATURE_I2C_MULTIPLE - addLog(LOG_LEVEL_INFO, concat(F("INIT : I2C Bus "), i2cBus + 1)); + addLog(LOG_LEVEL_INFO, concat(F("INIT : I2C Bus "), i2cBus)); #endif // if !FEATURE_I2C_MULTIPLE I2CSelectHighClockSpeed(i2cBus); // Set normal clock speed, on I2C Bus 1 (index 0) } diff --git a/src/src/Helpers/I2C_access.cpp b/src/src/Helpers/I2C_access.cpp index 8e456cdfe..1e2616603 100644 --- a/src/src/Helpers/I2C_access.cpp +++ b/src/src/Helpers/I2C_access.cpp @@ -440,31 +440,27 @@ void I2CInterfaceSelector(String label, if (i2cMaxBusCount > 1) { static uint8_t i2cBusCount = 0; - static String i2cBusList[3]; static int i2cBusNumbers[3]; - if (i2cBusList[0].isEmpty() || (i2cBusCount != i2cMaxBusCount)) { + if (i2cBusCount != i2cMaxBusCount) { i2cBusCount = 0; - i2cBusList[i2cBusCount] = '1'; i2cBusNumbers[i2cBusCount] = 0; ++i2cBusCount; if ((getI2CBusCount() > 1) && Settings.isI2CEnabled(1)) { - i2cBusList[i2cBusCount] = '2'; i2cBusNumbers[i2cBusCount] = 1; ++i2cBusCount; } # if FEATURE_I2C_INTERFACE_3 if ((getI2CBusCount() > 2) && Settings.isI2CEnabled(2)) { - i2cBusList[i2cBusCount] = '3'; i2cBusNumbers[i2cBusCount] = 2; ++i2cBusCount; } # endif // if FEATURE_I2C_INTERFACE_3 } FormSelectorOptions selector(i2cBusCount, - i2cBusList, i2cBusNumbers); + i2cBusNumbers); selector.default_index = 0; bool reloadOnChange = false; diff --git a/src/src/Helpers/StringGenerator_GPIO.cpp b/src/src/Helpers/StringGenerator_GPIO.cpp index 1487e8dd6..3fc8aee61 100644 --- a/src/src/Helpers/StringGenerator_GPIO.cpp +++ b/src/src/Helpers/StringGenerator_GPIO.cpp @@ -277,10 +277,10 @@ const __FlashStringHelper* getConflictingUse(int gpio, PinSelectPurpose purpose, if (Settings.getI2CSdaPin(i2cBus) == gpio) { #if FEATURE_I2C_MULTIPLE switch (i2cBus) { - case 0: return F("I2C SDA (bus 1)"); - case 1: return F("I2C SDA (bus 2)"); + case 0: return F("I2C SDA (bus 0)"); + case 1: return F("I2C SDA (bus 1)"); #if FEATURE_I2C_INTERFACE_3 - case 2: return F("I2C SDA (bus 3)"); + case 2: return F("I2C SDA (bus 2)"); #endif } #else @@ -290,10 +290,10 @@ const __FlashStringHelper* getConflictingUse(int gpio, PinSelectPurpose purpose, if (Settings.getI2CSclPin(i2cBus) == gpio) { #if FEATURE_I2C_MULTIPLE switch (i2cBus) { - case 0: return F("I2C SCL (bus 1)"); - case 1: return F("I2C SCL (bus 2)"); + case 0: return F("I2C SCL (bus 0)"); + case 1: return F("I2C SCL (bus 1)"); #if FEATURE_I2C_INTERFACE_3 - case 2: return F("I2C SCL (bus 3)"); + case 2: return F("I2C SCL (bus 2)"); #endif } #else diff --git a/src/src/WebServer/DevicesPage.cpp b/src/src/WebServer/DevicesPage.cpp index d26716bd5..759ce3b04 100644 --- a/src/src/WebServer/DevicesPage.cpp +++ b/src/src/WebServer/DevicesPage.cpp @@ -840,7 +840,7 @@ void format_I2C_port_description(taskIndex_t x) html_BR(); addHtml(F("I2C Bus")); addHtml(' '); - addHtmlInt(i2cBus + 1); + addHtmlInt(i2cBus); } #else const uint8_t i2cBus = 0; diff --git a/src/src/WebServer/HardwarePage.cpp b/src/src/WebServer/HardwarePage.cpp index 5952506bc..32e4d1a58 100644 --- a/src/src/WebServer/HardwarePage.cpp +++ b/src/src/WebServer/HardwarePage.cpp @@ -216,7 +216,7 @@ void handle_hardware() { #if !FEATURE_I2C_MULTIPLE addFormSubHeader(F("I2C Bus")); #else // if !FEATURE_I2C_MULTIPLE - addFormSubHeader(strformat(F("I2C Bus %u"), i2cBus + 1)); + addFormSubHeader(strformat(F("I2C Bus %u"), i2cBus)); #endif // if !FEATURE_I2C_MULTIPLE #if FEATURE_PLUGIN_PRIORITY if (isI2CPriorityTaskActive(i2cBus)) { @@ -247,7 +247,7 @@ void handle_hardware() { #if !FEATURE_I2C_MULTIPLE addFormSubHeader(F("I2C Multiplexer")); #else // if !FEATURE_I2C_MULTIPLE - addFormSubHeader(strformat(F("I2C Multiplexer %u"), i2cBus + 1)); + addFormSubHeader(strformat(F("I2C Multiplexer %u"), i2cBus)); #endif // if FEATURE_I2C_MULTIPLE // Select the type of multiplexer to use { @@ -492,7 +492,7 @@ bool isI2CPriorityTaskActive(uint8_t i2cBus) { void I2CShowSdaSclReadonly(int8_t i2c_sda, int8_t i2c_scl, uint8_t i2cBus) { int pinnr = -1; bool input, output, warning = false; - addFormNote(strformat(F("I2C (%d) GPIO pins can't be changed when an I2C Priority task is configured."), i2cBus + 1)); + addFormNote(strformat(F("I2C (%d) GPIO pins can't be changed when an I2C Priority task is configured."), i2cBus)); addRowLabel(formatGpioName_bidirectional(F("SDA"))); getGpioInfo(i2c_sda, pinnr, input, output, warning); addHtml(createGPIO_label(i2c_sda, pinnr, true, true, false)); diff --git a/src/src/WebServer/I2C_Scanner.cpp b/src/src/WebServer/I2C_Scanner.cpp index 7912adcad..d69613446 100644 --- a/src/src/WebServer/I2C_Scanner.cpp +++ b/src/src/WebServer/I2C_Scanner.cpp @@ -504,7 +504,7 @@ void handle_i2cscanner() { { html_table_class_multirow(); #if FEATURE_I2C_MULTIPLE - html_table_header(strformat(F("I2C Bus %d"), i2cBus + 1)); + html_table_header(strformat(F("I2C Bus %d"), i2cBus)); html_TR(); #endif // if FEATURE_I2C_MULTIPLE #if FEATURE_I2CMULTIPLEXER @@ -556,7 +556,7 @@ void handle_i2cscanner() { nDevices = 0; // Reset for next interface } else { html_TR_TD(); - addHtml(strformat(F("I2C pins not configured for bus %d"), i2cBus + 1)); + addHtml(strformat(F("I2C pins not configured for bus %d"), i2cBus)); } html_end_table(); I2CSelectHighClockSpeed(0); // By default the bus is in standard speed