ESP32-C3 and ESP32-S2, LED for C3-Mini

This commit is contained in:
MichaelDvP
2022-10-10 14:13:43 +02:00
parent b6d8e55b00
commit 6fd3e567cd
28 changed files with 4891 additions and 116 deletions

View File

@@ -43,6 +43,26 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri
}
if (is_firmware) {
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
bool isC3 = (fname.find("C3") != std::string::npos);
bool isS2 = (fname.find("S2") != std::string::npos);
if (isC3 || isS2) {
handleError(request, 503); // service unavailable
return;
}
#elif CONFIG_IDF_TARGET_ESP32S2
bool isS2 = (fname.find("S2") != std::string::npos);
if (!isS2) {
handleError(request, 503); // service unavailable
return;
}
#elif CONFIG_IDF_TARGET_ESP32C3
bool isC3 = (fname.find("C3") != std::string::npos);
if (!isC3) {
handleError(request, 503); // service unavailable
return;
}
#endif
// it's firmware - initialize the ArduinoOTA updater
if (Update.begin(fsize)) {
request->onDisconnect(UploadFileService::handleEarlyDisconnect); // success, let's make sure we end the update if the client hangs up
@@ -50,7 +70,7 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri
#if defined(EMSESP_USE_SERIAL)
Update.printError(Serial);
#endif
handleError(request, 500); // failed to begin, send an error response
handleError(request, 507); // failed to begin, send an error response Insufficient Storage
}
} else {
// its a normal file, open a new temp file to write the contents too