change order of command to avoid off-on

This commit is contained in:
Nicu Hodos 2016-11-22 17:50:36 +01:00
parent 4e72a3da3e
commit 4851f7355b

View File

@ -2,17 +2,12 @@
#include <avr/power.h> #include <avr/power.h>
#include <avr/wdt.h> #include <avr/wdt.h>
#include <RCSwitch.h>
#include <SoftwareSerial_Tiny.h>
#define DEBUG 0 #define DEBUG 0
#define RC_SWITCH 1 #define RC_SWITCH 1
#if RC_SWITCH
#include <RCSwitch.h>
#endif
#if DEBUG
#include <SoftwareSerial_Tiny.h>
#endif
// Utility macros // Utility macros
#define adc_disable() (ADCSRA &= ~_BV(ADEN)) // disable ADC (before power-off) #define adc_disable() (ADCSRA &= ~_BV(ADEN)) // disable ADC (before power-off)
#define adc_enable() (ADCSRA |= _BV(ADEN)) // re-enable ADC #define adc_enable() (ADCSRA |= _BV(ADEN)) // re-enable ADC
@ -23,7 +18,7 @@
#if DEBUG #if DEBUG
#define RxD 0 #define RxD 0
#define TxD 1 #define TxD 4
SoftwareSerial AttinySerial(RxD,TxD); SoftwareSerial AttinySerial(RxD,TxD);
#endif #endif
@ -92,9 +87,9 @@ ISR(PCINT0_vect) {
} }
ISR(WDT_vect) { ISR(WDT_vect) {
timerTriggered = true;
debug("wdt"); debug("wdt");
sendCommand(false); sendCommand(false);
timerTriggered = true;
disableWdt(); disableWdt();
} }