Fixed a bug which prevented AutoConnectCredential to function properly when offset is greater than 256 (8 bits)

pull/103/head
Joe 5 years ago
parent 4ab0f750ac
commit 3fc571b752
  1. 4
      src/AutoConnectCredential.cpp

@ -210,10 +210,10 @@ bool AutoConnectCredential::save(const struct station_config* config) {
}
// Seek insertion point, evaluate capacity to insert the new entry.
uint8_t eSize = strlen((const char*)config->ssid) + strlen((const char*)config->password) + sizeof(station_config::bssid) + 2;
uint16_t eSize = strlen((const char*)config->ssid) + strlen((const char*)config->password) + sizeof(station_config::bssid) + 2;
for (_dp = AC_HEADERSIZE; _dp < _containSize + AC_HEADERSIZE; _dp++) {
if (EEPROM.read(_dp) == 0xff) {
uint8_t fp = _dp;
uint16_t fp = _dp;
while (EEPROM.read(++_dp) == 0xff) {}
if (_dp - fp >= eSize) {
_dp = fp;

Loading…
Cancel
Save