mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
Merge branch 'dev2' of https://github.com/emsesp/EMS-ESP32 into dev2
This commit is contained in:
12
Makefile
12
Makefile
@@ -23,15 +23,17 @@ LIBRARIES :=
|
||||
|
||||
CPPCHECK = cppcheck
|
||||
# CHECKFLAGS = -q --force --std=c++17
|
||||
CHECKFLAGS = -q --force --std=c++11 -pthread
|
||||
CHECKFLAGS = -q --force --std=c++11
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Languages Standard
|
||||
#----------------------------------------------------------------------
|
||||
# C_STANDARD := -std=c17
|
||||
C_STANDARD := -std=c17
|
||||
# CXX_STANDARD := -std=c++17
|
||||
C_STANDARD := -std=c11
|
||||
CXX_STANDARD := -std=c++11
|
||||
CXX_STANDARD := -std=gnu++11
|
||||
|
||||
# C_STANDARD := -std=c11
|
||||
# CXX_STANDARD := -std=c++11
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Defined Symbols
|
||||
@@ -79,7 +81,7 @@ CPPFLAGS += -g3
|
||||
CPPFLAGS += -Os
|
||||
|
||||
CFLAGS += $(CPPFLAGS)
|
||||
CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter
|
||||
CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-missing-braces -Wno-unused-lambda-capture
|
||||
|
||||
CXXFLAGS += $(CFLAGS) -MMD
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"cspell": "^6.31.1",
|
||||
"eslint": "^8.44.0",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
|
||||
@@ -1967,7 +1967,7 @@ __metadata:
|
||||
alova: ^2.9.2
|
||||
async-validator: ^4.2.5
|
||||
cspell: ^6.31.1
|
||||
eslint: ^8.44.0
|
||||
eslint: ^8.45.0
|
||||
eslint-config-airbnb: ^19.0.4
|
||||
eslint-config-airbnb-typescript: ^17.1.0
|
||||
eslint-config-prettier: ^8.8.0
|
||||
@@ -3488,9 +3488,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint@npm:^8.44.0":
|
||||
version: 8.44.0
|
||||
resolution: "eslint@npm:8.44.0"
|
||||
"eslint@npm:^8.45.0":
|
||||
version: 8.45.0
|
||||
resolution: "eslint@npm:8.45.0"
|
||||
dependencies:
|
||||
"@eslint-community/eslint-utils": ^4.2.0
|
||||
"@eslint-community/regexpp": ^4.4.0
|
||||
@@ -3517,7 +3517,6 @@ __metadata:
|
||||
globals: ^13.19.0
|
||||
graphemer: ^1.4.0
|
||||
ignore: ^5.2.0
|
||||
import-fresh: ^3.0.0
|
||||
imurmurhash: ^0.1.4
|
||||
is-glob: ^4.0.0
|
||||
is-path-inside: ^3.0.3
|
||||
@@ -3529,11 +3528,10 @@ __metadata:
|
||||
natural-compare: ^1.4.0
|
||||
optionator: ^0.9.3
|
||||
strip-ansi: ^6.0.1
|
||||
strip-json-comments: ^3.1.0
|
||||
text-table: ^0.2.0
|
||||
bin:
|
||||
eslint: bin/eslint.js
|
||||
checksum: a31ca4571a67012629936d891141a4a5747d5902fb7f4e10119a5acd632e0976b9ba1b761d8c81cff8a9cc3e796df2c56f86c02535fd977de962a98ce585624a
|
||||
checksum: 2a043b8d3b9a5684e2f66bd446c3dc8522cc7afbb0982d0a5be76ea1f578d0e617598a7b289616a861ab8272b57f6056acb2b264bec6302c9b0921a1cfa66fdb
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -4254,7 +4252,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"import-fresh@npm:^3.0.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0":
|
||||
"import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0":
|
||||
version: 3.3.0
|
||||
resolution: "import-fresh@npm:3.3.0"
|
||||
dependencies:
|
||||
@@ -6406,7 +6404,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1":
|
||||
"strip-json-comments@npm:^3.1.1":
|
||||
version: 3.1.1
|
||||
resolution: "strip-json-comments@npm:3.1.1"
|
||||
checksum: 9681a6257b925a7fa0f285851c0e613cc934a50661fa7bb41ca9cbbff89686bb4a0ee366e6ecedc4daafd01e83eee0720111ab294366fe7c185e935475ebcecd
|
||||
|
||||
@@ -197,7 +197,7 @@ const char * MqttClient::getClientId() const {
|
||||
}
|
||||
|
||||
void MqttClient::loop() {
|
||||
switch (_state) {
|
||||
switch ((State)_state) { // modified by proddy for EMS-ESP compiling standalone
|
||||
case State::disconnected:
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
if (_useInternalTask == espMqttClientTypes::UseInternalTask::YES) {
|
||||
|
||||
@@ -123,8 +123,7 @@ class MqttClient {
|
||||
#elif defined(ARDUINO_ARCH_ESP8266) && EMC_ESP8266_MULTITHREADING
|
||||
std::atomic<bool> _xSemaphore = false;
|
||||
#elif defined(__linux__)
|
||||
// added mutable to compile EMS-ESP standalone
|
||||
mutable std::mutex mtx;
|
||||
mutable std::mutex mtx; // modified by proddy for EMS-ESP compiling standalone
|
||||
#endif
|
||||
|
||||
uint8_t _rxBuffer[EMC_RX_BUFFER_SIZE];
|
||||
|
||||
@@ -38,7 +38,7 @@ bool ClientPosix::connect(IPAddress ip, uint16_t port) {
|
||||
memset(&_host, 0, sizeof(_host));
|
||||
_host.sin_family = AF_INET;
|
||||
_host.sin_addr.s_addr = htonl(uint32_t(ip));
|
||||
_host.sin_port = ::htons(port);
|
||||
_host.sin_port = htons(port); // modified by proddy for EMS-ESP compiling standalone
|
||||
|
||||
int ret = ::connect(_sockfd, (struct sockaddr *)&_host, sizeof(_host));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <APSettingsService.h>
|
||||
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
APSettingsService::APSettingsService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager)
|
||||
: _httpEndpoint(APSettings::read, APSettings::update, this, server, AP_SETTINGS_SERVICE_PATH, securityManager)
|
||||
|
||||
@@ -18,10 +18,7 @@ void FactoryResetService::handleRequest(AsyncWebServerRequest * request) {
|
||||
* Delete function assumes that all files are stored flat, within the config directory.
|
||||
*/
|
||||
void FactoryResetService::factoryReset() {
|
||||
/*
|
||||
* Based on LittleFS. Modified by proddy
|
||||
* Could be replaced with fs.rmdir(FS_CONFIG_DIRECTORY) in IDF 4.2
|
||||
*/
|
||||
// TODO Could be replaced with fs.rmdir(FS_CONFIG_DIRECTORY) in IDF 4.2
|
||||
File root = fs->open(FS_CONFIG_DIRECTORY);
|
||||
File file;
|
||||
while (file = root.openNextFile()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <FeaturesService.h>
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
using namespace std::placeholders; // for `_1` etc
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ class HttpPostEndpoint {
|
||||
response->setLength();
|
||||
|
||||
if (outcome == StateUpdateResult::CHANGED_RESTART) {
|
||||
response->setCode(205); // added by proddy, reboot required
|
||||
response->setCode(205); // reboot required
|
||||
}
|
||||
request->send(response);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <MqttSettingsService.h>
|
||||
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
using namespace std::placeholders; // for `_1` etc
|
||||
|
||||
@@ -144,7 +144,6 @@ void MqttSettingsService::onConfigUpdated() {
|
||||
_reconfigureMqtt = true;
|
||||
_disconnectedAt = 0;
|
||||
|
||||
// added by proddy
|
||||
startClient();
|
||||
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["entity_format"] = settings.entity_format;
|
||||
|
||||
// added by proddy for EMS-ESP
|
||||
root["publish_time_boiler"] = settings.publish_time_boiler;
|
||||
root["publish_time_thermostat"] = settings.publish_time_thermostat;
|
||||
root["publish_time_solar"] = settings.publish_time_solar;
|
||||
|
||||
@@ -76,7 +76,7 @@ class MqttSettings {
|
||||
uint16_t keepAlive;
|
||||
bool cleanSession;
|
||||
|
||||
// proddy EMS-ESP specific
|
||||
// EMS-ESP specific
|
||||
String base;
|
||||
uint16_t publish_time_boiler;
|
||||
uint16_t publish_time_thermostat;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <MqttStatus.h>
|
||||
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
using namespace std::placeholders; // for `_1` etc
|
||||
|
||||
@@ -20,9 +20,9 @@ void MqttStatus::mqttStatus(AsyncWebServerRequest * request) {
|
||||
root["client_id"] = _mqttSettingsService->getClientId();
|
||||
root["disconnect_reason"] = (uint8_t)_mqttSettingsService->getDisconnectReason();
|
||||
|
||||
root["mqtt_queued"] = emsesp::Mqtt::publish_queued(); // mdvp added
|
||||
root["mqtt_fails"] = emsesp::Mqtt::publish_fails(); // proddy added
|
||||
root["connect_count"] = emsesp::Mqtt::connect_count(); // mdvp added
|
||||
root["mqtt_queued"] = emsesp::Mqtt::publish_queued();
|
||||
root["mqtt_fails"] = emsesp::Mqtt::publish_fails();
|
||||
root["connect_count"] = emsesp::Mqtt::connect_count();
|
||||
|
||||
response->setLength();
|
||||
request->send(response);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <NTPSettingsService.h>
|
||||
#include <esp_sntp.h>
|
||||
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
using namespace std::placeholders; // for `_1` etc
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <NTPStatus.h>
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
using namespace std::placeholders; // for `_1` etc
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <NetworkStatus.h>
|
||||
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
using namespace std::placeholders; // for `_1` etc
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <OTASettingsService.h>
|
||||
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
using namespace std::placeholders; // for `_1` etc
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#if FT_ENABLED(FT_SECURITY)
|
||||
|
||||
#include "../../src/emsesp_stub.hpp" // proddy added
|
||||
#include "../../src/emsesp_stub.hpp"
|
||||
|
||||
SecuritySettingsService::SecuritySettingsService(AsyncWebServer * server, FS * fs)
|
||||
: _httpEndpoint(SecuritySettings::read, SecuritySettings::update, this, server, SECURITY_SETTINGS_PATH, this)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
enum class StateUpdateResult {
|
||||
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
|
||||
ERROR // There was a problem updating the state, propagation should not take place
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <SystemStatus.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
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
namespace uuid {
|
||||
|
||||
// added by proddy for EMS-ESP
|
||||
static uint64_t now_millis = 0;
|
||||
|
||||
// returns system uptime in seconds
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
namespace uuid {
|
||||
|
||||
void loop() {
|
||||
set_uptime(); // added by proddy
|
||||
set_uptime();
|
||||
}
|
||||
|
||||
} // namespace uuid
|
||||
|
||||
@@ -102,8 +102,8 @@ void loop();
|
||||
*/
|
||||
uint64_t get_uptime_ms();
|
||||
|
||||
uint32_t get_uptime(); // added by proddy for EMS-ESP
|
||||
uint32_t get_uptime_sec(); // added by proddy for EMS-ESP
|
||||
uint32_t get_uptime();
|
||||
uint32_t get_uptime_sec();
|
||||
|
||||
void set_uptime();
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ void Shell::display_prompt() {
|
||||
std::string context = context_text();
|
||||
|
||||
print(prompt_prefix());
|
||||
// colors added by proddy
|
||||
if (!hostname.empty()) {
|
||||
print(COLOR_BRIGHT_GREEN);
|
||||
print(COLOR_BOLD_ON);
|
||||
@@ -78,7 +77,6 @@ void Shell::display_prompt() {
|
||||
print(COLOR_BOLD_ON);
|
||||
print(context);
|
||||
print(COLOR_RESET);
|
||||
// print(' ');
|
||||
}
|
||||
print(prompt_suffix());
|
||||
print(' ');
|
||||
|
||||
@@ -365,7 +365,7 @@ bool SyslogService::can_transmit() {
|
||||
#endif
|
||||
|
||||
if (!emsesp::EMSESP::system_.network_connected()) {
|
||||
return false; // added by proddy. Check Ethernet
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint64_t now = uuid::get_uptime_ms();
|
||||
|
||||
@@ -144,12 +144,13 @@ build_flags = ${common.build_flags} -O2
|
||||
platform = native
|
||||
build_flags =
|
||||
-DARDUINOJSON_ENABLE_STD_STRING=1 -DARDUINOJSON_ENABLE_PROGMEM=1 -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0
|
||||
-DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST
|
||||
-DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST -D__linux__
|
||||
-DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.6.0-dev\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\"
|
||||
-lpthread
|
||||
-std=gnu++11 -Og -ggdb
|
||||
build_src_flags =
|
||||
-Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-unused-lambda-capture
|
||||
-Wno-missing-braces
|
||||
-I./lib_standalone
|
||||
-I./lib/ArduinoJson/src
|
||||
-I./lib/uuid-common/src
|
||||
|
||||
@@ -211,13 +211,18 @@ void Mqtt::incoming(const char * topic, const char * payload) {
|
||||
// received an MQTT message that we subscribed too
|
||||
// topic is the full path
|
||||
// payload is json or a single string and converted to a json with key 'value'
|
||||
void Mqtt::on_message(const char * topic, const char * payload, size_t len) const {
|
||||
void Mqtt::on_message(const char * topic, const char * message, size_t len) const {
|
||||
// This causes a compile error "error: variable-sized object may not be initialized"
|
||||
// so commenting out and assuming with the new mqtt lib it's always null terminated
|
||||
|
||||
/*
|
||||
// sometimes the payload is not terminated correctly, so make a copy
|
||||
// convert payload to a null-terminated char string
|
||||
char message[len + 2] = {'\0'};
|
||||
if (payload != nullptr) {
|
||||
strlcpy(message, payload, len + 1);
|
||||
}
|
||||
*/
|
||||
|
||||
#if defined(EMSESP_DEBUG)
|
||||
if (len) {
|
||||
|
||||
@@ -247,7 +247,7 @@ class Mqtt {
|
||||
|
||||
static std::vector<MQTTSubFunction> mqtt_subfunctions_; // list of mqtt subscribe callbacks for all devices
|
||||
|
||||
uint32_t last_mqtt_poll_ = 0;
|
||||
// uint32_t last_mqtt_poll_ = 0;
|
||||
uint32_t last_publish_boiler_ = 0;
|
||||
uint32_t last_publish_thermostat_ = 0;
|
||||
uint32_t last_publish_solar_ = 0;
|
||||
@@ -255,7 +255,7 @@ class Mqtt {
|
||||
uint32_t last_publish_other_ = 0;
|
||||
uint32_t last_publish_sensor_ = 0;
|
||||
uint32_t last_publish_heartbeat_ = 0;
|
||||
uint32_t last_publish_queue_ = 0;
|
||||
// uint32_t last_publish_queue_ = 0;
|
||||
|
||||
static bool connecting_;
|
||||
static bool initialized_;
|
||||
|
||||
Reference in New Issue
Block a user