Skip to content

Commit

Permalink
fix(ota): Allow password and partition change while idle
Browse files Browse the repository at this point in the history
Previously it was allowed only once before begin() was called
  • Loading branch information
me-no-dev committed Jun 13, 2024
1 parent 1d895e5 commit 9ade160
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libraries/ArduinoOTA/src/ArduinoOTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,28 @@ String ArduinoOTAClass::getHostname() {
}

ArduinoOTAClass &ArduinoOTAClass::setPassword(const char *password) {
if (!_initialized && !_password.length() && password) {
if (_state == OTA_IDLE && password) {
MD5Builder passmd5;
passmd5.begin();
passmd5.add(password);
passmd5.calculate();
_password.clear();
_password = passmd5.toString();
}
return *this;
}

ArduinoOTAClass &ArduinoOTAClass::setPasswordHash(const char *password) {
if (!_initialized && !_password.length() && password) {
if (_state == OTA_IDLE && password) {
_password.clear();
_password = password;
}
return *this;
}

ArduinoOTAClass &ArduinoOTAClass::setPartitionLabel(const char *partition_label) {
if (!_initialized && !_partition_label.length() && partition_label) {
if (_state == OTA_IDLE && partition_label) {
_partition_label.clear();
_partition_label = partition_label;
}
return *this;
Expand Down

0 comments on commit 9ade160

Please sign in to comment.