Skip to content

Ensure OTA errors are sent in single UDP packet #787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/ArduinoOTA/src/ArduinoOTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void ArduinoOTAClass::_runUpdate() {
OTA_DEBUG.println("LittleFS Begin Error");
#endif
_udp_ota->append("ERR: ", 5);
_udp_ota->append("no filesystem", 13);
_udp_ota->append("No Filesystem", 13);
_udp_ota->send(ota_ip, _ota_udp_port);
delay(100);
_udp_ota->listen(IP_ADDR_ANY, _port);
Expand Down
31 changes: 19 additions & 12 deletions libraries/Updater/src/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,30 +412,37 @@ void UpdaterClass::_setError(int error) {
}

void UpdaterClass::printError(Print &out) {
out.printf_P(PSTR("ERROR[%u]: "), _error);
String err;
err = "ERROR[";
err += _error;
err += "]: ";
if (_error == UPDATE_ERROR_OK) {
out.println(F("No Error"));
err += "No Error";
} else if (_error == UPDATE_ERROR_WRITE) {
out.println(F("Flash Write Failed"));
err += "Flash Write Failed";
} else if (_error == UPDATE_ERROR_ERASE) {
out.println(F("Flash Erase Failed"));
err += "Flash Erase Failed";
} else if (_error == UPDATE_ERROR_READ) {
out.println(F("Flash Read Failed"));
err += "Flash Read Failed";
} else if (_error == UPDATE_ERROR_SPACE) {
out.println(F("Not Enough Space"));
err += "Not Enough Space";
} else if (_error == UPDATE_ERROR_SIZE) {
out.println(F("Bad Size Given"));
err += "Bad Size Given";
} else if (_error == UPDATE_ERROR_STREAM) {
out.println(F("Stream Read Timeout"));
err += "Stream Read Timeout";
} else if (_error == UPDATE_ERROR_NO_DATA) {
out.println(F("No data supplied"));
err += "No data supplied";
} else if (_error == UPDATE_ERROR_MD5) {
out.printf_P(PSTR("MD5 Failed: expected:%s, calculated:%s\n"), _target_md5.c_str(), _md5.toString().c_str());
err += "MD5 Failed: expected:";
err += _target_md5.c_str();
err += " calculated:";
err += _md5.toString();
} else if (_error == UPDATE_ERROR_SIGN) {
out.println(F("Signature verification failed"));
err += "Signature verification failed";
} else {
out.println(F("UNKNOWN"));
err += "UNKNOWN";
}
out.println(err.c_str());
}

UpdaterClass Update;