simplify flow - switch only on WDT
This commit is contained in:
parent
2f98b46929
commit
de51a74d03
@ -5,8 +5,8 @@
|
|||||||
#include <RCSwitch.h>
|
#include <RCSwitch.h>
|
||||||
#include <SoftwareSerial_Tiny.h>
|
#include <SoftwareSerial_Tiny.h>
|
||||||
|
|
||||||
#define DEBUG 1
|
#define DEBUG 0
|
||||||
#define RC_SWITCH 0
|
#define RC_SWITCH 1
|
||||||
|
|
||||||
// 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)
|
||||||
@ -35,7 +35,6 @@ void debug(const char* msg);
|
|||||||
char* group = "11111";
|
char* group = "11111";
|
||||||
int number = 4;
|
int number = 4;
|
||||||
bool stateOn = false;
|
bool stateOn = false;
|
||||||
bool timerTriggered = false;
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
@ -77,18 +76,10 @@ ISR(PCINT0_vect) {
|
|||||||
if (state == LOW) {
|
if (state == LOW) {
|
||||||
debug("state is low");
|
debug("state is low");
|
||||||
enableWdt();
|
enableWdt();
|
||||||
} else {
|
|
||||||
debug("state is high");
|
|
||||||
disableWdt();
|
|
||||||
if (!timerTriggered) {
|
|
||||||
sendCommand(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
timerTriggered = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ISR(WDT_vect) {
|
ISR(WDT_vect) {
|
||||||
timerTriggered = true;
|
|
||||||
debug("wdt");
|
debug("wdt");
|
||||||
byte state = digitalRead(SWITCH);
|
byte state = digitalRead(SWITCH);
|
||||||
if (state == LOW) {
|
if (state == LOW) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user