JuReceiver/system_general/multicast.h
2023-09-17 13:57:28 +02:00

28 lines
No EOL
662 B
C

typedef struct {
byte type = 0xff;
byte channel;
uint64_t pipe;
char name[16] = "[UNNAMED]";
} nrfMulticast;
void RCMulticastTask() {
if (random(25) == 1) {
#if 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));
radio.setChannel(myChannel);
radio.startListening();
}
}