Just Call Me Koko пре 6 година
родитељ
комит
60a901475c
1 измењених фајлова са 6 додато и 3 уклоњено
  1. 6 3
      esp32_marauder/MenuFunctions.cpp

+ 6 - 3
esp32_marauder/MenuFunctions.cpp

@@ -33,7 +33,6 @@ void MenuFunctions::main()
   
   
   // This is if there are scans/attacks going on
   // This is if there are scans/attacks going on
   if ((wifi_scan_obj.currentScanMode != WIFI_SCAN_OFF) && (pressed))
   if ((wifi_scan_obj.currentScanMode != WIFI_SCAN_OFF) && (pressed))
-  //if ((wifi_scan_obj.currentScanMode != WIFI_SCAN_OFF) && (x != -1) && (y != -1))
   {  
   {  
     // Stop the current scan
     // Stop the current scan
     if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_PROBE) ||
     if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_PROBE) ||
@@ -60,9 +59,11 @@ void MenuFunctions::main()
     return;
     return;
   }
   }
   
   
-  // / Check if any key coordinate boxes contain the touch coordinates
+  // Check if any key coordinate boxes contain the touch coordinates
+  // This is for when on a menu
   if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
   if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
   {
   {
+    // Need this to set all keys to false
     for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++) {
     for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++) {
       if (pressed && key[b].contains(t_x, t_y)) {
       if (pressed && key[b].contains(t_x, t_y)) {
         key[b].press(true);  // tell the button it is pressed
         key[b].press(true);  // tell the button it is pressed
@@ -72,7 +73,7 @@ void MenuFunctions::main()
     }
     }
   
   
     // Check if any key has changed state
     // Check if any key has changed state
-    for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++) {
+    for (uint8_t b = 0; b < current_menu->list->size(); b++) {
       display_obj.tft.setFreeFont(MENU_FONT);
       display_obj.tft.setFreeFont(MENU_FONT);
       if (key[b].justPressed()) {
       if (key[b].justPressed()) {
         key[b].drawButton2(current_menu->list->get(b).name, true);  // draw invert
         key[b].drawButton2(current_menu->list->get(b).name, true);  // draw invert
@@ -213,6 +214,8 @@ void MenuFunctions::buildButtons(Menu* menu)
   Serial.println("Bulding buttons...");
   Serial.println("Bulding buttons...");
   if (menu->list != NULL)
   if (menu->list != NULL)
   {
   {
+    //for (int i = 0; i < sizeof(key); i++)
+    //  key[i] = NULL;
     for (int i = 0; i < menu->list->size(); i++)
     for (int i = 0; i < menu->list->size(); i++)
     {
     {
       TFT_eSPI_Button new_button;
       TFT_eSPI_Button new_button;