mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
ESP32-C3 and ESP32-S2, LED for C3-Mini
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user