From c2b34a3bb757ab4f36125eff112fe78991f99f78 Mon Sep 17 00:00:00 2001 From: TrystanLea Date: Fri, 5 Feb 2021 14:55:12 +0000 Subject: [PATCH] support for multiple external temperature sensors --- firmware/src/src.ino | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/firmware/src/src.ino b/firmware/src/src.ino index ba02b5a..5abc7c8 100644 --- a/firmware/src/src.ino +++ b/firmware/src/src.ino @@ -62,6 +62,8 @@ units = C,C,%,V,p */ // ------------------------------------------------------------------------------------------------------------- +#define EXTERNAL_TEMP_SENSORS 1 // Specify number of external temperature sensors that are connected + boolean debug=1; // Set to 1 to few debug serial output boolean flash_led=0; // Flash LED after each sample (battery drain) default=0 @@ -122,7 +124,7 @@ boolean DS18B20; // create // https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md typedef struct { // RFM RF payload datastructure int temp; - int temp_external; + int temp_external[EXTERNAL_TEMP_SENSORS]; int humidity; int battery; unsigned long pulsecount; @@ -376,12 +378,14 @@ void loop() for(int j=0;j-40.0)) - { - emonth.temp_external=(temp*10); + + for(int j=0;j-40.0)) { + emonth.temp_external[j]=(temp*10); + } } + digitalWrite(DS18B20_PWR, LOW); } emonth.battery=int(analogRead(BATT_ADC)*0.0322); //read battery voltage, convert ADC to volts x10 @@ -435,7 +439,9 @@ void loop() Serial.print("temp:");Serial.print(emonth.temp); Serial.print(","); if (DS18B20){ - Serial.print("tempex:");Serial.print(emonth.temp_external); Serial.print(","); + for(int j=0;j