mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-10 12:49:21 +00:00
Merge branch 'master' into dev-v2.1.0
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
AmsWebServer::AmsWebServer(RemoteDebug* Debug, HwTools* hw) {
|
||||
this->debugger = Debug;
|
||||
this->hw = hw;
|
||||
this->json = (char*) malloc(JsonSize);
|
||||
}
|
||||
|
||||
void AmsWebServer::setup(AmsConfiguration* config, GpioConfig* gpioConfig, MeterConfig* meterConfig, AmsData* meterState, AmsDataStorage* ds, EnergyAccounting* ea) {
|
||||
@@ -786,8 +787,7 @@ void AmsWebServer::dataJson() {
|
||||
if(eapi != NULL && strlen(eapi->getToken()) > 0)
|
||||
price = eapi->getValueForHour(0);
|
||||
|
||||
char json[512];
|
||||
snprintf_P(json, sizeof(json), DATA_JSON,
|
||||
snprintf_P(json, JsonSize, DATA_JSON,
|
||||
maxPwr == 0 ? meterState->isThreePhase() ? 20000 : 10000 : maxPwr,
|
||||
meterConfig->productionCapacity,
|
||||
meterConfig->mainFuse == 0 ? 32 : meterConfig->mainFuse,
|
||||
@@ -850,8 +850,7 @@ void AmsWebServer::dayplotJson() {
|
||||
if(ds == NULL) {
|
||||
notFound();
|
||||
} else {
|
||||
char json[384];
|
||||
snprintf_P(json, sizeof(json), DAYPLOT_JSON,
|
||||
snprintf_P(json, JsonSize, DAYPLOT_JSON,
|
||||
ds->getHour(0) / 1000.0,
|
||||
ds->getHour(1) / 1000.0,
|
||||
ds->getHour(2) / 1000.0,
|
||||
@@ -896,8 +895,7 @@ void AmsWebServer::monthplotJson() {
|
||||
if(ds == NULL) {
|
||||
notFound();
|
||||
} else {
|
||||
char json[512];
|
||||
snprintf_P(json, sizeof(json), MONTHPLOT_JSON,
|
||||
snprintf_P(json, JsonSize, MONTHPLOT_JSON,
|
||||
ds->getDay(1) / 1000.0,
|
||||
ds->getDay(2) / 1000.0,
|
||||
ds->getDay(3) / 1000.0,
|
||||
@@ -951,8 +949,7 @@ void AmsWebServer::energyPriceJson() {
|
||||
prices[i] = eapi == NULL ? ENTSOE_NO_VALUE : eapi->getValueForHour(i);
|
||||
}
|
||||
|
||||
char json[768];
|
||||
snprintf_P(json, sizeof(json), ENERGYPRICE_JSON,
|
||||
snprintf_P(json, JsonSize, ENERGYPRICE_JSON,
|
||||
eapi == NULL ? "" : eapi->getCurrency(),
|
||||
prices[0] == ENTSOE_NO_VALUE ? "null" : String(prices[0], 2).c_str(),
|
||||
prices[1] == ENTSOE_NO_VALUE ? "null" : String(prices[1], 2).c_str(),
|
||||
|
||||
@@ -58,6 +58,9 @@ private:
|
||||
File file;
|
||||
bool performRestart = false;
|
||||
|
||||
static const uint16_t JsonSize = 768;
|
||||
char* json;
|
||||
|
||||
#if defined(ESP8266)
|
||||
ESP8266WebServer server;
|
||||
#elif defined(ESP32) // ARDUINO_ARCH_ESP32
|
||||
|
||||
Reference in New Issue
Block a user