mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
#632 - still experimental
This commit is contained in:
@@ -21,7 +21,7 @@ void APSettingsService::reconfigureAP() {
|
||||
|
||||
void APSettingsService::loop() {
|
||||
unsigned long currentMillis = uuid::get_uptime();
|
||||
unsigned long manageElapsed = (unsigned long)(currentMillis - _lastManaged);
|
||||
unsigned long manageElapsed = (uint32_t)(currentMillis - _lastManaged);
|
||||
if (manageElapsed >= MANAGE_NETWORK_DELAY) {
|
||||
_lastManaged = currentMillis;
|
||||
manageAP();
|
||||
|
||||
@@ -7,7 +7,7 @@ class ESPUtils {
|
||||
public:
|
||||
static String defaultDeviceValue(String prefix = "") {
|
||||
#ifdef ESP32
|
||||
return prefix + String((unsigned long)ESP.getEfuseMac(), HEX);
|
||||
return prefix + String((uint32_t)ESP.getEfuseMac(), HEX);
|
||||
#elif defined(ESP8266)
|
||||
return prefix + String(ESP.getChipId(), HEX);
|
||||
#endif
|
||||
|
||||
@@ -61,7 +61,7 @@ void MqttSettingsService::begin() {
|
||||
}
|
||||
|
||||
void MqttSettingsService::loop() {
|
||||
if (_reconfigureMqtt || (_disconnectedAt && (unsigned long)(uuid::get_uptime() - _disconnectedAt) >= MQTT_RECONNECTION_DELAY)) {
|
||||
if (_reconfigureMqtt || (_disconnectedAt && (uint32_t)(uuid::get_uptime() - _disconnectedAt) >= MQTT_RECONNECTION_DELAY)) {
|
||||
// reconfigure MQTT client
|
||||
configureMqtt();
|
||||
|
||||
|
||||
@@ -70,7 +70,11 @@ void NTPSettingsService::configureTime(AsyncWebServerRequest * request, JsonVari
|
||||
if (!sntp_enabled() && json.is<JsonObject>()) {
|
||||
String timeUtc = json["time_utc"];
|
||||
struct tm tm = {0};
|
||||
char * s = strptime(timeUtc.c_str(), "%Y-%m-%dT%H:%M:%SZ", &tm);
|
||||
|
||||
// TODO fix strptime, which is not included in xtensa
|
||||
// char * s = strptime(timeUtc.c_str(), "%Y-%m-%dT%H:%M:%SZ", &tm);
|
||||
|
||||
char * s = nullptr;
|
||||
if (s != nullptr) {
|
||||
time_t time = mktime(&tm);
|
||||
struct timeval now = {.tv_sec = time};
|
||||
@@ -80,6 +84,7 @@ void NTPSettingsService::configureTime(AsyncWebServerRequest * request, JsonVari
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AsyncWebServerResponse * response = request->beginResponse(400);
|
||||
request->send(response);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ SystemStatus::SystemStatus(AsyncWebServer * server, SecurityManager * securityMa
|
||||
}
|
||||
|
||||
void SystemStatus::systemStatus(AsyncWebServerRequest * request) {
|
||||
uint8_t free_mem_percent = emsesp::System::free_mem(); // added by proddy
|
||||
|
||||
AsyncJsonResponse * response = new AsyncJsonResponse(false, MAX_ESP_STATUS_SIZE);
|
||||
JsonObject root = response->getRoot();
|
||||
#ifdef ESP32
|
||||
@@ -40,8 +38,7 @@ void SystemStatus::systemStatus(AsyncWebServerRequest * request) {
|
||||
root["fs_used"] = fs_info.usedBytes;
|
||||
#endif
|
||||
|
||||
root["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3); // proddy added
|
||||
root["free_mem"] = free_mem_percent; // proddy added
|
||||
root["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3); // proddy added
|
||||
|
||||
response->setLength();
|
||||
request->send(response);
|
||||
|
||||
@@ -56,7 +56,7 @@ void WiFiSettingsService::reconfigureWiFiConnection() {
|
||||
|
||||
void WiFiSettingsService::loop() {
|
||||
unsigned long currentMillis = millis();
|
||||
if (!_lastConnectionAttempt || (unsigned long)(currentMillis - _lastConnectionAttempt) >= WIFI_RECONNECTION_DELAY) {
|
||||
if (!_lastConnectionAttempt || (uint32_t)(currentMillis - _lastConnectionAttempt) >= WIFI_RECONNECTION_DELAY) {
|
||||
_lastConnectionAttempt = currentMillis;
|
||||
manageSTA();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user