Skip to content

Commit 63da5a4

Browse files
committed
Add test features for ESP-Now menu
Only available in developer mode
1 parent ea9112e commit 63da5a4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Firmware/RTK_Surveyor/menuMain.ino

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ void menuRadio()
338338

339339
Serial.println("2) Pair radios");
340340
Serial.println("3) Forget all radios");
341+
#ifdef ENABLE_DEVELOPER
342+
Serial.println("4) Add dummy radio");
343+
Serial.println("5) Send dummy data");
344+
#endif
341345
}
342346

343347
Serial.println("x) Exit");
@@ -406,6 +410,34 @@ void menuRadio()
406410
Serial.println("Radios forgotten");
407411
}
408412
}
413+
#ifdef ENABLE_DEVELOPER
414+
else if (settings.radioType == RADIO_ESPNOW && incoming == 4)
415+
{
416+
//TODO remove
417+
uint8_t peer1[] = {0xB8, 0xD6, 0x1A, 0x0D, 0x8F, 0x9C}; //Facet
418+
if (esp_now_is_peer_exist(peer1) == true)
419+
log_d("Peer already exists");
420+
else
421+
{
422+
//Add new peer to system
423+
espnowAddPeer(peer1);
424+
425+
//Record this MAC to peer list
426+
memcpy(settings.espnowPeers[settings.espnowPeerCount], peer1, 6);
427+
settings.espnowPeerCount++;
428+
settings.espnowPeerCount %= ESPNOW_MAX_PEERS;
429+
recordSystemSettings();
430+
}
431+
432+
espnowSetState(ESPNOW_PAIRED);
433+
}
434+
else if (settings.radioType == RADIO_ESPNOW && incoming == 5)
435+
{
436+
//TODO remove
437+
uint8_t espnowData[] = "This is the long string to test how quickly we can send one string to the other unit. I am going to need a much longer sentence if I want to get a long amount of data into one transmission. This is nearing 200 characters but needs to be near 250.";
438+
esp_now_send(0, (uint8_t *) &espnowData, sizeof(espnowData)); //Send packet to all peers
439+
}
440+
#endif
409441

410442
else if (incoming == STATUS_PRESSED_X)
411443
break;

0 commit comments

Comments
 (0)