Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Examples/LED_Control_Gateway/LED_Control_Gateway.ino
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ void loop()
{
digitalWrite(LED,1);
Serial.print('[');Serial.print(radio.GetSender(), DEC);Serial.print("] ");
for (byte i = 0; i < *radio.DataLen; i++)
Serial.print((char)radio.Data[i]);
for (byte i = 0; i < radio.GetDataLen(); i++)
Serial.print((char)radio.GetData()[i]);

if (radio.ACKRequested())
{
Expand Down Expand Up @@ -140,9 +140,10 @@ void sendMessage()
// wait up to ACK_TIME for proper ACK, return true if received
static bool waitForAck() {
long now = millis();
while (millis() - now <= ACK_TIME)
do {
if (radio.ACKReceived(nodeId))
return true;
} while (millis() - now <= ACK_TIME);
return false;
}

Expand Down
14 changes: 7 additions & 7 deletions Examples/LED_Control_Node/LED_Control_Node.ino
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ void loop()
if (radio.CRCPass())
{
Serial.print('[');Serial.print(radio.GetSender(), DEC);Serial.print("] ");
for (byte i = 0; i < *radio.DataLen; i++)
Serial.print((char)radio.Data[i]);
for (byte i = 0; i < radio.GetDataLen(); i++)
Serial.print((char)radio.GetData()[i]);

Serial.print(" - ");
//check for a LED blink/pulse/stop request
if (*radio.DataLen == 3
&& (radio.Data[0]=='b' || radio.Data[0]=='p' || radio.Data[0]=='o')
&& radio.Data[1] == ':'
&& (radio.Data[2]=='s' || radio.Data[2]=='m' || radio.Data[2]=='f'))
handleRequest(radio.Data[0], radio.Data[2]);
if (radio.GetDataLen() == 3
&& (radio.GetData()[0]=='b' || radio.GetData()[0]=='p' || radio.GetData()[0]=='o')
&& radio.GetData()[1] == ':'
&& (radio.GetData()[2]=='s' || radio.GetData()[2]=='m' || radio.GetData()[2]=='f'))
handleRequest(radio.GetData()[0], radio.GetData()[2]);

if (radio.ACKRequested())
{
Expand Down
8 changes: 4 additions & 4 deletions Examples/RFM12B_Struct_gateway/RFM12B_Struct_gateway.ino
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ void loop() {
{
Serial.print('[');Serial.print(radio.GetSender(), DEC);Serial.print("] ");

if (*radio.DataLen != sizeof(Payload))
if (radio.GetDataLen() != sizeof(Payload))
Serial.print("Invalid payload received, not matching Payload struct!");
else
{
theData = *(Payload*)radio.Data; //assume radio.DATA actually contains our struct and not something else
theData = *(Payload*)radio.GetData(); //assume radio.DATA actually contains our struct and not something else
Serial.print(" nodeId=");
Serial.print(theData.nodeId);
Serial.print(" uptime=");
Expand Down Expand Up @@ -119,9 +119,9 @@ void Blink(byte PIN, int DELAY_MS)
// 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) {
do {
if (radio.ACKReceived(theNodeID))
return true;
}
} while (millis() - now <= ACK_TIME);
return false;
}
8 changes: 4 additions & 4 deletions Examples/RFM12B_Struct_node/RFM12B_Struct_node.ino
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ void loop() {
if (radio.CRCPass())
{
Serial.print('[');Serial.print(radio.GetSender(), DEC);Serial.print("] ");
for (byte i = 0; i < *radio.DataLen; i++)
Serial.print((char)radio.Data[i]);
for (byte i = 0; i < radio.GetDataLen(); i++)
Serial.print((char)radio.GetData()[i]);

if (radio.ACKRequested())
{
Expand Down Expand Up @@ -138,9 +138,9 @@ void Blink(byte PIN, int DELAY_MS)
// 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) {
do {
if (radio.ACKReceived(theNodeID))
return true;
}
} while (millis() - now <= ACK_TIME);
return false;
}
6 changes: 3 additions & 3 deletions Examples/Receive/Receive.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ void loop()
if (radio.CRCPass())
{
Serial.print('[');Serial.print(radio.GetSender());Serial.print("] ");
for (byte i = 0; i < *radio.DataLen; i++) //can also use radio.GetDataLen() if you don't like pointers
Serial.print((char)radio.Data[i]);
for (byte i = 0; i < radio.GetDataLen(); i++) //can also use radio.GetDataLen() if you don't like pointers
Serial.print((char)radio.GetData()[i]);

if (radio.ACKRequested())
{
Expand All @@ -50,4 +50,4 @@ void loop()

Serial.println();
}
}
}
6 changes: 4 additions & 2 deletions Examples/Send/Send.ino
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ void loop()
// wait a few milliseconds for proper ACK, return true if received
static bool waitForAck() {
long now = millis();
while (millis() - now <= ACK_TIME)
do
{
if (radio.ACKReceived(GATEWAYID))
return true;
} while (millis() - now <= ACK_TIME);
return false;
}
}
8 changes: 4 additions & 4 deletions Examples/Test_2way_gateway/Test_2way_gateway.ino
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ void loop()
{
digitalWrite(9,1);
Serial.print('[');Serial.print(radio.GetSender(), DEC);Serial.print("] ");
for (byte i = 0; i < *radio.DataLen; i++)
Serial.print((char)radio.Data[i]);
for (byte i = 0; i < radio.GetDataLen(); i++)
Serial.print((char)radio.GetData()[i]);

if (radio.ACKRequested())
{
Expand Down Expand Up @@ -67,9 +67,9 @@ 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) {
do {
if (radio.ACKReceived(theNodeID))
return true;
}
} while (millis() - now <= ACK_TIME);
return false;
}
8 changes: 4 additions & 4 deletions Examples/Test_2way_node/Test_2way_node.ino
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void loop()
if (radio.CRCPass())
{
Serial.print('[');Serial.print(radio.GetSender(), DEC);Serial.print("] ");
for (byte i = 0; i < *radio.DataLen; i++)
Serial.print((char)radio.Data[i]);
for (byte i = 0; i < radio.GetDataLen(); i++)
Serial.print((char)radio.GetData()[i]);

if (radio.ACKRequested())
{
Expand Down Expand Up @@ -95,10 +95,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) {
do {
if (radio.ACKReceived(theNodeID))
return true;
}
} while (millis() - now <= ACK_TIME);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ void loop()
if (radio.CRCPass())
{
Serial.print('[');Serial.print(radio.GetSender(), DEC);Serial.print("] ");
for (byte i = 0; i < *radio.DataLen; i++)
Serial.print((char)radio.Data[i]);
for (byte i = 0; i < radio.GetDataLen(); i++)
Serial.print((char)radio.GetData()[i]);

if (radio.ACKRequested())
{
Expand Down Expand Up @@ -126,10 +126,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) {
do {
if (radio.ACKReceived(theNodeID))
return true;
}
} while (millis() - now <= ACK_TIME);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ void loop(){
{
if (radio.CRCPass())
{
for (byte i = 0; i < *radio.DataLen; i++)
Serial.print((char)radio.Data[i]);
for (byte i = 0; i < radio.GetDataLen(); i++)
Serial.print((char)radio.GetData()[i]);

if (radio.ACKRequested())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ void loop(){
if (radio.CRCPass())
{
Serial.print("Got [");
Serial.print(*radio.DataLen);
Serial.print(radio.GetDataLen());
Serial.print("] > ");
for (byte i = 0; i < *radio.DataLen; i++)
Serial.print((char)radio.Data[i], HEX);
for (byte i = 0; i < radio.GetDataLen(); i++)
Serial.print((char)radio.GetData()[i], HEX);
Serial.println();

CheckForWirelessHEX(radio, flash, true);
Expand Down
Loading