summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Baumann <derflob@derflob.de>2015-12-27 16:50:27 +0100
committerFlorian Baumann <derflob@derflob.de>2015-12-27 16:50:27 +0100
commitdd7572ab29bc0752b08e323b89d7ab1de65b4d99 (patch)
tree9437cbe7609b653c6c66528d984f56475d604335
parent5686edf6874ecdde11fdede1606d69b2ba2bacd3 (diff)
downloadmFeTAp-master.tar.gz
mFeTAp-master.tar.bz2
delay incoming calls for 3sHEADmaster
-rw-r--r--mFeTAp.ino20
1 files changed, 11 insertions, 9 deletions
diff --git a/mFeTAp.ino b/mFeTAp.ino
index 4e5fd76..dedca92 100644
--- a/mFeTAp.ino
+++ b/mFeTAp.ino
@@ -43,6 +43,8 @@ Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
#define SMS_UNIT_LEN 150
#define SMS_READ_DELAY 1500
+#define INCOMING_DELAY 3000
+
volatile int digit = 0;
volatile int digit_dialed = 0;
volatile int digit_dialing = 0;
@@ -122,27 +124,27 @@ void loop() {
void process_input_RI() {
- static unsigned long pin_down = 0;
+ static unsigned long ri_down = 0;
switch (adv_state) {
case IDLE:
case FM:
if (digitalRead(PIN_INCOMING) == LOW) {
- if (pin_down == 0) {
- pin_down = millis();
+ if (ri_down == 0) {
+ ri_down = millis();
+ Serial.println("RI down");
} else {
- if (millis() - pin_down > SMS_SIGNAL) {
+ if (millis() - ri_down > INCOMING_DELAY) {
Serial.println("INCOMING: Incoming");
adv_state = INCOMING;
}
}
} else {
- if (pin_down > 0 && millis() - pin_down < SMS_SIGNAL) {
+ if (ri_down > 0 && millis() - ri_down < SMS_SIGNAL) {
Serial.println("SMS incoming");
sms_available = millis();
- // handle SMS
- pin_down = 0;
}
+ ri_down = 0;
}
break;
@@ -150,12 +152,12 @@ void process_input_RI() {
if (digitalRead(PIN_INCOMING) == HIGH) {
Serial.println("Idle: Left unanswered");
adv_state = IDLE;
- pin_down = 0;
+ ri_down = 0;
}
break;
default:
- pin_down = 0;
+ ri_down = 0;
break;
}
}