From 4f7057f7b313878f3c81c3986372aad147488890 Mon Sep 17 00:00:00 2001 From: LowPowerLab Date: Wed, 7 Aug 2013 21:44:23 -0400 Subject: [PATCH] Update Gateway.ino --- Examples/Gateway/Gateway.ino | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Examples/Gateway/Gateway.ino b/Examples/Gateway/Gateway.ino index 98d1d11..4563a8e 100644 --- a/Examples/Gateway/Gateway.ino +++ b/Examples/Gateway/Gateway.ino @@ -100,10 +100,10 @@ void loop() { { Serial.print(" Pinging node "); Serial.print(theNodeID); - delay(5); - radio.send(theNodeID, "ACK TEST", 8, true); Serial.print(" - ACK..."); - if (waitForAck(theNodeID)) Serial.print("ok!"); + delay(3); //need this when sending right after reception .. ? + if (radio.sendWithRetry(theNodeID, "ACK TEST", 8, 0)) // 0 = only 1 attempt, no retries + Serial.print("ok!"); else Serial.print("nothing"); } @@ -113,20 +113,10 @@ void loop() { } } -// wait a few milliseconds for proper ACK to me, return true if indeed received -static bool waitForAck(byte theNodeID) { - long now = millis(); - while (millis() - now <= ACK_TIME) { - if (radio.ACKReceived(theNodeID)) - return true; - } - return false; -} - void Blink(byte PIN, int DELAY_MS) { pinMode(PIN, OUTPUT); digitalWrite(PIN,HIGH); delay(DELAY_MS); digitalWrite(PIN,LOW); -} \ No newline at end of file +}