Fix broken I2C priority

Fix broken I2C priority regression from v12.3.1.3 (#17810)
This commit is contained in:
Theo Arends 2023-01-29 13:59:09 +01:00
parent 91559ec883
commit 664b60332a
2 changed files with 14 additions and 14 deletions

View File

@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
- ADE7953 when calibration data for second channel is used regression from v12.2.0.2
- Shelly Pro 1/2 relay click at restart regression from v12.3.1.4
- Zigbee extend plug-in modifiers to 16 bits
- Broken I2C priority regression from v12.3.1.3 (#17810)
### Removed

View File

@ -267,30 +267,29 @@ void I2cScan(uint8_t bus = 0) {
}
}
void I2cResetActive(uint32_t addr, uint32_t count = 1, uint8_t bus = 0) {
void I2cResetActive(uint32_t addr, uint8_t bus = 0) {
#ifdef ESP8266
bus = 0;
#endif
addr &= 0x7F; // Max I2C address is 127
count &= 0x7F; // Max 4 x 32 bits available
while (count-- && (addr < 128)) {
i2c_active[bus][addr / 32] &= ~(1 << (addr % 32));
addr++;
}
// AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[bus][0], i2c_active[bus][1], i2c_active[bus][2], i2c_active[bus][3]);
// AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: I2cResetActive bus0 %08X-%08X-%08X-%08X, bus1 %08X-%08X-%08X-%08X"),
// i2c_active[0][0], i2c_active[0][1], i2c_active[0][2], i2c_active[0][3],
// i2c_active[1][0], i2c_active[1][1], i2c_active[1][2], i2c_active[1][3]);
}
void I2cSetActive(uint32_t addr, uint32_t count = 1, uint8_t bus = 0) {
void I2cSetActive(uint32_t addr, uint8_t bus = 0) {
#ifdef ESP8266
bus = 0;
#endif
addr &= 0x7F; // Max I2C address is 127
count &= 0x7F; // Max 4 x 32 bits available
while (count-- && (addr < 128)) {
i2c_active[bus][addr / 32] |= (1 << (addr % 32));
addr++;
}
// AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[bus][0], i2c_active[bus][1], i2c_active[bus][2], i2c_active[bus][3]);
// AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: I2cSetActive addr %02X, bus%d, bus0 %08X-%08X-%08X-%08X, bus1 %08X-%08X-%08X-%08X"),
// addr, bus,
// i2c_active[0][0], i2c_active[0][1], i2c_active[0][2], i2c_active[0][3],
// i2c_active[1][0], i2c_active[1][1], i2c_active[1][2], i2c_active[1][3]);
}
void I2cSetActiveFound(uint32_t addr, const char *types, uint8_t bus = 0) {