Remove F() macro's (#2121)

This commit is contained in:
Jeroen88 2018-11-28 11:45:25 +01:00 committed by Me No Dev
parent fcd734a13c
commit cfe7e01158

View File

@ -93,31 +93,31 @@ String HTTPUpdate::getLastErrorString(void)
StreamString error; StreamString error;
Update.printError(error); Update.printError(error);
error.trim(); // remove line ending error.trim(); // remove line ending
return String(F("Update error: ")) + error; return String("Update error: ") + error;
} }
// error from http client // error from http client
if(_lastError > -100) { if(_lastError > -100) {
return String(F("HTTP error: ")) + HTTPClient::errorToString(_lastError); return String("HTTP error: ") + HTTPClient::errorToString(_lastError);
} }
switch(_lastError) { switch(_lastError) {
case HTTP_UE_TOO_LESS_SPACE: case HTTP_UE_TOO_LESS_SPACE:
return F("Not Enough space"); return "Not Enough space";
case HTTP_UE_SERVER_NOT_REPORT_SIZE: case HTTP_UE_SERVER_NOT_REPORT_SIZE:
return F("Server Did Not Report Size"); return "Server Did Not Report Size";
case HTTP_UE_SERVER_FILE_NOT_FOUND: case HTTP_UE_SERVER_FILE_NOT_FOUND:
return F("File Not Found (404)"); return "File Not Found (404)";
case HTTP_UE_SERVER_FORBIDDEN: case HTTP_UE_SERVER_FORBIDDEN:
return F("Forbidden (403)"); return "Forbidden (403)";
case HTTP_UE_SERVER_WRONG_HTTP_CODE: case HTTP_UE_SERVER_WRONG_HTTP_CODE:
return F("Wrong HTTP Code"); return "Wrong HTTP Code";
case HTTP_UE_SERVER_FAULTY_MD5: case HTTP_UE_SERVER_FAULTY_MD5:
return F("Wrong MD5"); return "Wrong MD5";
case HTTP_UE_BIN_VERIFY_HEADER_FAILED: case HTTP_UE_BIN_VERIFY_HEADER_FAILED:
return F("Verify Bin Header Failed"); return "Verify Bin Header Failed";
case HTTP_UE_BIN_FOR_WRONG_FLASH: case HTTP_UE_BIN_FOR_WRONG_FLASH:
return F("New Binary Does Not Fit Flash Size"); return "New Binary Does Not Fit Flash Size";
} }
return String(); return String();
@ -164,29 +164,29 @@ HTTPUpdateResult HTTPUpdate::handleUpdate(HTTPClient& http, const String& curren
// use HTTP/1.0 for update since the update handler not support any transfer Encoding // use HTTP/1.0 for update since the update handler not support any transfer Encoding
http.useHTTP10(true); http.useHTTP10(true);
http.setTimeout(_httpClientTimeout); http.setTimeout(_httpClientTimeout);
http.setUserAgent(F("ESP32-http-Update")); http.setUserAgent("ESP32-http-Update");
http.addHeader(F("Cache-Control"), F("no-cache")); http.addHeader("Cache-Control", "no-cache");
http.addHeader(F("x-ESP32-STA-MAC"), WiFi.macAddress()); http.addHeader("x-ESP32-STA-MAC", WiFi.macAddress());
http.addHeader(F("x-ESP32-AP-MAC"), WiFi.softAPmacAddress()); http.addHeader("x-ESP32-AP-MAC", WiFi.softAPmacAddress());
http.addHeader(F("x-ESP32-free-space"), String(ESP.getFreeSketchSpace())); http.addHeader("x-ESP32-free-space", String(ESP.getFreeSketchSpace()));
http.addHeader(F("x-ESP32-sketch-size"), String(ESP.getSketchSize())); http.addHeader("x-ESP32-sketch-size", String(ESP.getSketchSize()));
// To do http.addHeader(F("x-ESP32-sketch-md5"), String(ESP.getSketchMD5())); // To do http.addHeader("x-ESP32-sketch-md5", String(ESP.getSketchMD5()));
// Sketch MD5 is not supported by the core, but SHA256 is, so add a SHA256 instead // Sketch MD5 is not supported by the core, but SHA256 is, so add a SHA256 instead
String sketchSHA256 = getSketchSHA256(); String sketchSHA256 = getSketchSHA256();
if(sketchSHA256.length() != 0) { if(sketchSHA256.length() != 0) {
http.addHeader(F("x-ESP32-sketch-sha256"), sketchSHA256); http.addHeader("x-ESP32-sketch-sha256", sketchSHA256);
} }
http.addHeader(F("x-ESP32-chip-size"), String(ESP.getFlashChipSize())); http.addHeader("x-ESP32-chip-size", String(ESP.getFlashChipSize()));
http.addHeader(F("x-ESP32-sdk-version"), ESP.getSdkVersion()); http.addHeader("x-ESP32-sdk-version", ESP.getSdkVersion());
if(spiffs) { if(spiffs) {
http.addHeader(F("x-ESP32-mode"), F("spiffs")); http.addHeader("x-ESP32-mode", "spiffs");
} else { } else {
http.addHeader(F("x-ESP32-mode"), F("sketch")); http.addHeader("x-ESP32-mode", "sketch");
} }
if(currentVersion && currentVersion[0] != 0x00) { if(currentVersion && currentVersion[0] != 0x00) {
http.addHeader(F("x-ESP32-version"), currentVersion); http.addHeader("x-ESP32-version", currentVersion);
} }
const char * headerkeys[] = { "x-MD5" }; const char * headerkeys[] = { "x-MD5" };