JuReceiver/system_general/multicast.h

28 lines
671 B
C
Raw Normal View History

2023-09-10 15:33:34 +02:00
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();
}
}