summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}
}