mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge pull request #1662 from proddy/dev
small regression fixes from the last messy build I created (sorry!)
This commit is contained in:
@@ -26,14 +26,14 @@
|
|||||||
"@babel/core": "^7.24.0",
|
"@babel/core": "^7.24.0",
|
||||||
"@emotion/react": "^11.11.4",
|
"@emotion/react": "^11.11.4",
|
||||||
"@emotion/styled": "^11.11.0",
|
"@emotion/styled": "^11.11.0",
|
||||||
"@mui/icons-material": "^5.15.12",
|
"@mui/icons-material": "^5.15.13",
|
||||||
"@mui/material": "^5.15.12",
|
"@mui/material": "^5.15.13",
|
||||||
"@table-library/react-table-library": "4.1.7",
|
"@table-library/react-table-library": "4.1.7",
|
||||||
"@types/imagemin": "^8.0.5",
|
"@types/imagemin": "^8.0.5",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^20.11.26",
|
"@types/node": "^20.11.27",
|
||||||
"@types/react": "^18.2.65",
|
"@types/react": "^18.2.65",
|
||||||
"@types/react-dom": "^18.2.21",
|
"@types/react-dom": "^18.2.22",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"alova": "^2.17.1",
|
"alova": "^2.17.1",
|
||||||
"async-validator": "^4.2.5",
|
"async-validator": "^4.2.5",
|
||||||
|
|||||||
2193
interface/yarn.lock
2193
interface/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -32,8 +32,11 @@ class FSPersistence {
|
|||||||
settingsFile.close();
|
settingsFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we reach here we have not been successful in loading the config,
|
// If we reach here we have not been successful in loading the config,
|
||||||
// hard-coded emergency defaults are now applied.
|
// hard-coded emergency defaults are now applied.
|
||||||
|
#ifdef EMSESP_DEBUG
|
||||||
|
Serial.println("Applying defaults to " + String(_filePath));
|
||||||
|
#endif
|
||||||
applyDefaults();
|
applyDefaults();
|
||||||
writeToFS(); // added to make sure the initial file is created
|
writeToFS(); // added to make sure the initial file is created
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -369,7 +369,6 @@ void NetworkSettingsService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info)
|
|||||||
if (emsesp::EMSESP::system_.ethernet_connected()) {
|
if (emsesp::EMSESP::system_.ethernet_connected()) {
|
||||||
emsesp::EMSESP::logger().info("Ethernet connected (IPv6=%s, speed %d Mbps)", ETH.localIPv6().toString().c_str(), ETH.linkSpeed());
|
emsesp::EMSESP::logger().info("Ethernet connected (IPv6=%s, speed %d Mbps)", ETH.localIPv6().toString().c_str(), ETH.linkSpeed());
|
||||||
}
|
}
|
||||||
mDNS_start();
|
|
||||||
emsesp::EMSESP::system_.has_ipv6(true);
|
emsesp::EMSESP::system_.has_ipv6(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"@msgpack/msgpack": "^2.8.0",
|
"@msgpack/msgpack": "^2.8.0",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"express": "^4.18.3",
|
"express": "^4.18.3",
|
||||||
"itty-router": "^4.0.27",
|
"itty-router": "^4.2.0",
|
||||||
"multer": "^1.4.5-lts.1"
|
"multer": "^1.4.5-lts.1"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.1.1",
|
"packageManager": "yarn@4.1.1",
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ __metadata:
|
|||||||
"@types/multer": "npm:^1.4.11"
|
"@types/multer": "npm:^1.4.11"
|
||||||
compression: "npm:^1.7.4"
|
compression: "npm:^1.7.4"
|
||||||
express: "npm:^4.18.3"
|
express: "npm:^4.18.3"
|
||||||
itty-router: "npm:^4.0.27"
|
itty-router: "npm:^4.2.0"
|
||||||
multer: "npm:^1.4.5-lts.1"
|
multer: "npm:^1.4.5-lts.1"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
@@ -526,10 +526,10 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"itty-router@npm:^4.0.27":
|
"itty-router@npm:^4.2.0":
|
||||||
version: 4.0.27
|
version: 4.2.0
|
||||||
resolution: "itty-router@npm:4.0.27"
|
resolution: "itty-router@npm:4.2.0"
|
||||||
checksum: 10/ebb959388b1033f3d80ba2575c2d90fa649c1d5370d977879513cc46e8fd78159b7140d2a66853af6be98f7d740f8609a2c5aa7381506eaa1f1a46268fd2a95f
|
checksum: 10/39ee6c8b87f77de3918a9b3c1acaf2047626a69b954d7e1f5b9ab7ab9a2bf7e43c97b99ab86496aa9f5b139b024eebaf3b423f51fe000a8a0510901aeea10604
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ extra_scripts =
|
|||||||
|
|
||||||
[env]
|
[env]
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
monitor_filters = direct, esp32_exception_decoder
|
||||||
|
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
build_type = release
|
build_type = release
|
||||||
lib_ldf_mode = chain+
|
lib_ldf_mode = chain+
|
||||||
|
|||||||
@@ -238,7 +238,8 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
|
|||||||
networkSettings.password = password2.c_str();
|
networkSettings.password = password2.c_str();
|
||||||
return StateUpdateResult::CHANGED;
|
return StateUpdateResult::CHANGED;
|
||||||
});
|
});
|
||||||
shell.println("WiFi password updated");
|
shell.println("WiFi password updated. Reconnecting...");
|
||||||
|
to_app(shell).system_.wifi_reconnect();
|
||||||
} else {
|
} else {
|
||||||
shell.println("Passwords do not match");
|
shell.println("Passwords do not match");
|
||||||
}
|
}
|
||||||
@@ -271,7 +272,8 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
|
|||||||
networkSettings.ssid = arguments.front().c_str();
|
networkSettings.ssid = arguments.front().c_str();
|
||||||
return StateUpdateResult::CHANGED;
|
return StateUpdateResult::CHANGED;
|
||||||
});
|
});
|
||||||
shell.println("WiFi ssid updated");
|
shell.println("WiFi ssid updated. Reconnecting...");
|
||||||
|
to_app(shell).system_.wifi_reconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,8 @@ namespace emsesp {
|
|||||||
|
|
||||||
WebLogService::WebLogService(AsyncWebServer * server, SecurityManager * securityManager)
|
WebLogService::WebLogService(AsyncWebServer * server, SecurityManager * securityManager)
|
||||||
: events_(EVENT_SOURCE_LOG_PATH) {
|
: events_(EVENT_SOURCE_LOG_PATH) {
|
||||||
// set settings
|
// get & set settings
|
||||||
server->on(LOG_SETTINGS_PATH, [this](AsyncWebServerRequest * request, JsonVariant json) { setValues(request, json); });
|
server->on(LOG_SETTINGS_PATH, [this](AsyncWebServerRequest * request, JsonVariant json) { getSetValues(request, json); });
|
||||||
// get settings
|
|
||||||
server->on(LOG_SETTINGS_PATH, HTTP_GET, [this](AsyncWebServerRequest * request) { getValues(request); });
|
|
||||||
|
|
||||||
// for bring back the whole log - is a command, hence a POST
|
// for bring back the whole log - is a command, hence a POST
|
||||||
server->on(FETCH_LOG_PATH, HTTP_POST, [this](AsyncWebServerRequest * request) { fetchLog(request); });
|
server->on(FETCH_LOG_PATH, HTTP_POST, [this](AsyncWebServerRequest * request) { fetchLog(request); });
|
||||||
@@ -203,11 +201,20 @@ void WebLogService::fetchLog(AsyncWebServerRequest * request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sets the values like level after a POST
|
// sets the values like level after a POST
|
||||||
void WebLogService::setValues(AsyncWebServerRequest * request, JsonVariant json) {
|
void WebLogService::getSetValues(AsyncWebServerRequest * request, JsonVariant json) {
|
||||||
if (!json.is<JsonObject>()) {
|
if ((request->method() == HTTP_GET) || (!json.is<JsonObject>())) {
|
||||||
|
// GET - return the values
|
||||||
|
auto * response = new AsyncJsonResponse(false);
|
||||||
|
JsonObject root = response->getRoot();
|
||||||
|
root["level"] = log_level();
|
||||||
|
root["max_messages"] = maximum_log_messages();
|
||||||
|
root["compact"] = compact();
|
||||||
|
response->setLength();
|
||||||
|
request->send(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// POST - write the settings
|
||||||
auto && body = json.as<JsonObject>();
|
auto && body = json.as<JsonObject>();
|
||||||
|
|
||||||
uuid::log::Level level = body["level"];
|
uuid::log::Level level = body["level"];
|
||||||
@@ -222,15 +229,4 @@ void WebLogService::setValues(AsyncWebServerRequest * request, JsonVariant json)
|
|||||||
request->send(200); // OK
|
request->send(200); // OK
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the current value settings after a GET
|
|
||||||
void WebLogService::getValues(AsyncWebServerRequest * request) {
|
|
||||||
auto * response = new AsyncJsonResponse(false);
|
|
||||||
JsonObject root = response->getRoot();
|
|
||||||
root["level"] = log_level();
|
|
||||||
root["max_messages"] = maximum_log_messages();
|
|
||||||
root["compact"] = compact();
|
|
||||||
response->setLength();
|
|
||||||
request->send(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
@@ -60,12 +60,10 @@ class WebLogService : public uuid::log::Handler {
|
|||||||
|
|
||||||
void transmit(const QueuedLogMessage & message);
|
void transmit(const QueuedLogMessage & message);
|
||||||
void fetchLog(AsyncWebServerRequest * request);
|
void fetchLog(AsyncWebServerRequest * request);
|
||||||
void getValues(AsyncWebServerRequest * request);
|
void getSetValues(AsyncWebServerRequest * request, JsonVariant json);
|
||||||
|
|
||||||
char * messagetime(char * out, const uint64_t t, const size_t bufsize);
|
char * messagetime(char * out, const uint64_t t, const size_t bufsize);
|
||||||
|
|
||||||
void setValues(AsyncWebServerRequest * request, JsonVariant json);
|
|
||||||
|
|
||||||
uint64_t last_transmit_ = 0; // Last transmit time
|
uint64_t last_transmit_ = 0; // Last transmit time
|
||||||
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; // Maximum number of log messages to buffer before they are output
|
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; // Maximum number of log messages to buffer before they are output
|
||||||
size_t limit_log_messages_ = 1; // dynamic limit
|
size_t limit_log_messages_ = 1; // dynamic limit
|
||||||
|
|||||||
Reference in New Issue
Block a user