Fixed multiplier issue

This commit is contained in:
Ziver Koc 2016-06-10 21:50:59 +02:00
parent 26c909ac8d
commit d04706f9d1
3 changed files with 6 additions and 8 deletions

View file

@ -1,14 +1,14 @@
#ifndef HALCONFIGURATION_H #ifndef HALCONFIGURATION_H
#define HALCONFIGURATION_H #define HALCONFIGURATION_H
#define ENABLE_DEBUG // comment out to disable debug //#define ENABLE_DEBUG // comment out to disable debug
#define TIMER_MILLISECOND 60*1000 // poling in minutes #define TIMER_MILLISECOND 60*1000 // poling in minutes
#define INDICATOR_PIN 13 // diode #define INDICATOR_PIN 13 // diode
// POWER CONSUMPTION SENSOR // POWER CONSUMPTION SENSOR
#define POWERCON_ENABLED // comment out to disable sensor //#define POWERCON_ENABLED // comment out to disable sensor
#define POWERCON_SENSOR SensorPhotocell() #define POWERCON_SENSOR SensorPhotocell()
#define POWERCON_PROTOCOL ProtocolOregon(11, 186) #define POWERCON_PROTOCOL ProtocolOregon(11, 186)
#define POWER_TIMER_MULTIPLIER 1 #define POWER_TIMER_MULTIPLIER 1

View file

@ -80,11 +80,10 @@ void timerInterruptFunc()
void loop() void loop()
{ {
digitalWrite(INDICATOR_PIN, HIGH); digitalWrite(INDICATOR_PIN, HIGH);
//noInterrupts();
// Send power consumption // Send power consumption
#ifdef POWERCON_ENABLED #ifdef POWERCON_ENABLED
if(timerMultiplier == POWER_TIMER_MULTIPLIER) if(timerMultiplier % POWER_TIMER_MULTIPLIER == 0)
{ {
static PowerData powerData; static PowerData powerData;
powerSensor->read(powerData); // not needed, only here for future use powerSensor->read(powerData); // not needed, only here for future use
@ -95,7 +94,7 @@ void loop()
// Handle temperature sensor // Handle temperature sensor
#ifdef TEMPERATURE_ENABLED #ifdef TEMPERATURE_ENABLED
if(timerMultiplier == TEMPERATURE_TIMER_MULTIPLIER) if(timerMultiplier % TEMPERATURE_TIMER_MULTIPLIER == 0)
{ {
static TemperatureData tempData; static TemperatureData tempData;
tempSensor->read(tempData); tempSensor->read(tempData);
@ -106,7 +105,7 @@ void loop()
// Handle light sensor // Handle light sensor
#ifdef LIGHT_ENABLED #ifdef LIGHT_ENABLED
if(timerMultiplier == LIGHT_TIMER_MULTIPLIER) if(timerMultiplier % LIGHT_TIMER_MULTIPLIER == 0)
{ {
static LightData lightData; static LightData lightData;
lightSensor->read(lightData); lightSensor->read(lightData);
@ -115,7 +114,6 @@ void loop()
} }
#endif #endif
//interrupts();
digitalWrite(INDICATOR_PIN, LOW); digitalWrite(INDICATOR_PIN, LOW);
DEBUG("Sleeping"); DEBUG("Sleeping");

View file

@ -90,7 +90,7 @@ void Interrupt::handleWatchDogInterrupt()
wdt_disable(); wdt_disable();
if (wdtTime <= 0) if (wdtTime <= 0)
return; return;
DEBUGF("WDT interrupt, time=%d, timeLeft=%d", wdtTime, wdtTimeLeft); DEBUGF("WDT interrupt, time=%u, timeLeft=%ld", wdtTime, wdtTimeLeft);
if (wdtTimeLeft <= 0) if (wdtTimeLeft <= 0)
{ {