|
|
|
@ -27,7 +27,7 @@ String metrics;
|
|
|
|
|
bool heating;
|
|
|
|
|
float reqTemp = 21.5;
|
|
|
|
|
float offset = 0.25;
|
|
|
|
|
float correction[3] = {CORRECTION1, CORRECTION2, CORRECTION3};
|
|
|
|
|
float correction[6] = {CORRECTION1, CORRECTION2, CORRECTION3, CORRECTION4, CORRECTION5, CORRECTION6};
|
|
|
|
|
|
|
|
|
|
//=================================
|
|
|
|
|
|
|
|
|
@ -179,8 +179,8 @@ void readSensor() {
|
|
|
|
|
uint8_t ds18Count = sensor.getDS18Count();
|
|
|
|
|
float tempC[ds18Count];
|
|
|
|
|
float temperature[ds18Count];
|
|
|
|
|
float avgTemperature;
|
|
|
|
|
int savedTemperatures = 0;
|
|
|
|
|
avgTemperature = 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ds18Count; i++) {
|
|
|
|
|
tempC[i] = sensor.getTempCByIndex(i);
|
|
|
|
@ -193,13 +193,13 @@ void readSensor() {
|
|
|
|
|
|
|
|
|
|
avgTemperature = avgTemperature / savedTemperatures;
|
|
|
|
|
|
|
|
|
|
metrics = getMetricsVar(temperature, tempC);
|
|
|
|
|
metrics = getMetricsVar(ds18Count, temperature, tempC);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getMetricsVar(float temperature[], float tempC[]) {
|
|
|
|
|
String getMetricsVar(uint8_t ds18Count, float temperature[], float tempC[]) {
|
|
|
|
|
metrics = "temp{device=\"";
|
|
|
|
|
for (int i = 0; i < sizeof(temperature) - 1 ; i++) {
|
|
|
|
|
for (uint8_t i = 0; i < ds18Count; i++) {
|
|
|
|
|
if (i != 0) {
|
|
|
|
|
metrics += "\ntemp{device=\"";
|
|
|
|
|
}
|
|
|
|
@ -207,7 +207,7 @@ String getMetricsVar(float temperature[], float tempC[]) {
|
|
|
|
|
metrics += "\"} ";
|
|
|
|
|
metrics += temperature[i];
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < sizeof(tempC) - 1; i++) {
|
|
|
|
|
for (uint8_t i = 0; i < ds18Count; i++) {
|
|
|
|
|
metrics += "\nraw_temp{device=\"";
|
|
|
|
|
metrics += i;
|
|
|
|
|
metrics += "\"} ";
|
|
|
|
|