Skip to content

Commit 2a3ea88

Browse files
committed
Merge pull request RobTillaart#20 from ifreislich/master
_pageBlock loop never terminates due to incorrect variable in while()
2 parents 1c1de9b + 002a1ca commit 2a3ea88

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

libraries/I2C_EEPROM/I2C_eeprom.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ int I2C_eeprom::_pageBlock(const uint16_t memoryAddress, const uint8_t* buffer,
183183
uint16_t addr = memoryAddress;
184184
uint16_t len = length;
185185
int rv = 0;
186-
while (length > 0)
186+
while (len > 0)
187187
{
188188
uint8_t bytesUntilPageBoundary = this->_pageSize - addr % this->_pageSize;
189189
uint8_t cnt = min(len, bytesUntilPageBoundary);
@@ -262,4 +262,4 @@ void I2C_eeprom::waitEEReady()
262262
}
263263
}
264264

265-
// END OF FILE
265+
// END OF FILE

libraries/I2C_EEPROM/examples/I2C_eeprom_test/I2C_eeprom_test.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void setup()
3939
SERIAL_OUT.print("SIZE: ");
4040
SERIAL_OUT.print(size);
4141
SERIAL_OUT.println(" KB");
42-
} else if (size = 0)
42+
} else if (size == 0)
4343
{
4444
SERIAL_OUT.println("WARNING: Can't determine eeprom size");
4545
}

0 commit comments

Comments
 (0)