Unverified Commit f33cc7e9 authored by Me No Dev's avatar Me No Dev Committed by GitHub

fix(ota): Allow password and partition change while idle (#9853)

Previously it was allowed only once before begin() was called
parent a8ce679d
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment