mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59: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
|
CPPCHECK = cppcheck
|
||||||
# CHECKFLAGS = -q --force --std=c++17
|
# CHECKFLAGS = -q --force --std=c++17
|
||||||
CHECKFLAGS = -q --force --std=c++11 -pthread
|
CHECKFLAGS = -q --force --std=c++11
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Languages Standard
|
# Languages Standard
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# C_STANDARD := -std=c17
|
C_STANDARD := -std=c17
|
||||||
# CXX_STANDARD := -std=c++17
|
# CXX_STANDARD := -std=c++17
|
||||||
C_STANDARD := -std=c11
|
CXX_STANDARD := -std=gnu++11
|
||||||
CXX_STANDARD := -std=c++11
|
|
||||||
|
# C_STANDARD := -std=c11
|
||||||
|
# CXX_STANDARD := -std=c++11
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Defined Symbols
|
# Defined Symbols
|
||||||
@@ -79,7 +81,7 @@ CPPFLAGS += -g3
|
|||||||
CPPFLAGS += -Os
|
CPPFLAGS += -Os
|
||||||
|
|
||||||
CFLAGS += $(CPPFLAGS)
|
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
|
CXXFLAGS += $(CFLAGS) -MMD
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||||
"@typescript-eslint/parser": "^6.0.0",
|
"@typescript-eslint/parser": "^6.0.0",
|
||||||
"cspell": "^6.31.1",
|
"cspell": "^6.31.1",
|
||||||
"eslint": "^8.44.0",
|
"eslint": "^8.45.0",
|
||||||
"eslint-config-airbnb": "^19.0.4",
|
"eslint-config-airbnb": "^19.0.4",
|
||||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
|
|||||||
@@ -1967,7 +1967,7 @@ __metadata:
|
|||||||
alova: ^2.9.2
|
alova: ^2.9.2
|
||||||
async-validator: ^4.2.5
|
async-validator: ^4.2.5
|
||||||
cspell: ^6.31.1
|
cspell: ^6.31.1
|
||||||
eslint: ^8.44.0
|
eslint: ^8.45.0
|
||||||
eslint-config-airbnb: ^19.0.4
|
eslint-config-airbnb: ^19.0.4
|
||||||
eslint-config-airbnb-typescript: ^17.1.0
|
eslint-config-airbnb-typescript: ^17.1.0
|
||||||
eslint-config-prettier: ^8.8.0
|
eslint-config-prettier: ^8.8.0
|
||||||
@@ -3488,9 +3488,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"eslint@npm:^8.44.0":
|
"eslint@npm:^8.45.0":
|
||||||
version: 8.44.0
|
version: 8.45.0
|
||||||
resolution: "eslint@npm:8.44.0"
|
resolution: "eslint@npm:8.45.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@eslint-community/eslint-utils": ^4.2.0
|
"@eslint-community/eslint-utils": ^4.2.0
|
||||||
"@eslint-community/regexpp": ^4.4.0
|
"@eslint-community/regexpp": ^4.4.0
|
||||||
@@ -3517,7 +3517,6 @@ __metadata:
|
|||||||
globals: ^13.19.0
|
globals: ^13.19.0
|
||||||
graphemer: ^1.4.0
|
graphemer: ^1.4.0
|
||||||
ignore: ^5.2.0
|
ignore: ^5.2.0
|
||||||
import-fresh: ^3.0.0
|
|
||||||
imurmurhash: ^0.1.4
|
imurmurhash: ^0.1.4
|
||||||
is-glob: ^4.0.0
|
is-glob: ^4.0.0
|
||||||
is-path-inside: ^3.0.3
|
is-path-inside: ^3.0.3
|
||||||
@@ -3529,11 +3528,10 @@ __metadata:
|
|||||||
natural-compare: ^1.4.0
|
natural-compare: ^1.4.0
|
||||||
optionator: ^0.9.3
|
optionator: ^0.9.3
|
||||||
strip-ansi: ^6.0.1
|
strip-ansi: ^6.0.1
|
||||||
strip-json-comments: ^3.1.0
|
|
||||||
text-table: ^0.2.0
|
text-table: ^0.2.0
|
||||||
bin:
|
bin:
|
||||||
eslint: bin/eslint.js
|
eslint: bin/eslint.js
|
||||||
checksum: a31ca4571a67012629936d891141a4a5747d5902fb7f4e10119a5acd632e0976b9ba1b761d8c81cff8a9cc3e796df2c56f86c02535fd977de962a98ce585624a
|
checksum: 2a043b8d3b9a5684e2f66bd446c3dc8522cc7afbb0982d0a5be76ea1f578d0e617598a7b289616a861ab8272b57f6056acb2b264bec6302c9b0921a1cfa66fdb
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -4254,7 +4252,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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
|
version: 3.3.0
|
||||||
resolution: "import-fresh@npm:3.3.0"
|
resolution: "import-fresh@npm:3.3.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -6406,7 +6404,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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
|
version: 3.1.1
|
||||||
resolution: "strip-json-comments@npm:3.1.1"
|
resolution: "strip-json-comments@npm:3.1.1"
|
||||||
checksum: 9681a6257b925a7fa0f285851c0e613cc934a50661fa7bb41ca9cbbff89686bb4a0ee366e6ecedc4daafd01e83eee0720111ab294366fe7c185e935475ebcecd
|
checksum: 9681a6257b925a7fa0f285851c0e613cc934a50661fa7bb41ca9cbbff89686bb4a0ee366e6ecedc4daafd01e83eee0720111ab294366fe7c185e935475ebcecd
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ const char * MqttClient::getClientId() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MqttClient::loop() {
|
void MqttClient::loop() {
|
||||||
switch (_state) {
|
switch ((State)_state) { // modified by proddy for EMS-ESP compiling standalone
|
||||||
case State::disconnected:
|
case State::disconnected:
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
if (_useInternalTask == espMqttClientTypes::UseInternalTask::YES) {
|
if (_useInternalTask == espMqttClientTypes::UseInternalTask::YES) {
|
||||||
|
|||||||
@@ -123,8 +123,7 @@ class MqttClient {
|
|||||||
#elif defined(ARDUINO_ARCH_ESP8266) && EMC_ESP8266_MULTITHREADING
|
#elif defined(ARDUINO_ARCH_ESP8266) && EMC_ESP8266_MULTITHREADING
|
||||||
std::atomic<bool> _xSemaphore = false;
|
std::atomic<bool> _xSemaphore = false;
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
// added mutable to compile EMS-ESP standalone
|
mutable std::mutex mtx; // modified by proddy for EMS-ESP compiling standalone
|
||||||
mutable std::mutex mtx;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t _rxBuffer[EMC_RX_BUFFER_SIZE];
|
uint8_t _rxBuffer[EMC_RX_BUFFER_SIZE];
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ bool ClientPosix::connect(IPAddress ip, uint16_t port) {
|
|||||||
memset(&_host, 0, sizeof(_host));
|
memset(&_host, 0, sizeof(_host));
|
||||||
_host.sin_family = AF_INET;
|
_host.sin_family = AF_INET;
|
||||||
_host.sin_addr.s_addr = htonl(uint32_t(ip));
|
_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));
|
int ret = ::connect(_sockfd, (struct sockaddr *)&_host, sizeof(_host));
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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()) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
namespace uuid {
|
namespace uuid {
|
||||||
|
|
||||||
// added by proddy for EMS-ESP
|
|
||||||
static uint64_t now_millis = 0;
|
static uint64_t now_millis = 0;
|
||||||
|
|
||||||
// returns system uptime in seconds
|
// returns system uptime in seconds
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
namespace uuid {
|
namespace uuid {
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
set_uptime(); // added by proddy
|
set_uptime();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace uuid
|
} // namespace uuid
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ void loop();
|
|||||||
*/
|
*/
|
||||||
uint64_t get_uptime_ms();
|
uint64_t get_uptime_ms();
|
||||||
|
|
||||||
uint32_t get_uptime(); // added by proddy for EMS-ESP
|
uint32_t get_uptime();
|
||||||
uint32_t get_uptime_sec(); // added by proddy for EMS-ESP
|
uint32_t get_uptime_sec();
|
||||||
|
|
||||||
void set_uptime();
|
void set_uptime();
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ void Shell::display_prompt() {
|
|||||||
std::string context = context_text();
|
std::string context = context_text();
|
||||||
|
|
||||||
print(prompt_prefix());
|
print(prompt_prefix());
|
||||||
// colors added by proddy
|
|
||||||
if (!hostname.empty()) {
|
if (!hostname.empty()) {
|
||||||
print(COLOR_BRIGHT_GREEN);
|
print(COLOR_BRIGHT_GREEN);
|
||||||
print(COLOR_BOLD_ON);
|
print(COLOR_BOLD_ON);
|
||||||
@@ -78,7 +77,6 @@ void Shell::display_prompt() {
|
|||||||
print(COLOR_BOLD_ON);
|
print(COLOR_BOLD_ON);
|
||||||
print(context);
|
print(context);
|
||||||
print(COLOR_RESET);
|
print(COLOR_RESET);
|
||||||
// print(' ');
|
|
||||||
}
|
}
|
||||||
print(prompt_suffix());
|
print(prompt_suffix());
|
||||||
print(' ');
|
print(' ');
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ bool SyslogService::can_transmit() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!emsesp::EMSESP::system_.network_connected()) {
|
if (!emsesp::EMSESP::system_.network_connected()) {
|
||||||
return false; // added by proddy. Check Ethernet
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t now = uuid::get_uptime_ms();
|
const uint64_t now = uuid::get_uptime_ms();
|
||||||
|
|||||||
@@ -144,12 +144,13 @@ build_flags = ${common.build_flags} -O2
|
|||||||
platform = native
|
platform = native
|
||||||
build_flags =
|
build_flags =
|
||||||
-DARDUINOJSON_ENABLE_STD_STRING=1 -DARDUINOJSON_ENABLE_PROGMEM=1 -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0
|
-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\"
|
-DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.6.0-dev\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\"
|
||||||
-lpthread
|
-lpthread
|
||||||
-std=gnu++11 -Og -ggdb
|
-std=gnu++11 -Og -ggdb
|
||||||
build_src_flags =
|
build_src_flags =
|
||||||
-Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-unused-lambda-capture
|
-Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-unused-lambda-capture
|
||||||
|
-Wno-missing-braces
|
||||||
-I./lib_standalone
|
-I./lib_standalone
|
||||||
-I./lib/ArduinoJson/src
|
-I./lib/ArduinoJson/src
|
||||||
-I./lib/uuid-common/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
|
// received an MQTT message that we subscribed too
|
||||||
// topic is the full path
|
// topic is the full path
|
||||||
// payload is json or a single string and converted to a json with key 'value'
|
// 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
|
// sometimes the payload is not terminated correctly, so make a copy
|
||||||
// convert payload to a null-terminated char string
|
// convert payload to a null-terminated char string
|
||||||
char message[len + 2] = {'\0'};
|
char message[len + 2] = {'\0'};
|
||||||
if (payload != nullptr) {
|
if (payload != nullptr) {
|
||||||
strlcpy(message, payload, len + 1);
|
strlcpy(message, payload, len + 1);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
if (len) {
|
if (len) {
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ class Mqtt {
|
|||||||
|
|
||||||
static std::vector<MQTTSubFunction> mqtt_subfunctions_; // list of mqtt subscribe callbacks for all devices
|
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_boiler_ = 0;
|
||||||
uint32_t last_publish_thermostat_ = 0;
|
uint32_t last_publish_thermostat_ = 0;
|
||||||
uint32_t last_publish_solar_ = 0;
|
uint32_t last_publish_solar_ = 0;
|
||||||
@@ -255,7 +255,7 @@ class Mqtt {
|
|||||||
uint32_t last_publish_other_ = 0;
|
uint32_t last_publish_other_ = 0;
|
||||||
uint32_t last_publish_sensor_ = 0;
|
uint32_t last_publish_sensor_ = 0;
|
||||||
uint32_t last_publish_heartbeat_ = 0;
|
uint32_t last_publish_heartbeat_ = 0;
|
||||||
uint32_t last_publish_queue_ = 0;
|
// uint32_t last_publish_queue_ = 0;
|
||||||
|
|
||||||
static bool connecting_;
|
static bool connecting_;
|
||||||
static bool initialized_;
|
static bool initialized_;
|
||||||
|
|||||||
Reference in New Issue
Block a user