JuReceiver/system_general/multicast.h
2023-09-10 15:33:34 +02:00

28 lines
No EOL
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();
}
}