From 4851f7355b5af0ff171a6ae0654b93ac3cc1f6ef Mon Sep 17 00:00:00 2001 From: Nicolae Hodos Date: Tue, 22 Nov 2016 17:50:36 +0100 Subject: [PATCH] change order of command to avoid off-on --- lamp_switch/lamp_switch.ino | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lamp_switch/lamp_switch.ino b/lamp_switch/lamp_switch.ino index 2fb08cf..45d9b19 100644 --- a/lamp_switch/lamp_switch.ino +++ b/lamp_switch/lamp_switch.ino @@ -2,17 +2,12 @@ #include #include +#include +#include + #define DEBUG 0 #define RC_SWITCH 1 -#if RC_SWITCH -#include -#endif - -#if DEBUG -#include -#endif - // Utility macros #define adc_disable() (ADCSRA &= ~_BV(ADEN)) // disable ADC (before power-off) #define adc_enable() (ADCSRA |= _BV(ADEN)) // re-enable ADC @@ -23,7 +18,7 @@ #if DEBUG #define RxD 0 -#define TxD 1 +#define TxD 4 SoftwareSerial AttinySerial(RxD,TxD); #endif @@ -92,9 +87,9 @@ ISR(PCINT0_vect) { } ISR(WDT_vect) { + timerTriggered = true; debug("wdt"); sendCommand(false); - timerTriggered = true; disableWdt(); }