diff --git a/rfudp/TxTunnel.h b/rfudp/TxTunnel.h index 5acd3db..275a706 100644 --- a/rfudp/TxTunnel.h +++ b/rfudp/TxTunnel.h @@ -32,17 +32,18 @@ // various functions and definitions #define eprintf(...) fprintf(stderr, __VA_ARGS__); -#define FALSE (1 != 1) -#define TRUE (!FALSE) +#define FALSE (1 != 1) +#define TRUE (!FALSE) // TxTunnel Congif #define SERVER_IP "192.168.1.149" #define SERVER_PORT 8080 #define MAX_MSG_SZ 32 -#define RF_CHANNEL 0 +#define RF_CHANNEL 0 +#define MILLIS_WAIT 200 -#define ACK_MODE FALSE +#define ACK_MODE FALSE // Radio pipe addresses for the 2 nodes to communicate. const uint8_t addresses[][5] = {"2RPi","0RPi"}; diff --git a/rfudp/TxTunnelSender.cpp b/rfudp/TxTunnelSender.cpp index 0795019..7f080e6 100644 --- a/rfudp/TxTunnelSender.cpp +++ b/rfudp/TxTunnelSender.cpp @@ -6,10 +6,10 @@ TMRh20 2014 version 2 as published by the Free Software Foundation. */ -/** General Data Transfer Rate Test - * This example demonstrates basic data transfer functionality with the - updated library. This example will display the transfer rates acheived using - the slower form of high-speed transfer using blocking-writes. +/** TxTunnelSender + * This programm acts as a middle layer between clients and a nRF24 antenna. + * It sends to the other node what it receive on the udp socket and answer the sender + * with whatever the node sends back. */ #include "TxTunnel.h" @@ -183,10 +183,10 @@ int main(int argc, char** argv){ loop_start = millis(); radio.startListening(); - while ( !radio.available() && (millis() - loop_start) < 200) { + while ( !radio.available() && (millis() - loop_start) < MILLIS_WAIT) { // wait till receive or timeout } - if (millis() - loop_start >= 100) { + if (millis() - loop_start >= MILLIS_WAIT) { eprintf("Not Response.\n\r"); strcpy(buffer,"TxERR\0"); n=strlen(buffer);