mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-22 15:16:43 -08:00
Create set macs menu and fix wifi init for macs
This commit is contained in:
@@ -1456,6 +1456,7 @@ void MenuFunctions::RunSetup()
|
||||
wifiGeneralMenu.list = new LinkedList<MenuNode>();
|
||||
wifiAPMenu.list = new LinkedList<MenuNode>();
|
||||
apInfoMenu.list = new LinkedList<MenuNode>();
|
||||
setMacMenu.list = new LinkedList<MenuNode>();
|
||||
genAPMacMenu.list = new LinkedList<MenuNode>();
|
||||
#ifdef HAS_BT
|
||||
airtagMenu.list = new LinkedList<MenuNode>();
|
||||
@@ -1524,6 +1525,7 @@ void MenuFunctions::RunSetup()
|
||||
clearAPsMenu.name = text_table1[29];
|
||||
wifiAPMenu.name = "Access Points";
|
||||
apInfoMenu.name = "AP Info";
|
||||
setMacMenu.name = "Set MACs";
|
||||
genAPMacMenu.name = "Generate AP MAC";
|
||||
#ifdef HAS_BT
|
||||
airtagMenu.name = "Select Airtag";
|
||||
@@ -1944,12 +1946,30 @@ void MenuFunctions::RunSetup()
|
||||
});
|
||||
#endif
|
||||
|
||||
this->addNodes(&wifiGeneralMenu, "Generate AP MAC", TFTLIGHTGREY, NULL, 0, [this]() {
|
||||
this->addNodes(&wifiGeneralMenu, "Set MACs", TFTLIGHTGREY, NULL, 0, [this]() {
|
||||
this->changeMenu(&setMacMenu);
|
||||
});
|
||||
|
||||
|
||||
// Menu for generating and setting MAC addrs for AP and STA
|
||||
setMacMenu.parentMenu = &wifiGeneralMenu;
|
||||
this->addNodes(&setMacMenu, text09, TFTLIGHTGREY, NULL, 0, [this]() {
|
||||
this->changeMenu(setMacMenu.parentMenu);
|
||||
});
|
||||
|
||||
// Generate random MAC for AP
|
||||
this->addNodes(&setMacMenu, "Generate AP MAC", TFTLIME, NULL, 0, [this]() {
|
||||
this->changeMenu(&genAPMacMenu);
|
||||
wifi_scan_obj.RunGenerateRandomMac(true);
|
||||
});
|
||||
|
||||
// Menu for generating and setting access point MAC
|
||||
// Generate random MAC for AP
|
||||
this->addNodes(&setMacMenu, "Generate STA MAC", TFTCYAN, NULL, 0, [this]() {
|
||||
this->changeMenu(&genAPMacMenu);
|
||||
wifi_scan_obj.RunGenerateRandomMac(false);
|
||||
});
|
||||
|
||||
// Menu for generating and setting access point MAC (just goes bacK)
|
||||
genAPMacMenu.parentMenu = &wifiGeneralMenu;
|
||||
this->addNodes(&genAPMacMenu, text09, TFTLIGHTGREY, NULL, 0, [this]() {
|
||||
this->changeMenu(genAPMacMenu.parentMenu);
|
||||
|
||||
@@ -179,6 +179,7 @@ class MenuFunctions
|
||||
Menu saveFileMenu;
|
||||
Menu apInfoMenu;
|
||||
Menu genAPMacMenu;
|
||||
Menu setMacMenu;
|
||||
|
||||
// Bluetooth menu stuff
|
||||
Menu bluetoothSnifferMenu;
|
||||
|
||||
@@ -1078,9 +1078,9 @@ String WiFiScan::getStaMAC()
|
||||
char *buf;
|
||||
uint8_t mac[6];
|
||||
char macAddrChr[18] = {0};
|
||||
esp_wifi_init(&cfg);
|
||||
esp_wifi_init(&cfg2);
|
||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||
esp_wifi_set_mode(WIFI_MODE_STA);
|
||||
esp_wifi_start();
|
||||
this->setMac();
|
||||
esp_err_t mac_status = esp_wifi_get_mac(WIFI_IF_STA, mac);
|
||||
@@ -1102,9 +1102,9 @@ String WiFiScan::getApMAC()
|
||||
char *buf;
|
||||
uint8_t mac[6];
|
||||
char macAddrChr[18] = {0};
|
||||
esp_wifi_init(&cfg);
|
||||
esp_wifi_init(&cfg2);
|
||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||
esp_wifi_set_mode(WIFI_MODE_AP);
|
||||
esp_wifi_start();
|
||||
this->setMac();
|
||||
esp_err_t mac_status = esp_wifi_get_mac(WIFI_IF_AP, mac);
|
||||
@@ -1730,7 +1730,7 @@ void WiFiScan::RunGenerateRandomMac(bool ap) {
|
||||
if (ap) Serial.println("Setting AP MAC: " + macToString(this->ap_mac));
|
||||
else Serial.println("Setting STA MAC: " + macToString(this->sta_mac));
|
||||
|
||||
#ifdef HAS_DISPLAY
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
|
||||
Reference in New Issue
Block a user