28 lines
671 B
C
28 lines
671 B
C
|
|
||
|
typedef struct {
|
||
|
byte type = 0xff;
|
||
|
byte channel;
|
||
|
uint64_t pipe;
|
||
|
char name[16] = "[UNNAMED]";
|
||
|
} nrfMulticast;
|
||
|
|
||
|
void RCMulticastTask() {
|
||
|
if (random(25) == 1) {
|
||
|
#ifdef debug
|
||
|
Serial.println("Multicast!");
|
||
|
#endif
|
||
|
radio.stopListening();
|
||
|
radio.setChannel(multicastChannel);
|
||
|
radio.openWritingPipe(multicastAddress);
|
||
|
nrfMulticast data;
|
||
|
data.pipe = myPipe;
|
||
|
data.channel = myChannel;
|
||
|
#ifdef jNAME
|
||
|
char nameMult[16] = jNAME;
|
||
|
strncpy(data.name, nameMult, 16);
|
||
|
#endif
|
||
|
radio.write(&data, sizeof(data), true);
|
||
|
radio.setChannel(myChannel);
|
||
|
radio.startListening();
|
||
|
}
|
||
|
}
|