updated comments

This commit is contained in:
Proddy
2023-07-15 11:34:38 +02:00
parent 37724814be
commit 7bb6427ec9
15 changed files with 20 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
#include <APSettingsService.h> #include <APSettingsService.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
APSettingsService::APSettingsService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager) APSettingsService::APSettingsService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager)
: _httpEndpoint(APSettings::read, APSettings::update, this, server, AP_SETTINGS_SERVICE_PATH, securityManager) : _httpEndpoint(APSettings::read, APSettings::update, this, server, AP_SETTINGS_SERVICE_PATH, securityManager)

View File

@@ -18,10 +18,7 @@ void FactoryResetService::handleRequest(AsyncWebServerRequest * request) {
* Delete function assumes that all files are stored flat, within the config directory. * Delete function assumes that all files are stored flat, within the config directory.
*/ */
void FactoryResetService::factoryReset() { void FactoryResetService::factoryReset() {
/* // TODO Could be replaced with fs.rmdir(FS_CONFIG_DIRECTORY) in IDF 4.2
* Based on LittleFS. Modified by proddy
* Could be replaced with fs.rmdir(FS_CONFIG_DIRECTORY) in IDF 4.2
*/
File root = fs->open(FS_CONFIG_DIRECTORY); File root = fs->open(FS_CONFIG_DIRECTORY);
File file; File file;
while (file = root.openNextFile()) { while (file = root.openNextFile()) {

View File

@@ -1,7 +1,7 @@
#include <FeaturesService.h> #include <FeaturesService.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
using namespace std::placeholders; // for `_1` etc using namespace std::placeholders; // for `_1` etc
FeaturesService::FeaturesService(AsyncWebServer * server) { FeaturesService::FeaturesService(AsyncWebServer * server) {
server->on(FEATURES_SERVICE_PATH, HTTP_GET, std::bind(&FeaturesService::features, this, _1)); server->on(FEATURES_SERVICE_PATH, HTTP_GET, std::bind(&FeaturesService::features, this, _1));

View File

@@ -115,7 +115,7 @@ class HttpPostEndpoint {
response->setLength(); response->setLength();
if (outcome == StateUpdateResult::CHANGED_RESTART) { if (outcome == StateUpdateResult::CHANGED_RESTART) {
response->setCode(205); // added by proddy, reboot required response->setCode(205); // reboot required
} }
request->send(response); request->send(response);
} }

View File

@@ -1,6 +1,6 @@
#include <MqttSettingsService.h> #include <MqttSettingsService.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
using namespace std::placeholders; // for `_1` etc using namespace std::placeholders; // for `_1` etc
@@ -144,7 +144,6 @@ void MqttSettingsService::onConfigUpdated() {
_reconfigureMqtt = true; _reconfigureMqtt = true;
_disconnectedAt = 0; _disconnectedAt = 0;
// added by proddy
startClient(); startClient();
emsesp::EMSESP::mqtt_.start(); // reload EMS-ESP MQTT settings emsesp::EMSESP::mqtt_.start(); // reload EMS-ESP MQTT settings
} }
@@ -231,7 +230,6 @@ void MqttSettings::read(MqttSettings & settings, JsonObject & root) {
root["clean_session"] = settings.cleanSession; root["clean_session"] = settings.cleanSession;
root["entity_format"] = settings.entity_format; root["entity_format"] = settings.entity_format;
// added by proddy for EMS-ESP
root["publish_time_boiler"] = settings.publish_time_boiler; root["publish_time_boiler"] = settings.publish_time_boiler;
root["publish_time_thermostat"] = settings.publish_time_thermostat; root["publish_time_thermostat"] = settings.publish_time_thermostat;
root["publish_time_solar"] = settings.publish_time_solar; root["publish_time_solar"] = settings.publish_time_solar;

View File

@@ -76,7 +76,7 @@ class MqttSettings {
uint16_t keepAlive; uint16_t keepAlive;
bool cleanSession; bool cleanSession;
// proddy EMS-ESP specific // EMS-ESP specific
String base; String base;
uint16_t publish_time_boiler; uint16_t publish_time_boiler;
uint16_t publish_time_thermostat; uint16_t publish_time_thermostat;

View File

@@ -1,6 +1,6 @@
#include <MqttStatus.h> #include <MqttStatus.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
using namespace std::placeholders; // for `_1` etc using namespace std::placeholders; // for `_1` etc
@@ -20,9 +20,9 @@ void MqttStatus::mqttStatus(AsyncWebServerRequest * request) {
root["client_id"] = _mqttSettingsService->getClientId(); root["client_id"] = _mqttSettingsService->getClientId();
root["disconnect_reason"] = (uint8_t)_mqttSettingsService->getDisconnectReason(); root["disconnect_reason"] = (uint8_t)_mqttSettingsService->getDisconnectReason();
root["mqtt_queued"] = emsesp::Mqtt::publish_queued(); // mdvp added root["mqtt_queued"] = emsesp::Mqtt::publish_queued();
root["mqtt_fails"] = emsesp::Mqtt::publish_fails(); // proddy added root["mqtt_fails"] = emsesp::Mqtt::publish_fails();
root["connect_count"] = emsesp::Mqtt::connect_count(); // mdvp added root["connect_count"] = emsesp::Mqtt::connect_count();
response->setLength(); response->setLength();
request->send(response); request->send(response);

View File

@@ -1,7 +1,7 @@
#include <NTPSettingsService.h> #include <NTPSettingsService.h>
#include <esp_sntp.h> #include <esp_sntp.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
using namespace std::placeholders; // for `_1` etc using namespace std::placeholders; // for `_1` etc

View File

@@ -1,5 +1,5 @@
#include <NTPStatus.h> #include <NTPStatus.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
using namespace std::placeholders; // for `_1` etc using namespace std::placeholders; // for `_1` etc

View File

@@ -69,7 +69,7 @@ void NetworkSettingsService::manageSTA() {
esp_wifi_set_bandwidth((wifi_interface_t)ESP_IF_WIFI_STA, WIFI_BW_HT40); esp_wifi_set_bandwidth((wifi_interface_t)ESP_IF_WIFI_STA, WIFI_BW_HT40);
} }
if (networkSettings.nosleep) { if (networkSettings.nosleep) {
WiFi.setSleep(false); // turn off sleep - WIFI_PS_NONE WiFi.setSleep(false); // turn off sleep - WIFI_PS_NONE
} }
WiFi.begin(_state.ssid.c_str(), _state.password.c_str()); // attempt to connect to the network WiFi.begin(_state.ssid.c_str(), _state.password.c_str()); // attempt to connect to the network
esp_wifi_set_max_tx_power(networkSettings.tx_power * 4); // set power after wifi is startet for C3 esp_wifi_set_max_tx_power(networkSettings.tx_power * 4); // set power after wifi is startet for C3

View File

@@ -1,6 +1,6 @@
#include <NetworkStatus.h> #include <NetworkStatus.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
using namespace std::placeholders; // for `_1` etc using namespace std::placeholders; // for `_1` etc

View File

@@ -1,6 +1,6 @@
#include <OTASettingsService.h> #include <OTASettingsService.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
using namespace std::placeholders; // for `_1` etc using namespace std::placeholders; // for `_1` etc

View File

@@ -2,7 +2,7 @@
#if FT_ENABLED(FT_SECURITY) #if FT_ENABLED(FT_SECURITY)
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
SecuritySettingsService::SecuritySettingsService(AsyncWebServer * server, FS * fs) SecuritySettingsService::SecuritySettingsService(AsyncWebServer * server, FS * fs)
: _httpEndpoint(SecuritySettings::read, SecuritySettings::update, this, server, SECURITY_SETTINGS_PATH, this) : _httpEndpoint(SecuritySettings::read, SecuritySettings::update, this, server, SECURITY_SETTINGS_PATH, this)

View File

@@ -19,7 +19,7 @@
enum class StateUpdateResult { enum class StateUpdateResult {
CHANGED = 0, // The update changed the state and propagation should take place if required CHANGED = 0, // The update changed the state and propagation should take place if required
CHANGED_RESTART, // a restart of the device is needed - added by proddy CHANGED_RESTART, // a restart of the device is needed
UNCHANGED, // The state was unchanged, propagation should not take place UNCHANGED, // The state was unchanged, propagation should not take place
ERROR // There was a problem updating the state, propagation should not take place ERROR // There was a problem updating the state, propagation should not take place
}; };

View File

@@ -1,7 +1,7 @@
#include <SystemStatus.h> #include <SystemStatus.h>
#include <esp_ota_ops.h> #include <esp_ota_ops.h>
#include "../../src/emsesp_stub.hpp" // proddy added #include "../../src/emsesp_stub.hpp"
using namespace std::placeholders; // for `_1` etc using namespace std::placeholders; // for `_1` etc
@@ -39,7 +39,7 @@ void SystemStatus::systemStatus(AsyncWebServerRequest * request) {
const esp_partition_t * partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL); const esp_partition_t * partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL);
if (partition != NULL) { // factory partition found if (partition != NULL) { // factory partition found
root["has_loader"] = true; root["has_loader"] = true;
} else { // check for not empty, smaller OTA partition } else { // check for not empty, smaller OTA partition
partition = esp_ota_get_next_update_partition(NULL); partition = esp_ota_get_next_update_partition(NULL);
if (partition) { if (partition) {
uint64_t buffer; uint64_t buffer;