mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-05-20 00:08:16 +05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c6117f106e | |||
| 66a433e0dd | |||
| dcc9b37010 | |||
| 554342e7f5 |
@@ -1,152 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "assets/**"
|
||||
- "tools/**"
|
||||
- "**/*.md"
|
||||
- "LICENSE"
|
||||
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "assets/**"
|
||||
- "tools/**"
|
||||
- "**/*.md"
|
||||
- "LICENSE"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
name: Prepare (get envs)
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
envs: ${{ steps.envs.outputs.envs }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade platformio
|
||||
pip install --upgrade intelhex
|
||||
|
||||
- name: Get environments
|
||||
id: envs
|
||||
shell: bash
|
||||
run: |
|
||||
ENVS=$(
|
||||
pio project config --json-output \
|
||||
| jq -c '
|
||||
.[]
|
||||
| select(type == "array")
|
||||
| .[0]
|
||||
| select(startswith("env:"))
|
||||
| sub("^env:"; "")
|
||||
' | jq -s -c '.'
|
||||
)
|
||||
|
||||
echo "envs=$ENVS" >> "$GITHUB_OUTPUT"
|
||||
echo "$ENVS"
|
||||
|
||||
build:
|
||||
name: Build ${{ matrix.env }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
env: ${{ fromJson(needs.prepare.outputs.envs) }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade platformio
|
||||
pip install --upgrade intelhex
|
||||
|
||||
- name: Full clean
|
||||
run: |
|
||||
pio run -e ${{ matrix.env }} -t fullclean
|
||||
|
||||
- name: Build firmware & filesystem
|
||||
env:
|
||||
PIOENV: ${{ matrix.env }}
|
||||
run: |
|
||||
pio run -e ${{ matrix.env }}
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ matrix.env }}
|
||||
if-no-files-found: error
|
||||
path: |
|
||||
build/*.bin
|
||||
build/*.elf
|
||||
|
||||
release:
|
||||
name: Release Dev
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
permissions:
|
||||
contents: write
|
||||
if: ${{ github.repository_owner == 'Laxilef' && github.ref == 'refs/heads/async' }}
|
||||
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Delete old release assets
|
||||
uses: mknejp/delete-release-assets@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag: dev
|
||||
fail-if-no-assets: false
|
||||
fail-if-no-release: false
|
||||
assets: |
|
||||
*.bin
|
||||
*.elf
|
||||
|
||||
- name: Publish Dev release
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
tag_name: dev
|
||||
target_commitish: async
|
||||
name: Dev (unstable)
|
||||
prerelease: true
|
||||
make_latest: false
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
artifacts/*.bin
|
||||
artifacts/*.elf
|
||||
@@ -1,110 +0,0 @@
|
||||
name: CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
validate-json:
|
||||
name: Validate JSON
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install jq
|
||||
run: sudo apt-get update && sudo apt-get install -y jq
|
||||
|
||||
- name: Validate
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
echo "Searching JSON files in src_data..."
|
||||
|
||||
files=$(find src_data -type f -iname "*.json")
|
||||
|
||||
if [ -z "$files" ]; then
|
||||
echo "No JSON files found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
failed=0
|
||||
|
||||
for file in $files; do
|
||||
echo "Validating: $file"
|
||||
|
||||
if ! jq empty "$file" >/dev/null 2>&1; then
|
||||
echo "❌ Invalid JSON: $file"
|
||||
failed=1
|
||||
else
|
||||
echo "✅ Valid JSON: $file"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$failed" -ne 0 ]; then
|
||||
echo ""
|
||||
echo "JSON validation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "All JSON files are valid."
|
||||
|
||||
cpplint:
|
||||
name: cpplint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
key: ${{ runner.os }}-cpplint
|
||||
path: ~/.cache/pip
|
||||
|
||||
- name: Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install cpplint
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade cpplint
|
||||
|
||||
- name: cpplint
|
||||
run: |
|
||||
FILTERS="-legal/copyright,\
|
||||
-runtime/int,\
|
||||
-runtime/references,\
|
||||
-runtime/indentation_namespace,\
|
||||
-runtime/arrays,\
|
||||
-runtime/printf,\
|
||||
-whitespace/line_length,\
|
||||
-whitespace/braces,\
|
||||
-whitespace/comments,\
|
||||
-whitespace/indent,\
|
||||
-whitespace/newline,\
|
||||
-whitespace/parens,\
|
||||
-whitespace/blank_line,\
|
||||
-readability/braces,\
|
||||
-readability/todo,\
|
||||
-readability/namespace,\
|
||||
-build/header_guard,\
|
||||
-build/include_subdir,\
|
||||
-build/include_what_you_use,\
|
||||
-build/namespaces,\
|
||||
-build/c++11"
|
||||
|
||||
cpplint \
|
||||
--repository=. \
|
||||
--recursive \
|
||||
--quiet \
|
||||
--filter="$FILTERS" \
|
||||
include lib src
|
||||
@@ -1,9 +1,9 @@
|
||||
class BufferedWebServer {
|
||||
public:
|
||||
explicit BufferedWebServer(WebServer* webServer, size_t bufferSize = 64) {
|
||||
BufferedWebServer(WebServer* webServer, size_t bufferSize = 64) {
|
||||
this->webServer = webServer;
|
||||
this->bufferSize = bufferSize;
|
||||
this->buffer = static_cast<uint8_t*>(malloc(bufferSize * sizeof(*this->buffer)));
|
||||
this->buffer = (uint8_t*)malloc(bufferSize * sizeof(*this->buffer));
|
||||
}
|
||||
|
||||
~BufferedWebServer() {
|
||||
|
||||
@@ -7,7 +7,7 @@ public:
|
||||
typedef std::function<void(unsigned long, uint8_t)> BeforeSendRequestCallback;
|
||||
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, uint8_t)> AfterSendRequestCallback;
|
||||
|
||||
explicit CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {}
|
||||
CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {}
|
||||
~CustomOpenTherm() {}
|
||||
|
||||
CustomOpenTherm* setDelayCallback(DelayCallback callback = nullptr) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef PROGMEM
|
||||
#define PROGMEM // NOLINT
|
||||
#define PROGMEM
|
||||
#endif
|
||||
|
||||
const char HA_ENTITY_BINARY_SENSOR[] PROGMEM = "binary_sensor";
|
||||
|
||||
@@ -12,10 +12,10 @@ public:
|
||||
typedef std::function<void(const char*, size_t, size_t, bool)> PublishEventCallback;
|
||||
typedef std::function<void(size_t, size_t)> FlushEventCallback;
|
||||
|
||||
explicit MqttWriter(MqttClient* client, size_t bufferSize = 64) {
|
||||
MqttWriter(MqttClient* client, size_t bufferSize = 64) {
|
||||
this->client = client;
|
||||
this->bufferSize = bufferSize;
|
||||
this->buffer = static_cast<uint8_t*>(malloc(bufferSize * sizeof(*this->buffer)));
|
||||
this->buffer = (uint8_t*) malloc(bufferSize * sizeof(*this->buffer));
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
this->mutex = new std::mutex();
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
#include <FS.h>
|
||||
|
||||
|
||||
class DynamicPage : public RequestHandler {
|
||||
public:
|
||||
typedef std::function<bool(HTTPMethod, const String&)> CanHandleCallback;
|
||||
typedef std::function<bool()> BeforeSendCallback;
|
||||
typedef std::function<String(const char*)> TemplateCallback;
|
||||
|
||||
DynamicPage(const char* uri, FS* fs, const char* path, const char* cacheHeader = nullptr) {
|
||||
this->uri = uri;
|
||||
this->fs = fs;
|
||||
this->path = path;
|
||||
this->cacheHeader = cacheHeader;
|
||||
}
|
||||
|
||||
DynamicPage* setCanHandleCallback(CanHandleCallback callback = nullptr) {
|
||||
this->canHandleCallback = callback;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
DynamicPage* setBeforeSendCallback(BeforeSendCallback callback = nullptr) {
|
||||
this->beforeSendCallback = callback;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
DynamicPage* setTemplateCallback(TemplateCallback callback = nullptr) {
|
||||
this->templateCallback = callback;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
bool canHandle(WebServer &server, HTTPMethod method, const String &uri) override {
|
||||
return this->canHandle(method, uri);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool canHandle(HTTPMethod method, const String& uri) override {
|
||||
return uri.equals(this->uri) && (!this->canHandleCallback || this->canHandleCallback(method, uri));
|
||||
}
|
||||
|
||||
bool handle(WebServer& server, HTTPMethod method, const String& uri) override {
|
||||
if (!this->canHandle(method, uri)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->beforeSendCallback && !this->beforeSendCallback()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
File file = this->fs->open(this->path, "r");
|
||||
if (!file) {
|
||||
return false;
|
||||
|
||||
} else if (file.isDirectory()) {
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->cacheHeader != nullptr) {
|
||||
server.sendHeader(F("Cache-Control"), this->cacheHeader);
|
||||
}
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
if (!server.chunkedResponseModeStart(200, F("text/html"))) {
|
||||
server.send(505, F("text/html"), F("HTTP1.1 required"));
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
server.setContentLength(CONTENT_LENGTH_UNKNOWN);
|
||||
server.send(200, "text/html", emptyString);
|
||||
#endif
|
||||
|
||||
uint8_t* argStartPos = nullptr;
|
||||
uint8_t* argEndPos = nullptr;
|
||||
uint8_t argName[16];
|
||||
size_t sizeArgName = 0;
|
||||
bool argNameProcess = false;
|
||||
while (file.available()) {
|
||||
uint8_t buf[64];
|
||||
size_t length = file.read(buf, sizeof(buf));
|
||||
size_t offset = 0;
|
||||
|
||||
if (argNameProcess) {
|
||||
argEndPos = (uint8_t*) memchr(buf, '}', length);
|
||||
|
||||
if (argEndPos != nullptr) {
|
||||
size_t fullSizeArgName = sizeArgName + (argEndPos - buf);
|
||||
if (fullSizeArgName < sizeof(argName)) {
|
||||
// copy full arg name
|
||||
if (argEndPos - buf > 0) {
|
||||
memcpy(argName + sizeArgName, buf, argEndPos - buf);
|
||||
}
|
||||
argName[fullSizeArgName] = '\0';
|
||||
|
||||
// send arg value
|
||||
String argValue = this->templateCallback((const char*) argName);
|
||||
if (argValue.length()) {
|
||||
server.sendContent(argValue.c_str());
|
||||
|
||||
} else if (fullSizeArgName > 0) {
|
||||
server.sendContent("{");
|
||||
server.sendContent((const char*) argName);
|
||||
server.sendContent("}");
|
||||
}
|
||||
|
||||
offset = size_t(argEndPos - buf + 1);
|
||||
sizeArgName = 0;
|
||||
argNameProcess = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (argNameProcess) {
|
||||
server.sendContent("{");
|
||||
|
||||
if (sizeArgName > 0) {
|
||||
argName[sizeArgName] = '\0';
|
||||
server.sendContent((const char*) argName);
|
||||
}
|
||||
|
||||
argNameProcess = false;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
uint8_t* currentBuf = buf + offset;
|
||||
size_t currentLength = length - offset;
|
||||
|
||||
argStartPos = (uint8_t*) memchr(currentBuf, '{', currentLength);
|
||||
|
||||
// send all content
|
||||
if (argStartPos == nullptr) {
|
||||
if (currentLength > 0) {
|
||||
server.sendContent((const char*) currentBuf, currentLength);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
argEndPos = (uint8_t*) memchr(argStartPos, '}', length - (argStartPos - buf));
|
||||
if (argEndPos != nullptr) {
|
||||
sizeArgName = argEndPos - argStartPos - 1;
|
||||
|
||||
// send all content if arg len > space
|
||||
if (sizeArgName >= sizeof(argName)) {
|
||||
if (currentLength > 0) {
|
||||
server.sendContent((const char*) currentBuf, currentLength);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// arg name
|
||||
memcpy(argName, argStartPos + 1, sizeArgName);
|
||||
argName[sizeArgName] = '\0';
|
||||
|
||||
// send arg value
|
||||
String argValue = this->templateCallback((const char*) argName);
|
||||
if (argValue.length()) {
|
||||
// send content before var
|
||||
if (argStartPos - buf > 0) {
|
||||
server.sendContent((const char*) currentBuf, argStartPos - buf);
|
||||
}
|
||||
|
||||
server.sendContent(argValue.c_str());
|
||||
|
||||
} else {
|
||||
server.sendContent((const char*) currentBuf, argEndPos - currentBuf + 1);
|
||||
}
|
||||
|
||||
offset = size_t(argEndPos - currentBuf + 1);
|
||||
|
||||
} else {
|
||||
sizeArgName = length - size_t(argStartPos - currentBuf) - 1;
|
||||
|
||||
// send all content if arg len > space
|
||||
if (sizeArgName >= sizeof(argName)) {
|
||||
if (currentLength) {
|
||||
server.sendContent((const char*) currentBuf, currentLength);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// send content before var
|
||||
if (argStartPos - buf > 0) {
|
||||
server.sendContent((const char*) currentBuf, argStartPos - buf);
|
||||
}
|
||||
|
||||
// copy arg name chunk
|
||||
if (sizeArgName > 0) {
|
||||
memcpy(argName, argStartPos + 1, sizeArgName);
|
||||
}
|
||||
|
||||
argNameProcess = true;
|
||||
|
||||
break;
|
||||
}
|
||||
} while(true);
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
server.chunkedResponseFinalize();
|
||||
#else
|
||||
server.sendContent(emptyString);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
FS* fs = nullptr;
|
||||
CanHandleCallback canHandleCallback;
|
||||
BeforeSendCallback beforeSendCallback;
|
||||
TemplateCallback templateCallback;
|
||||
const char* uri = nullptr;
|
||||
const char* path = nullptr;
|
||||
const char* cacheHeader = nullptr;
|
||||
};
|
||||
@@ -29,9 +29,9 @@ public:
|
||||
typedef std::function<bool(AsyncWebServerRequest *request, UpgradeType)> BeforeUpgradeCallback;
|
||||
typedef std::function<void(AsyncWebServerRequest *request, const UpgradeResult&, const UpgradeResult&)> AfterUpgradeCallback;
|
||||
|
||||
explicit UpgradeHandler(AsyncURIMatcher uri) : uri(uri) {}
|
||||
UpgradeHandler(AsyncURIMatcher uri) : uri(uri) {}
|
||||
|
||||
bool canHandle(AsyncWebServerRequest *request) const final {
|
||||
bool canHandle(AsyncWebServerRequest *request) const override final {
|
||||
if (!request->isHTTP()) {
|
||||
return false;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
return this;
|
||||
}
|
||||
|
||||
void handleRequest(AsyncWebServerRequest *request) final {
|
||||
void handleRequest(AsyncWebServerRequest *request) override final {
|
||||
if (this->afterUpgradeCallback) {
|
||||
this->afterUpgradeCallback(request, this->firmwareResult, this->filesystemResult);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
this->filesystemResult.error.clear();
|
||||
}
|
||||
|
||||
void handleUpload(AsyncWebServerRequest *request, const String &fileName, size_t index, uint8_t *data, size_t dataLength, bool isFinal) final {
|
||||
void handleUpload(AsyncWebServerRequest *request, const String &fileName, size_t index, uint8_t *data, size_t dataLength, bool isFinal) override final {
|
||||
UpgradeResult* result = nullptr;
|
||||
|
||||
if (!request->hasParam(asyncsrv::T_name, true, true)) {
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool isRequestHandlerTrivial() const final {
|
||||
bool isRequestHandlerTrivial() const override final {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -35,9 +35,9 @@ namespace CrashRecorder {
|
||||
} ext_t;
|
||||
|
||||
|
||||
__NOINIT_ATTR volatile static backtrace_t backtrace; // NOLINT
|
||||
__NOINIT_ATTR volatile static epc_t epc; // NOLINT
|
||||
__NOINIT_ATTR volatile static ext_t ext; // NOLINT
|
||||
__NOINIT_ATTR volatile static backtrace_t backtrace;
|
||||
__NOINIT_ATTR volatile static epc_t epc;
|
||||
__NOINIT_ATTR volatile static ext_t ext;
|
||||
|
||||
uint8_t backtraceMaxLength = sizeof(backtrace.data) / sizeof(*backtrace.data);
|
||||
uint8_t epcMaxLength = sizeof(epc.data) / sizeof(*epc.data);
|
||||
@@ -98,7 +98,7 @@ extern "C" void custom_crash_callback(struct rst_info *info, uint32_t stack, uin
|
||||
CrashRecorder::backtrace.continues = false;
|
||||
uint32_t value;
|
||||
for (uint32_t i = stack; i < stack_end; i += 4) {
|
||||
value = *((uint32_t*) i); // NOLINT
|
||||
value = *((uint32_t*) i);
|
||||
|
||||
// keep only addresses in code area
|
||||
if ((value >= 0x40000000) && (value < 0x40300000)) {
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ extern FileData fsNetworkSettings, fsSettings, fsSensorsSettings;
|
||||
|
||||
class MainTask : public Task {
|
||||
public:
|
||||
explicit MainTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {
|
||||
MainTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {
|
||||
this->blinker = new Blinker();
|
||||
|
||||
network->setDelayCallback([this](unsigned int time) {
|
||||
@@ -253,7 +253,7 @@ protected:
|
||||
|
||||
if (availableSensors) {
|
||||
if (vars.master.heating.freezing) {
|
||||
if (lowTemp - static_cast<float>(settings.heating.freezeProtection.highTemp) + 0.0001f >= 0.0f) {
|
||||
if (lowTemp - (float) settings.heating.freezeProtection.highTemp + 0.0001f >= 0.0f) {
|
||||
vars.master.heating.freezing = false;
|
||||
|
||||
Log.sinfoln(
|
||||
@@ -264,7 +264,7 @@ protected:
|
||||
}
|
||||
|
||||
} else {
|
||||
if (static_cast<float>(settings.heating.freezeProtection.lowTemp) - lowTemp + 0.0001f >= 0.0f) {
|
||||
if ((float) settings.heating.freezeProtection.lowTemp - lowTemp + 0.0001f >= 0.0f) {
|
||||
vars.master.heating.freezing = true;
|
||||
|
||||
if (!settings.heating.enabled) {
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ extern FileData fsSettings;
|
||||
|
||||
class MqttTask : public Task {
|
||||
public:
|
||||
explicit MqttTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {
|
||||
MqttTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {
|
||||
this->wifiClient = new MqttWiFiClient();
|
||||
this->client = new MqttClient(this->wifiClient);
|
||||
this->writer = new MqttWriter(this->client, 256);
|
||||
@@ -443,7 +443,7 @@ protected:
|
||||
} else if (payload[i] == 10) {
|
||||
Log.print(F("\r\n> "));
|
||||
} else {
|
||||
Log.print(static_cast<char>(payload[i]));
|
||||
Log.print((char) payload[i]);
|
||||
}
|
||||
}
|
||||
Log.print(F("\r\n\n"));
|
||||
|
||||
+7
-7
@@ -3,7 +3,7 @@ extern FileData fsSettings;
|
||||
|
||||
class OpenThermTask : public Task {
|
||||
public:
|
||||
explicit OpenThermTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {}
|
||||
OpenThermTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {}
|
||||
|
||||
~OpenThermTask() {
|
||||
delete this->instance;
|
||||
@@ -1401,7 +1401,7 @@ protected:
|
||||
);
|
||||
|
||||
if (vars.master.heating.overheat) {
|
||||
if (static_cast<float>(settings.heating.overheatProtection.lowTemp) - highTemp + 0.0001f >= 0.0f) {
|
||||
if ((float) settings.heating.overheatProtection.lowTemp - highTemp + 0.0001f >= 0.0f) {
|
||||
vars.master.heating.overheat = false;
|
||||
|
||||
Log.sinfoln(
|
||||
@@ -1411,7 +1411,7 @@ protected:
|
||||
}
|
||||
|
||||
} else if (vars.slave.heating.active) {
|
||||
if (highTemp - static_cast<float>(settings.heating.overheatProtection.highTemp) + 0.0001f >= 0.0f) {
|
||||
if (highTemp - (float) settings.heating.overheatProtection.highTemp + 0.0001f >= 0.0f) {
|
||||
vars.master.heating.overheat = true;
|
||||
|
||||
Log.swarningln(
|
||||
@@ -1441,7 +1441,7 @@ protected:
|
||||
);
|
||||
|
||||
if (vars.master.dhw.overheat) {
|
||||
if (static_cast<float>(settings.dhw.overheatProtection.lowTemp) - highTemp + 0.0001f >= 0.0f) {
|
||||
if ((float) settings.dhw.overheatProtection.lowTemp - highTemp + 0.0001f >= 0.0f) {
|
||||
vars.master.dhw.overheat = false;
|
||||
|
||||
Log.sinfoln(
|
||||
@@ -1451,7 +1451,7 @@ protected:
|
||||
}
|
||||
|
||||
} else if (vars.slave.dhw.active) {
|
||||
if (highTemp - static_cast<float>(settings.dhw.overheatProtection.highTemp) + 0.0001f >= 0.0f) {
|
||||
if (highTemp - (float) settings.dhw.overheatProtection.highTemp + 0.0001f >= 0.0f) {
|
||||
vars.master.dhw.overheat = true;
|
||||
|
||||
Log.swarningln(
|
||||
@@ -2432,7 +2432,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = CustomOpenTherm::getInt(response);
|
||||
const float value = (float) CustomOpenTherm::getInt(response);
|
||||
if (!isValidTemp(value, settings.opentherm.unitSystem, -40, 500)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2456,7 +2456,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = CustomOpenTherm::getInt(response);
|
||||
const float value = (float) CustomOpenTherm::getInt(response);
|
||||
if (value <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+3
-7
@@ -18,7 +18,7 @@ extern WebSerial* webSerial;
|
||||
|
||||
class PortalTask : public LeanTask {
|
||||
public:
|
||||
explicit PortalTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||
PortalTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||
this->webServer = new AsyncWebServer(80);
|
||||
this->dnsServer = new DNSServer();
|
||||
}
|
||||
@@ -810,13 +810,9 @@ protected:
|
||||
|
||||
static void getFilename(char* filename, size_t maxSizeFilename, const char* type) {
|
||||
const time_t now = time(nullptr);
|
||||
|
||||
tm localNow {};
|
||||
localtime_r(&now, &localNow);
|
||||
|
||||
const tm* localNow = localtime(&now);
|
||||
char localNowValue[20];
|
||||
strftime(localNowValue, sizeof(localNowValue), PSTR("%Y-%m-%d-%H-%M-%S"), &localNow);
|
||||
|
||||
strftime(localNowValue, sizeof(localNowValue), PSTR("%Y-%m-%d-%H-%M-%S"), localNow);
|
||||
snprintf_P(filename, maxSizeFilename, PSTR("%s_%s_%s.json"), networkSettings.hostname, localNowValue, type);
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -5,7 +5,7 @@ GyverPID pidRegulator(0, 0, 0);
|
||||
|
||||
class RegulatorTask : public LeanTask {
|
||||
public:
|
||||
explicit RegulatorTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {}
|
||||
RegulatorTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {}
|
||||
|
||||
protected:
|
||||
float prevHeatingTarget = 0.0f;
|
||||
|
||||
+5
-5
@@ -74,7 +74,7 @@ public:
|
||||
}
|
||||
|
||||
static bool parseAtcData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
||||
NimBLEUUID serviceUuid(static_cast<uint16_t>(0x181A));
|
||||
NimBLEUUID serviceUuid((uint16_t) 0x181A);
|
||||
|
||||
auto serviceData = device->getServiceData(serviceUuid);
|
||||
if (!serviceData.size()) {
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
}
|
||||
|
||||
static bool parsePvvxData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
||||
NimBLEUUID serviceUuid(static_cast<uint16_t>(0x181A));
|
||||
NimBLEUUID serviceUuid((uint16_t) 0x181A);
|
||||
|
||||
auto serviceData = device->getServiceData(serviceUuid);
|
||||
if (!serviceData.size()) {
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
}
|
||||
|
||||
static bool parseBTHomeData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
||||
NimBLEUUID serviceUuid(static_cast<uint16_t>(0xFCD2));
|
||||
NimBLEUUID serviceUuid((uint16_t) 0xFCD2);
|
||||
|
||||
auto serviceData = device->getServiceData(serviceUuid);
|
||||
if (!serviceData.size()) {
|
||||
@@ -304,7 +304,7 @@ public:
|
||||
|
||||
class SensorsTask : public LeanTask {
|
||||
public:
|
||||
explicit SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||
SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||
this->gpioLastPollingTime.reserve(2);
|
||||
|
||||
// OneWire
|
||||
@@ -830,7 +830,7 @@ protected:
|
||||
}
|
||||
|
||||
const float sensorResistance = value > 1
|
||||
? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / static_cast<float>(value) - 1.0f)
|
||||
? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / (float) value - 1.0f)
|
||||
: 0.0f;
|
||||
const float rawTemp = 1.0f / (
|
||||
1.0f / (DEFAULT_NTC_NOMINAL_TEMP + 273.15f) +
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef PROGMEM
|
||||
#define PROGMEM // NOLINT
|
||||
#define PROGMEM
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef PROGMEM
|
||||
#define PROGMEM // NOLINT
|
||||
#define PROGMEM
|
||||
#endif
|
||||
|
||||
const char L_SETTINGS[] PROGMEM = "SETTINGS";
|
||||
|
||||
+2
-2
@@ -139,7 +139,7 @@ inline bool isValidTemp(const float value, UnitSystem unit, const float min = 0.
|
||||
|
||||
float roundf(float value, uint8_t decimals = 2) {
|
||||
if (decimals == 0) {
|
||||
return static_cast<int>(value + 0.5f);
|
||||
return (int)(value + 0.5f);
|
||||
|
||||
} else if (abs(value) < 0.00000001f) {
|
||||
return 0.0f;
|
||||
@@ -147,7 +147,7 @@ float roundf(float value, uint8_t decimals = 2) {
|
||||
|
||||
float multiplier = pow10(decimals);
|
||||
value += 0.5f / multiplier * (value < 0.0f ? -1.0f : 1.0f);
|
||||
return static_cast<int>(value * multiplier) / multiplier;
|
||||
return (int)(value * multiplier) / multiplier;
|
||||
}
|
||||
|
||||
inline size_t getTotalHeap() {
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
"rpm": "RPM",
|
||||
"ppm": "ppm",
|
||||
"byte": "byte",
|
||||
"mbyte": "MB",
|
||||
"liter": "升",
|
||||
"gallon": "加仑"
|
||||
"mbyte": "MB"
|
||||
},
|
||||
"button": {
|
||||
"upgrade": "固件升级",
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
"rpm": "RPM",
|
||||
"ppm": "ppm",
|
||||
"byte": "byte",
|
||||
"mbyte": "MB",
|
||||
"liter": "L",
|
||||
"gallon": "gal"
|
||||
"mbyte": "MB"
|
||||
},
|
||||
"button": {
|
||||
"upgrade": "Upgrade",
|
||||
|
||||
@@ -1,523 +0,0 @@
|
||||
{
|
||||
"values": {
|
||||
"logo": "",
|
||||
"nav": {
|
||||
"license": "",
|
||||
"source": "",
|
||||
"help": "",
|
||||
"issues": "",
|
||||
"releases": ""
|
||||
},
|
||||
"units": {
|
||||
"days": "",
|
||||
"hours": "",
|
||||
"min": "",
|
||||
"sec": "",
|
||||
"dbm": "",
|
||||
"mhz": "",
|
||||
"kw": "",
|
||||
"rpm": "",
|
||||
"ppm": "",
|
||||
"byte": "",
|
||||
"mbyte": ""
|
||||
},
|
||||
"button": {
|
||||
"upgrade": "",
|
||||
"restart": "",
|
||||
"save": "",
|
||||
"saved": "",
|
||||
"refresh": "",
|
||||
"restore": "",
|
||||
"restored": "",
|
||||
"backup": "",
|
||||
"wait": "",
|
||||
"uploading": "",
|
||||
"success": "",
|
||||
"error": ""
|
||||
},
|
||||
"index": {
|
||||
"title": "",
|
||||
"section": {
|
||||
"network": "",
|
||||
"system": ""
|
||||
},
|
||||
"system": {
|
||||
"build": {
|
||||
"title": "",
|
||||
"version": "",
|
||||
"commit": "",
|
||||
"date": "",
|
||||
"core": "",
|
||||
"sdk": ""
|
||||
},
|
||||
"uptime": "",
|
||||
"memory": {
|
||||
"heap": "",
|
||||
"psram": "",
|
||||
"maxFreeBlock": "",
|
||||
"min": ""
|
||||
},
|
||||
"board": "",
|
||||
"chip": {
|
||||
"model": "",
|
||||
"cores": "",
|
||||
"freq": ""
|
||||
},
|
||||
"flash": {
|
||||
"size": "",
|
||||
"realSize": ""
|
||||
},
|
||||
"lastResetReason": ""
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"name": "",
|
||||
"title": "",
|
||||
"section": {
|
||||
"control": "",
|
||||
"states": "",
|
||||
"sensors": "",
|
||||
"diag": ""
|
||||
},
|
||||
"thermostat": {
|
||||
"heating": "",
|
||||
"dhw": "",
|
||||
"currentTemp": "",
|
||||
"enable": "",
|
||||
"turbo": ""
|
||||
},
|
||||
"notify": {
|
||||
"fault": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"diag": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"reset": ""
|
||||
},
|
||||
"states": {
|
||||
"mNetworkConnected": "",
|
||||
"mMqttConnected": "",
|
||||
"mEmergencyState": "",
|
||||
"mExtPumpState": "",
|
||||
"mCascadeControlInput": "",
|
||||
"mCascadeControlOutput": "",
|
||||
"sConnected": "",
|
||||
"sFlame": "",
|
||||
"sCoolingActive": "",
|
||||
"sCoolingSetpoint": "",
|
||||
"sFaultActive": "",
|
||||
"sFaultCode": "",
|
||||
"sDiagActive": "",
|
||||
"sDiagCode": "",
|
||||
"mHeatEnabled": "",
|
||||
"mHeatBlocking": "",
|
||||
"mHeatOverheat": "",
|
||||
"mHeatFreezing": "",
|
||||
"sHeatActive": "",
|
||||
"mHeatSetpointTemp": "",
|
||||
"mHeatTargetTemp": "",
|
||||
"mHeatCurrTemp": "",
|
||||
"mHeatRetTemp": "",
|
||||
"mHeatIndoorTemp": "",
|
||||
"mHeatOutdoorTemp": "",
|
||||
"mDhwEnabled": "",
|
||||
"mDhwOverheat": "",
|
||||
"sDhwActive": "",
|
||||
"mDhwTargetTemp": "",
|
||||
"mDhwCurrTemp": "",
|
||||
"mDhwRetTemp": ""
|
||||
},
|
||||
"sensors": {
|
||||
"values": {
|
||||
"temp": "",
|
||||
"humidity": "",
|
||||
"battery": "",
|
||||
"rssi": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"network": {
|
||||
"title": "",
|
||||
"name": "",
|
||||
"section": {
|
||||
"static": "",
|
||||
"availableNetworks": "",
|
||||
"staSettings": "",
|
||||
"apSettings": ""
|
||||
},
|
||||
"scan": {
|
||||
"pos": "",
|
||||
"info": ""
|
||||
},
|
||||
"wifi": {
|
||||
"ssid": "",
|
||||
"password": "",
|
||||
"channel": "",
|
||||
"signal": "",
|
||||
"connected": ""
|
||||
},
|
||||
"params": {
|
||||
"hostname": "",
|
||||
"dhcp": "",
|
||||
"mac": "",
|
||||
"ip": "",
|
||||
"subnet": "",
|
||||
"gateway": "",
|
||||
"dns": ""
|
||||
},
|
||||
"sta": {
|
||||
"channel": {
|
||||
"note": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"sensors": {
|
||||
"title": "",
|
||||
"name": "",
|
||||
"enabled": "",
|
||||
"sensorName": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"purpose": "",
|
||||
"purposes": {
|
||||
"outdoorTemp": "",
|
||||
"indoorTemp": "",
|
||||
"heatTemp": "",
|
||||
"heatRetTemp": "",
|
||||
"dhwTemp": "",
|
||||
"dhwRetTemp": "",
|
||||
"dhwFlowRate": "",
|
||||
"exhaustTemp": "",
|
||||
"modLevel": "",
|
||||
"number": "",
|
||||
"powerFactor": "",
|
||||
"power": "",
|
||||
"fanSpeed": "",
|
||||
"co2": "",
|
||||
"pressure": "",
|
||||
"humidity": "",
|
||||
"temperature": "",
|
||||
"notConfigured": ""
|
||||
},
|
||||
"type": "",
|
||||
"types": {
|
||||
"otOutdoorTemp": "",
|
||||
"otHeatTemp": "",
|
||||
"otHeatRetTemp": "",
|
||||
"otDhwTemp": "",
|
||||
"otDhwTemp2": "",
|
||||
"otDhwFlowRate": "",
|
||||
"otCh2Temp": "",
|
||||
"otExhaustTemp": "",
|
||||
"otHeatExchangerTemp": "",
|
||||
"otPressure": "",
|
||||
"otModLevel": "",
|
||||
"otCurrentPower": "",
|
||||
"otExhaustCo2": "",
|
||||
"otExhaustFanSpeed": "",
|
||||
"otSupplyFanSpeed": "",
|
||||
"otSolarStorageTemp": "",
|
||||
"otSolarCollectorTemp": "",
|
||||
"otFanSpeedSetpoint": "",
|
||||
"otFanSpeedCurrent": "",
|
||||
"otBurnerStarts": "",
|
||||
"otDhwBurnerStarts": "",
|
||||
"otHeatingPumpStarts": "",
|
||||
"otDhwPumpStarts": "",
|
||||
"otBurnerHours": "",
|
||||
"otDhwBurnerHours": "",
|
||||
"otHeatingPumpHours": "",
|
||||
"otDhwPumpHours": "",
|
||||
"otCoolingHours": "",
|
||||
"ntcTemp": "",
|
||||
"dallasTemp": "",
|
||||
"bluetooth": "",
|
||||
"dht11": "",
|
||||
"dht22": "",
|
||||
"heatSetpointTemp": "",
|
||||
"manual": "",
|
||||
"notConfigured": ""
|
||||
},
|
||||
"gpio": "",
|
||||
"address": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"correction": {
|
||||
"desc": "",
|
||||
"offset": "",
|
||||
"factor": ""
|
||||
},
|
||||
"filtering": {
|
||||
"desc": "",
|
||||
"enabled": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"factor": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"title": "",
|
||||
"name": "",
|
||||
"section": {
|
||||
"portal": "",
|
||||
"system": "",
|
||||
"diag": "",
|
||||
"heating": "",
|
||||
"dhw": "",
|
||||
"emergency": "",
|
||||
"equitherm": "",
|
||||
"pid": "",
|
||||
"ot": "",
|
||||
"mqtt": "",
|
||||
"extPump": "",
|
||||
"cascadeControl": ""
|
||||
},
|
||||
"enable": "",
|
||||
"note": {
|
||||
"restart": "",
|
||||
"blankNotUse": "",
|
||||
"bleDevice": ""
|
||||
},
|
||||
"temp": {
|
||||
"min": "",
|
||||
"max": ""
|
||||
},
|
||||
"avgType": {
|
||||
"mean": "",
|
||||
"min": "",
|
||||
"max": ""
|
||||
},
|
||||
"maxModulation": "",
|
||||
"ohProtection": {
|
||||
"title": "",
|
||||
"desc": "",
|
||||
"highTemp": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"lowTemp": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
}
|
||||
},
|
||||
"freezeProtection": {
|
||||
"title": "",
|
||||
"desc": "",
|
||||
"highTemp": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"lowTemp": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
}
|
||||
},
|
||||
"portal": {
|
||||
"login": "",
|
||||
"password": "",
|
||||
"auth": "",
|
||||
"mdns": ""
|
||||
},
|
||||
"system": {
|
||||
"unit": "",
|
||||
"metric": "",
|
||||
"imperial": "",
|
||||
"statusLedGpio": "",
|
||||
"logLevel": "",
|
||||
"serial": {
|
||||
"enable": "",
|
||||
"baud": ""
|
||||
},
|
||||
"webSerial": {
|
||||
"enable": ""
|
||||
},
|
||||
"ntp": {
|
||||
"server": "",
|
||||
"timezone": "",
|
||||
"timezonePresets": ""
|
||||
}
|
||||
},
|
||||
"heating": {
|
||||
"hyst": {
|
||||
"title": "",
|
||||
"desc": "",
|
||||
"value": "",
|
||||
"action": {
|
||||
"title": "",
|
||||
"disableHeating": "",
|
||||
"set0target": ""
|
||||
}
|
||||
},
|
||||
"turboFactor": "",
|
||||
"indoorTempAvgType": {
|
||||
"title": "",
|
||||
"desc": ""
|
||||
},
|
||||
"outdoorTempAvgType": {
|
||||
"title": "",
|
||||
"desc": ""
|
||||
}
|
||||
},
|
||||
"emergency": {
|
||||
"desc": "",
|
||||
"target": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"treshold": ""
|
||||
},
|
||||
"equitherm": {
|
||||
"slope": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"exponent": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"shift": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"targetDiffFactor": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"chart": {
|
||||
"targetTemp": "",
|
||||
"setpointTemp": "",
|
||||
"outdoorTemp": ""
|
||||
}
|
||||
},
|
||||
"pid": {
|
||||
"p": "",
|
||||
"i": "",
|
||||
"d": "",
|
||||
"dt": "",
|
||||
"limits": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"deadband": {
|
||||
"title": "",
|
||||
"note": "",
|
||||
"p_multiplier": "",
|
||||
"i_multiplier": "",
|
||||
"d_multiplier": "",
|
||||
"thresholdHigh": "",
|
||||
"thresholdLow": ""
|
||||
}
|
||||
},
|
||||
"ot": {
|
||||
"advanced": "",
|
||||
"inGpio": "",
|
||||
"outGpio": "",
|
||||
"ledGpio": "",
|
||||
"memberId": "",
|
||||
"flags": "",
|
||||
"minPower": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"maxPower": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
},
|
||||
"options": {
|
||||
"title": "",
|
||||
"desc": "",
|
||||
"dhwSupport": "",
|
||||
"coolingSupport": "",
|
||||
"summerWinterMode": "",
|
||||
"heatingStateToSummerWinterMode": "",
|
||||
"ch2AlwaysEnabled": "",
|
||||
"heatingToCh2": "",
|
||||
"dhwToCh2": "",
|
||||
"dhwBlocking": "",
|
||||
"dhwStateAsDhwBlocking": "",
|
||||
"maxTempSyncWithTargetTemp": "",
|
||||
"getMinMaxTemp": "",
|
||||
"ignoreDiagState": "",
|
||||
"autoFaultReset": "",
|
||||
"autoDiagReset": "",
|
||||
"setDateAndTime": "",
|
||||
"immergasFix": "",
|
||||
"alwaysSendIndoorTemp": ""
|
||||
},
|
||||
"nativeOTC": {
|
||||
"title": "",
|
||||
"note": ""
|
||||
}
|
||||
},
|
||||
"mqtt": {
|
||||
"homeAssistantDiscovery": "",
|
||||
"server": "",
|
||||
"port": "",
|
||||
"user": "",
|
||||
"password": "",
|
||||
"prefix": "",
|
||||
"interval": ""
|
||||
},
|
||||
"extPump": {
|
||||
"use": "",
|
||||
"gpio": "",
|
||||
"invertState": "",
|
||||
"postCirculationTime": "",
|
||||
"antiStuckInterval": "",
|
||||
"antiStuckTime": ""
|
||||
},
|
||||
"cascadeControl": {
|
||||
"input": {
|
||||
"desc": "",
|
||||
"enable": "",
|
||||
"gpio": "",
|
||||
"invertState": "",
|
||||
"thresholdTime": ""
|
||||
},
|
||||
"output": {
|
||||
"desc": "",
|
||||
"enable": "",
|
||||
"gpio": "",
|
||||
"invertState": "",
|
||||
"thresholdTime": "",
|
||||
"events": {
|
||||
"desc": "",
|
||||
"onFault": "",
|
||||
"onLossConnection": "",
|
||||
"onEnabledHeating": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"upgrade": {
|
||||
"title": "",
|
||||
"name": "",
|
||||
"section": {
|
||||
"backupAndRestore": {
|
||||
"title": "",
|
||||
"desc": ""
|
||||
},
|
||||
"upgrade": {
|
||||
"title": "",
|
||||
"desc": ""
|
||||
}
|
||||
},
|
||||
"note": {
|
||||
"disclaimer1": "",
|
||||
"disclaimer2": ""
|
||||
},
|
||||
"settingsFile": "",
|
||||
"fw": "",
|
||||
"fs": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,7 @@
|
||||
"rpm": "RPM",
|
||||
"ppm": "ppm",
|
||||
"byte": "byte",
|
||||
"mbyte": "MB",
|
||||
"liter": "litro",
|
||||
"gallon": "gal"
|
||||
"mbyte": "MB"
|
||||
},
|
||||
"button": {
|
||||
"upgrade": "Aggiorna",
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
"rpm": "RPM",
|
||||
"ppm": "ppm",
|
||||
"byte": "byte",
|
||||
"mbyte": "MB",
|
||||
"liter": "L",
|
||||
"gallon": "gal"
|
||||
"mbyte": "MB"
|
||||
},
|
||||
"button": {
|
||||
"upgrade": "Upgraden",
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
"rpm": "RPM",
|
||||
"ppm": "ppm",
|
||||
"byte": "байт",
|
||||
"mbyte": "мбайт",
|
||||
"liter": "Л.",
|
||||
"gallon": "гал."
|
||||
"mbyte": "мбайт"
|
||||
},
|
||||
"button": {
|
||||
"upgrade": "Обновить",
|
||||
|
||||
@@ -351,14 +351,9 @@
|
||||
value = -(step);
|
||||
}
|
||||
|
||||
const newValue = parseFloat(constrain(newSettings[purpose].target + value, minTemp, maxTemp).toFixed(2));
|
||||
if (newSettings[purpose].target != newValue) {
|
||||
newSettings[purpose].target = newValue;
|
||||
newSettings[purpose].target = parseFloat(constrain(newSettings[purpose].target + value, minTemp, maxTemp).toFixed(2));
|
||||
modifiedTime = Date.now();
|
||||
|
||||
setValue('.targetTemp', newValue, tContainer);
|
||||
tContainer.querySelector('.thermostat-header').setAttribute("aria-busy", "true");
|
||||
}
|
||||
setValue('.targetTemp', newSettings[purpose].target, tContainer);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -388,46 +383,27 @@
|
||||
value = -(bigStep);
|
||||
}
|
||||
|
||||
const newValue = parseFloat(constrain(newSettings[purpose].target + value, minTemp, maxTemp).toFixed(2));
|
||||
if (newSettings[purpose].target != newValue) {
|
||||
newSettings[purpose].target = newValue;
|
||||
newSettings[purpose].target = parseFloat(constrain(newSettings[purpose].target + value, minTemp, maxTemp).toFixed(2));
|
||||
modifiedTime = Date.now();
|
||||
|
||||
setValue('.targetTemp', newSettings[purpose].target, tContainer);
|
||||
tContainer.querySelector('.thermostat-header').setAttribute("aria-busy", "true");
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector('#tHeatEnabled').addEventListener('change', (event) => {
|
||||
if (newSettings.heating.enabled == event.currentTarget.checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
modifiedTime = Date.now();
|
||||
newSettings.heating.enabled = event.currentTarget.checked;
|
||||
document.querySelector('.tHeat .thermostat-header').setAttribute("aria-busy", "true");
|
||||
});
|
||||
|
||||
document.querySelector('#tHeatTurbo').addEventListener('change', (event) => {
|
||||
if (newSettings.heating.turbo == event.currentTarget.checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
modifiedTime = Date.now();
|
||||
newSettings.heating.turbo = event.currentTarget.checked;
|
||||
document.querySelector('.tHeat .thermostat-header').setAttribute("aria-busy", "true");
|
||||
});
|
||||
|
||||
document.querySelector('#tDhwEnabled').addEventListener('change', (event) => {
|
||||
if (newSettings.dhw.enabled == event.currentTarget.checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
modifiedTime = Date.now();
|
||||
newSettings.dhw.enabled = event.currentTarget.checked;
|
||||
document.querySelector('.tDhw .thermostat-header').setAttribute("aria-busy", "true");
|
||||
});
|
||||
|
||||
document.querySelector('.notify-fault .reset').addEventListener('click', async (event) => {
|
||||
@@ -555,10 +531,6 @@
|
||||
setValue('.pressureUnit', pressureUnit(unitSystem));
|
||||
setValue('.volumeUnit', volumeUnit(unitSystem));
|
||||
|
||||
document.querySelectorAll('.thermostat-header').forEach((item) => {
|
||||
item.setAttribute("aria-busy", "false");
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ const setupRestoreBackupForm = (formSelector) => {
|
||||
console.log("Backup: ", data);
|
||||
|
||||
if (data.settings != undefined) {
|
||||
for (const key in data.settings) {
|
||||
for (var key in data.settings) {
|
||||
let response = await fetch(url, {
|
||||
method: "POST",
|
||||
cache: "no-cache",
|
||||
@@ -338,41 +338,6 @@ const setupRestoreBackupForm = (formSelector) => {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let finalPayload = {};
|
||||
if (data.settings.emergency?.target !== undefined) {
|
||||
finalPayload.emergency ??= {};
|
||||
finalPayload.emergency.target = data.settings.emergency.target;
|
||||
}
|
||||
|
||||
if (data.settings.heating?.target !== undefined) {
|
||||
finalPayload.heating ??= {};
|
||||
finalPayload.heating.target = data.settings.heating.target;
|
||||
}
|
||||
|
||||
if (data.settings.dhw?.target !== undefined) {
|
||||
finalPayload.dhw ??= {};
|
||||
finalPayload.dhw.target = data.settings.dhw.target;
|
||||
}
|
||||
|
||||
if (Object.keys(finalPayload).length) {
|
||||
let response = await fetch(url, {
|
||||
method: "POST",
|
||||
cache: "no-cache",
|
||||
credentials: "include",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"settings": finalPayload
|
||||
})
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
onFailed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.sensors != undefined) {
|
||||
@@ -800,8 +765,8 @@ const pressureUnit = (unitSystem) => {
|
||||
|
||||
const volumeUnit = (unitSystem) => {
|
||||
return unit2str(unitSystem, {
|
||||
0: i18n('units.liter'),
|
||||
1: i18n('units.gallon')
|
||||
0: "L",
|
||||
1: "gal"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -815,7 +780,7 @@ const purposeUnit = (purpose, unitSystem) => {
|
||||
3: tUnit,
|
||||
4: tUnit,
|
||||
5: tUnit,
|
||||
6: `${volumeUnit(unitSystem)}/${i18n('units.min')}`,
|
||||
6: `${volumeUnit(unitSystem)}/${i18n('time.min')}`,
|
||||
7: tUnit,
|
||||
8: "%",
|
||||
248: "%",
|
||||
|
||||
Reference in New Issue
Block a user