From 8526e5157dd5ca8d65fa01d52058fd165c1a1d0a Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Mon, 3 Dec 2018 22:28:05 +0100 Subject: [PATCH] fixed arduino timer issue --- arduino/HalMultiSensor/HalConfiguration.h | 11 ++++++----- arduino/HalMultiSensor/HalMultiSensor.ino | 9 +++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/arduino/HalMultiSensor/HalConfiguration.h b/arduino/HalMultiSensor/HalConfiguration.h index aaeec5ce..afab67fa 100755 --- a/arduino/HalMultiSensor/HalConfiguration.h +++ b/arduino/HalMultiSensor/HalConfiguration.h @@ -6,24 +6,25 @@ #define TIMER_MILLISECOND 60000 // poling in minutes #define INDICATOR_PIN 13 // diode -#define DEVICE_BASE_ID 98 +#define TX_PIN 11 +#define DEVICE_BASE_ID 99 // POWER CONSUMPTION SENSOR //#define POWERCON_ENABLED // comment out to disable sensor #define POWERCON_SENSOR SensorPhotocell() -#define POWERCON_PROTOCOL ProtocolOregon(11, DEVICE_BASE_ID + 1) +#define POWERCON_PROTOCOL ProtocolOregon(TX_PIN, DEVICE_BASE_ID + 0) #define POWER_TIMER_MULTIPLIER 1 // TEMPERATURE SENSOR #define TEMPERATURE_ENABLED // comment out to disable sensor -#define TEMPERATURE_SENSOR SensorDHT(DHT22, 10) -#define TEMPERATURE_PROTOCOL ProtocolOregon(11, DEVICE_BASE_ID + 2) +#define TEMPERATURE_SENSOR SensorDHT(DHT11, 10) +#define TEMPERATURE_PROTOCOL ProtocolOregon(TX_PIN, DEVICE_BASE_ID + 1) #define TEMPERATURE_TIMER_MULTIPLIER 10 // LIGHT SENSOR //#define LIGHT_ENABLED // comment out to disable sensor #define LIGHT_SENSOR SensorBH1750() -#define LIGHT_PROTOCOL ProtocolOregon(11, DEVICE_BASE_ID + 3) +#define LIGHT_PROTOCOL ProtocolOregon(TX_PIN, DEVICE_BASE_ID + 2) #define LIGHT_TIMER_MULTIPLIER 10 diff --git a/arduino/HalMultiSensor/HalMultiSensor.ino b/arduino/HalMultiSensor/HalMultiSensor.ino index c7bc6714..1748cc75 100755 --- a/arduino/HalMultiSensor/HalMultiSensor.ino +++ b/arduino/HalMultiSensor/HalMultiSensor.ino @@ -10,6 +10,15 @@ the data to a central location. #include "Interrupt.h" +#ifndef POWERCON_ENABLED + #define POWER_TIMER_MULTIPLIER 1 +#endif +#ifndef TEMPERATURE_ENABLED + #define TEMPERATURE_TIMER_MULTIPLIER 1 +#endif +#ifndef LIGHT_ENABLED + #define LIGHT_TIMER_MULTIPLIER 1 +#endif #define TIMER_MULTIPLIER_MAX \ POWER_TIMER_MULTIPLIER * TEMPERATURE_TIMER_MULTIPLIER * LIGHT_TIMER_MULTIPLIER unsigned int timerMultiplier = 0;