mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-26 20:23:41 +00:00
Only show temp if sensor is attached. Added common functions to get temp and vcc
This commit is contained in:
@@ -153,10 +153,7 @@ void AmsWebServer::indexHtml() {
|
||||
html.replace("${data.tQO}", tpi > 0 ? String(tqo, 1) : "");
|
||||
html.replace("${display.accumulative}", tpi > 0 ? "" : "none");
|
||||
|
||||
double vcc = 0;
|
||||
#if defined(ESP8266)
|
||||
vcc = ((double) ESP.getVcc()) / 1000;
|
||||
#endif
|
||||
double vcc = hw.getVcc();
|
||||
html.replace("${vcc}", vcc > 0 ? String(vcc, 2) : "");
|
||||
|
||||
float rssi = WiFi.RSSI();
|
||||
@@ -321,12 +318,8 @@ void AmsWebServer::dataJson() {
|
||||
json["maxPower"] = maxPwr;
|
||||
json["meterType"] = config->getMeterType();
|
||||
json["currentMillis"] = now;
|
||||
|
||||
double vcc = 0;
|
||||
#if defined(ESP8266)
|
||||
vcc = ((double) ESP.getVcc()) / 1000;
|
||||
#endif
|
||||
json["vcc"] = vcc;
|
||||
double vcc = hw.getVcc();
|
||||
json["vcc"] = vcc > 0 ? vcc : 0;
|
||||
|
||||
json.createNestedObject("wifi");
|
||||
float rssi = WiFi.RSSI();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <ArduinoJson.h>
|
||||
#include <MQTT.h>
|
||||
#include "AmsConfiguration.h"
|
||||
#include "HwTools.h"
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
@@ -28,6 +29,7 @@ public:
|
||||
void setJson(StaticJsonDocument<1024> json);
|
||||
|
||||
private:
|
||||
HwTools hw;
|
||||
AmsConfiguration* config;
|
||||
Stream* debugger;
|
||||
MQTTClient* mqtt;
|
||||
|
||||
Reference in New Issue
Block a user