From f5c10c1a50aed97aa3c6e03516a6e77c1423d29d Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Sat, 24 Aug 2024 21:22:43 +0200 Subject: [PATCH] Send price config to cloud --- lib/CloudConnector/include/CloudConnector.h | 2 +- lib/CloudConnector/src/CloudConnector.cpp | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/CloudConnector/include/CloudConnector.h b/lib/CloudConnector/include/CloudConnector.h index 964e27f7..fcc15128 100644 --- a/lib/CloudConnector/include/CloudConnector.h +++ b/lib/CloudConnector/include/CloudConnector.h @@ -37,7 +37,7 @@ #warning "Unsupported board type" #endif -#define CC_BUF_SIZE 2048 +#define CC_BUF_SIZE 4096 static const char CC_JSON_POWER[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu}"; static const char CC_JSON_POWER_LIST3[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu,\"tP\":%.3f,\"tQ\":%.3f}"; diff --git a/lib/CloudConnector/src/CloudConnector.cpp b/lib/CloudConnector/src/CloudConnector.cpp index ee2a93b0..dc83e92f 100644 --- a/lib/CloudConnector/src/CloudConnector.cpp +++ b/lib/CloudConnector/src/CloudConnector.cpp @@ -257,7 +257,6 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { dns1.toString().c_str(), dns2.toString().c_str() ); - sendData = pos > CC_BUF_SIZE - 768; } else if(lastPriceConfig == 0) { pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"price\":{\"area\":\"%s\",\"currency\":\"%s\",\"modifiers\":["), priceConfig.area, priceConfig.currency); if(ps != NULL) { @@ -314,7 +313,7 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { } pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("]}")); lastPriceConfig = now; - sendData = pos > CC_BUF_SIZE - 768; + sendData = false; } else if(lastEac == 0) { pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"accounting\":{\"hours\":%d,\"thresholds\":[%d,%d,%d,%d,%d,%d,%d,%d,%d]}"), eac.hours, @@ -329,7 +328,6 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { eac.thresholds[8] ); lastEac = now; - sendData = pos > CC_BUF_SIZE - 768; } if(sendData) {