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