Skip to content

Commit

Permalink
revise use of header in ncurses interrupt example
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jun 17, 2024
1 parent 12b5a3e commit 364ab07
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions examples/ncursesInt/RF24Gateway_ncursesInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,29 +182,26 @@ int main()
{
++networkPacketsRX;
RF24NetworkHeader header;

// un-needed variables
// size_t size = network.peek(header);
// uint8_t buf[size];
network.read(header, /*buf*/ 0, /*size*/ 0); // pop the RX payload from network.queue

if (header.type == 1) // header.type is uninitialized
// send a timestamp to master
struct timeStruct
{
struct timeStruct
{
uint8_t hr;
uint8_t min;
} myTime;

time_t mTime;
time(&mTime);
struct tm* tm = localtime(&mTime);

myTime.hr = tm->tm_hour;
myTime.min = tm->tm_min;
RF24NetworkHeader hdr(header.from_node, 1);
network.write(hdr, &myTime, sizeof(myTime));
}
network.read(header, 0, 0);
uint8_t hr;
uint8_t min;
} myTime;

time_t mTime;
time(&mTime);
struct tm* tm = localtime(&mTime);

myTime.hr = tm->tm_hour;
myTime.min = tm->tm_min;
RF24NetworkHeader hdr(0, 1);
network.write(hdr, &myTime, sizeof(myTime));
}
}
else
Expand Down

0 comments on commit 364ab07

Please sign in to comment.