Skip to content

If the I2C-Bus is not available for any reason 32 Bytes of free heap gets consumed each cycle.. #104

Open
@eXtr3me26

Description

@eXtr3me26

This method needs to be changed:

bool Adafruit_MCP23XXX::begin_I2C(uint8_t i2c_addr, TwoWire *wire) {
i2c_dev = new Adafruit_I2CDevice(i2c_addr, wire);
return i2c_dev->begin();
}

into:

bool Adafruit_MCP23XXX::begin_I2C(uint8_t i2c_addr, TwoWire *wire) {
if (i2c_dev != nullptr) {
delete i2c_dev;
i2c_dev = nullptr;
}
i2c_dev = new Adafruit_I2CDevice(i2c_addr, wire);
return i2c_dev->begin();
}

Also, this seems to be a general problem of this library.. only a successful run seems to avoid free heap problems..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions