mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
ESP32-C3 and ESP32-S2, LED for C3-Mini
This commit is contained in:
@@ -49,12 +49,12 @@ void APSettingsService::startAP() {
|
||||
WiFi.softAPConfig(_state.localIP, _state.gatewayIP, _state.subnetMask);
|
||||
esp_wifi_set_bandwidth((wifi_interface_t)ESP_IF_WIFI_AP, WIFI_BW_HT20);
|
||||
WiFi.softAP(_state.ssid.c_str(), _state.password.c_str(), _state.channel, _state.ssidHidden, _state.maxClients);
|
||||
#ifdef ARDUINO_LOLIN_C3_MINI
|
||||
#ifdef BOARD_C3_MINI_V1
|
||||
WiFi.setTxPower(WIFI_POWER_8_5dBm); //https://www.wemos.cc/en/latest/c3/c3_mini.html#about-wifi
|
||||
#endif
|
||||
if (!_dnsServer) {
|
||||
IPAddress apIp = WiFi.softAPIP();
|
||||
emsesp::EMSESP::logger().info(F("Starting Access Point with captive portal on %s"), apIp.toString().c_str());
|
||||
emsesp::EMSESP::logger().info("Starting Access Point with captive portal on %s", apIp.toString().c_str());
|
||||
_dnsServer = new DNSServer;
|
||||
_dnsServer->start(DNS_PORT, "*", apIp);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ void APSettingsService::startAP() {
|
||||
|
||||
void APSettingsService::stopAP() {
|
||||
if (_dnsServer) {
|
||||
emsesp::EMSESP::logger().info(F("Stopping Access Point"));
|
||||
emsesp::EMSESP::logger().info("Stopping Access Point");
|
||||
_dnsServer->stop();
|
||||
delete _dnsServer;
|
||||
_dnsServer = nullptr;
|
||||
|
||||
@@ -75,7 +75,7 @@ void NetworkSettingsService::manageSTA() {
|
||||
});
|
||||
|
||||
WiFi.begin(_state.ssid.c_str(), _state.password.c_str()); // attempt to connect to the network
|
||||
#ifdef ARDUINO_LOLIN_C3_MINI
|
||||
#ifdef BOARD_C3_MINI_V1
|
||||
WiFi.setTxPower(WIFI_POWER_8_5dBm); //https://www.wemos.cc/en/latest/c3/c3_mini.html#about-wifi
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -13,14 +13,10 @@ SystemStatus::SystemStatus(AsyncWebServer * server, SecurityManager * securityMa
|
||||
void SystemStatus::systemStatus(AsyncWebServerRequest * request) {
|
||||
AsyncJsonResponse * response = new AsyncJsonResponse(false, MAX_ESP_STATUS_SIZE);
|
||||
JsonObject root = response->getRoot();
|
||||
root["emsesp_version"] = EMSESP_APP_VERSION;
|
||||
root["esp_platform"] = "ESP32";
|
||||
root["max_alloc_heap"] = ESP.getMaxAllocHeap() / 1024;
|
||||
#if defined(BOARD_HAS_PSRAM)
|
||||
root["psram_size"] = ESP.getPsramSize() / 1024;
|
||||
root["free_psram"] = ESP.getFreePsram() / 1024;
|
||||
#endif
|
||||
root["emsesp_version"] = EMSESP_APP_VERSION;
|
||||
root["esp_platform"] = EMSESP_PLATFORM;
|
||||
root["cpu_freq_mhz"] = ESP.getCpuFreqMHz();
|
||||
root["max_alloc_heap"] = ESP.getMaxAllocHeap() / 1024;
|
||||
root["free_heap"] = ESP.getFreeHeap() / 1024;
|
||||
root["sdk_version"] = ESP.getSdkVersion();
|
||||
root["flash_chip_size"] = ESP.getFlashChipSize() / 1024;
|
||||
@@ -31,6 +27,10 @@ void SystemStatus::systemStatus(AsyncWebServerRequest * request) {
|
||||
root["fs_used"] = FSused;
|
||||
root["fs_free"] = emsesp::EMSESP::system_.FStotal() - FSused;
|
||||
root["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
|
||||
if (emsesp::EMSESP::system_.PSram()) {
|
||||
root["psram_size"] = emsesp::EMSESP::system_.PSram();
|
||||
root["free_psram"] = ESP.getFreePsram() / 1024;
|
||||
}
|
||||
|
||||
response->setLength();
|
||||
request->send(response);
|
||||
|
||||
@@ -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