add wifi in nrf jammer

This commit is contained in:
krolyxon 2026-05-07 20:34:37 +05:30
parent 2922e832aa
commit bd12e096d1
1 changed files with 73 additions and 21 deletions

View File

@ -18,6 +18,12 @@ const byte bluetoothChannels[] = {
74, 76, 78, 80 74, 76, 78, 80
}; };
const byte wifiChannels[] = {
12, 17, 22, 27, 32,
37, 42, 47, 52, 57,
62, 67, 72
};
void initNRF(RF24 &radio) void initNRF(RF24 &radio)
{ {
if (!radio.begin(RADIO_SPI)) { if (!radio.begin(RADIO_SPI)) {
@ -119,29 +125,66 @@ void startJammer(const char* name, const byte* channels, size_t channelCount)
const char payload[] = "xxxxxxxxxxxxxxxx"; const char payload[] = "xxxxxxxxxxxxxxxx";
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.drawStr(0, 10, "Jamming:"); u8g2.setFont(u8g2_font_6x10_tr);
u8g2.setCursor(60, 10); u8g2.drawStr(0, 15, "NRF24 Jammer");
u8g2.print(name); u8g2.drawStr(0, 35, name);
u8g2.drawStr(0, 55, "BACK = Exit");
u8g2.sendBuffer(); u8g2.sendBuffer();
while (true) while (true)
{ {
for (size_t i = 0; i < channelCount; i++) for (size_t i = 0; i < channelCount; i++)
{ {
radio1.setChannel(channels[i]); //radio1.setChannel(channels[i]);
radio1.write(&payload, sizeof(payload)); //radio1.write(&payload, sizeof(payload));
// Optional second NRF // Optional second NRF
// radio2.setChannel(channels[i]); // radio2.setChannel(channels[i]);
// radio2.write(&payload, sizeof(payload)); // radio2.write(&payload, sizeof(payload));
}
if (btnBack())
{ radio1.setChannel(channels[i]);
Serial.println("Jammer stopped"); radio2.setChannel(channels[(i + 1) % channelCount]);
return;
} radio1.writeFast(&payload, sizeof(payload));
} radio2.writeFast(&payload, sizeof(payload));
}
if (btnBack())
{
Serial.println("Jammer stopped");
radio1.powerDown();
radio2.powerDown();
return;
}
}
//while (true) {
//for (size_t i = 0; i < channelCount; i++)
//{
// radio1.setChannel(channels[i]);
// radio2.setChannel(channels[(i + 1) % channelCount]);
// radio1.writeFast(&payload, sizeof(payload));
// radio2.writeFast(&payload, sizeof(payload));
// radio1.txStandBy(1);
// radio2.txStandBy(1);
// delayMicroseconds(200);
//}
//if (btnBack())
//{
// Serial.println("Jammer stopped");
// radio1.powerDown();
// radio2.powerDown();
// return;
//}
//}
} }
void NRFToolsMenu(int index) { void NRFToolsMenu(int index) {
@ -152,7 +195,7 @@ void NRFToolsMenu(int index) {
startJammer( startJammer(
"BLE", "BLE",
bleChannels, bleChannels,
sizeof(bleChannels) sizeof(bleChannels) / sizeof(bleChannels[0])
); );
break; break;
@ -162,8 +205,17 @@ void NRFToolsMenu(int index) {
startJammer( startJammer(
"Bluetooth", "Bluetooth",
bluetoothChannels, bluetoothChannels,
sizeof(bluetoothChannels) sizeof(bluetoothChannels) / sizeof(bluetoothChannels[0])
); );
break; break;
case 2:
startJammer(
"WiFi",
wifiChannels,
sizeof(wifiChannels) / sizeof(wifiChannels[0])
);
break;
} }
} }