From c2b34a3bb757ab4f36125eff112fe78991f99f78 Mon Sep 17 00:00:00 2001 From: TrystanLea Date: Fri, 5 Feb 2021 14:55:12 +0000 Subject: [PATCH 1/2] 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 Date: Mon, 20 Sep 2021 12:31:14 +0100 Subject: [PATCH 2/2] update platformio --- firmware/platformio.ini | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/platformio.ini b/firmware/platformio.ini index 73eeecb..76d4339 100644 --- a/firmware/platformio.ini +++ b/firmware/platformio.ini @@ -21,19 +21,20 @@ env_default = emonth2 [common] +monitor_speed = 115200 +build_flags = -D BUILD_TAG=3.2.0 + # http://docs.platformio.org/en/stable/projectconf.html#lib-deps lib_deps_external = DallasTemperature @3.7.7 - JeeLib @c057b5f4c0 - Si7021 @c5ce0922ef -monitor_speed = 115200 - -build_flags = -D BUILD_TAG=3.2.0 + https://github.com/jcw/jeelib.git#f097c0039c926881d80a74bec7a7aa020de610ee + https://github.com/LowPowerLab/SI7021.git [env:emonth2] platform = atmelavr framework = arduino board = uno +build_flags = ${common.build_flags} lib_deps = ${common.lib_deps_external} monitor_speed = ${common.monitor_speed} @@ -54,3 +55,4 @@ framework = arduino board = uno lib_deps = ${common.lib_deps_external} build_flags = !echo '-DBUILD_TAG='$TRAVIS_TAG +monitor_speed = ${common.monitor_speed}