mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-04-14 08:29:12 +00:00
Some cleanup
This commit is contained in:
@@ -13,7 +13,6 @@ static const char HEADER_LOCATION[] PROGMEM = "Location";
|
||||
|
||||
static const char CACHE_CONTROL_NO_CACHE[] PROGMEM = "no-cache, no-store, must-revalidate";
|
||||
static const char CONTENT_ENCODING_GZIP[] PROGMEM = "gzip";
|
||||
static const char CACHE_1HR[] PROGMEM = "public, max-age=3600";
|
||||
static const char CACHE_1DA[] PROGMEM = "public, max-age=86400";
|
||||
static const char CACHE_1MO[] PROGMEM = "public, max-age=2630000";
|
||||
static const char CACHE_1YR[] PROGMEM = "public, max-age=31536000";
|
||||
|
||||
@@ -33,7 +33,11 @@
|
||||
#include <HTTPClient.h>
|
||||
#include <HTTPUpdate.h>
|
||||
#include <ESP32SSDP.h>
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#warning "Cloud disabled"
|
||||
#else
|
||||
#include "CloudConnector.h"
|
||||
#endif
|
||||
#else
|
||||
#warning "Unsupported board type"
|
||||
#endif
|
||||
@@ -45,7 +49,7 @@ public:
|
||||
AmsWebServer(uint8_t* buf, RemoteDebug* Debug, HwTools* hw, ResetDataContainer* rdc);
|
||||
void setup(AmsConfiguration*, GpioConfig*, AmsData*, AmsDataStorage*, EnergyAccounting*, RealtimePlot*);
|
||||
void loop();
|
||||
#if defined(ESP32)
|
||||
#if defined(_CLOUDCONNECTOR_H)
|
||||
void setCloud(CloudConnector* cloud);
|
||||
#endif
|
||||
void setTimezone(Timezone* tz);
|
||||
@@ -76,7 +80,7 @@ private:
|
||||
RealtimePlot* rtp = NULL;
|
||||
AmsMqttHandler* mqttHandler = NULL;
|
||||
ConnectionHandler* ch = NULL;
|
||||
#if defined(ESP32)
|
||||
#if defined(_CLOUDCONNECTOR_H)
|
||||
CloudConnector* cloud = NULL;
|
||||
#endif
|
||||
bool uploading = false;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"d": %d,
|
||||
"v": %.2f
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"i" : %d,
|
||||
"a" : "%s",
|
||||
"n" : "%s",
|
||||
"c" : %d,
|
||||
"v" : %.1f
|
||||
},
|
||||
@@ -15,11 +15,9 @@
|
||||
#include "html/index_js.h"
|
||||
#include "html/favicon_svg.h"
|
||||
#include "html/data_json.h"
|
||||
#include "html/tempsensor_json.h"
|
||||
#include "html/response_json.h"
|
||||
#include "html/sysinfo_json.h"
|
||||
#include "html/tariff_json.h"
|
||||
#include "html/peak_json.h"
|
||||
#include "html/conf_general_json.h"
|
||||
#include "html/conf_meter_json.h"
|
||||
#include "html/conf_wifi_json.h"
|
||||
@@ -168,7 +166,7 @@ void AmsWebServer::setup(AmsConfiguration* config, GpioConfig* gpioConfig, AmsDa
|
||||
mqttEnabled = strlen(mqttConfig.host) > 0;
|
||||
}
|
||||
|
||||
#if defined(ESP32)
|
||||
#if defined(_CLOUDCONNECTOR_H)
|
||||
void AmsWebServer::setCloud(CloudConnector* cloud) {
|
||||
this->cloud = cloud;
|
||||
}
|
||||
@@ -705,7 +703,7 @@ void AmsWebServer::temperatureJson() {
|
||||
if(data == NULL) continue;
|
||||
|
||||
char* pos = buf+strlen(buf);
|
||||
snprintf_P(pos, 72, TEMPSENSOR_JSON,
|
||||
snprintf_P(pos, 72, PSTR("{\"i\":%d,\"a\":\"%s\",\"n\":\"%s\",\"c\":%d,\"v\":%.1f},"),
|
||||
i,
|
||||
toHex(data->address, 8).c_str(),
|
||||
"",
|
||||
@@ -1098,7 +1096,7 @@ void AmsWebServer::translationsJson() {
|
||||
void AmsWebServer::cloudkeyJson() {
|
||||
if(!checkSecurity(1))
|
||||
return;
|
||||
#if defined(ESP32)
|
||||
#if defined(_CLOUDCONNECTOR_H)
|
||||
if(cloud == NULL)
|
||||
notFound();
|
||||
|
||||
@@ -2004,7 +2002,7 @@ void AmsWebServer::tariffJson() {
|
||||
String peaks;
|
||||
for(uint8_t x = 0;x < min((uint8_t) 5, eac->hours); x++) {
|
||||
EnergyAccountingPeak peak = ea->getPeak(x+1);
|
||||
int len = snprintf_P(buf, BufferSize, PEAK_JSON,
|
||||
int len = snprintf_P(buf, BufferSize, PSTR("{\"d\":%d,\"v\":%.2f}"),
|
||||
peak.day,
|
||||
peak.value / 100.0
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user