mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 08:28:12 +01:00
fix i2c scanning eror for Arduino (#2364)
This commit is contained in:
parent
0406e27100
commit
262d69308d
2 changed files with 4 additions and 5 deletions
|
@ -33,9 +33,8 @@ void ArduinoI2CBus::dump_config() {
|
||||||
if (this->scan_) {
|
if (this->scan_) {
|
||||||
ESP_LOGI(TAG, "Scanning i2c bus for active devices...");
|
ESP_LOGI(TAG, "Scanning i2c bus for active devices...");
|
||||||
uint8_t found = 0;
|
uint8_t found = 0;
|
||||||
for (uint8_t address = 1; address < 120; address++) {
|
for (uint8_t address = 8; address < 120; address++) {
|
||||||
auto err = readv(address, nullptr, 0);
|
auto err = writev(address, nullptr, 0);
|
||||||
|
|
||||||
if (err == ERROR_OK) {
|
if (err == ERROR_OK) {
|
||||||
ESP_LOGI(TAG, "Found i2c device at address 0x%02X", address);
|
ESP_LOGI(TAG, "Found i2c device at address 0x%02X", address);
|
||||||
found++;
|
found++;
|
||||||
|
|
|
@ -43,8 +43,8 @@ void IDFI2CBus::dump_config() {
|
||||||
if (this->scan_) {
|
if (this->scan_) {
|
||||||
ESP_LOGI(TAG, "Scanning i2c bus for active devices...");
|
ESP_LOGI(TAG, "Scanning i2c bus for active devices...");
|
||||||
uint8_t found = 0;
|
uint8_t found = 0;
|
||||||
for (uint8_t address = 1; address < 120; address++) {
|
for (uint8_t address = 8; address < 120; address++) {
|
||||||
auto err = readv(address, nullptr, 0);
|
auto err = writev(address, nullptr, 0);
|
||||||
|
|
||||||
if (err == ERROR_OK) {
|
if (err == ERROR_OK) {
|
||||||
ESP_LOGI(TAG, "Found i2c device at address 0x%02X", address);
|
ESP_LOGI(TAG, "Found i2c device at address 0x%02X", address);
|
||||||
|
|
Loading…
Reference in a new issue