Just Call Me Koko 4 лет назад
Родитель
Сommit
e3de597e0a
3 измененных файлов с 34 добавлено и 1 удалено
  1. 1 1
      esp32_marauder/MenuFunctions.cpp
  2. 26 0
      esp32_marauder/a32u4_interface.cpp
  3. 7 0
      esp32_marauder/esp_interface.cpp

+ 1 - 1
esp32_marauder/MenuFunctions.cpp

@@ -809,7 +809,7 @@ void MenuFunctions::RunSetup()
   addNodes(&mainMenu, "Bluetooth", TFT_CYAN, NULL, BLUETOOTH, [this]() {
   addNodes(&mainMenu, "Bluetooth", TFT_CYAN, NULL, BLUETOOTH, [this]() {
     changeMenu(&bluetoothMenu);
     changeMenu(&bluetoothMenu);
   });
   });
-  addNodes(&mainMenu, "Bad USB", TFT_RED, NULL, BAD_USB_ICO, [this]() {
+  if (a32u4_obj.supported) addNodes(&mainMenu, "Bad USB", TFT_RED, NULL, BAD_USB_ICO, [this]() {
     changeMenu(&badusbMenu);
     changeMenu(&badusbMenu);
   });
   });
   addNodes(&mainMenu, "General Apps", TFT_MAGENTA, NULL, GENERAL_APPS, [this]() {
   addNodes(&mainMenu, "General Apps", TFT_MAGENTA, NULL, GENERAL_APPS, [this]() {

+ 26 - 0
esp32_marauder/a32u4_interface.cpp

@@ -5,8 +5,34 @@ HardwareSerial MySerial_two(2);
 void A32u4Interface::begin() {
 void A32u4Interface::begin() {
   MySerial_two.begin(BAUD32U4, SERIAL_8N1, 25, 4);
   MySerial_two.begin(BAUD32U4, SERIAL_8N1, 25, 4);
 
 
+  delay(2000);
+
   Serial.println("Setup A32U4 Serial Interface");
   Serial.println("Setup A32U4 Serial Interface");
 
 
+  uint8_t a32u4_rep = 0;
+
+  if (MySerial_two.available()) {
+    a32u4_rep = (uint8_t)MySerial_two.read();
+  }
+
+  //display_string.trim();
+
+  //Serial.println("\nDisplay string: " + (String)display_string);
+
+  if (a32u4_rep != 0) {
+    this->supported = true;
+    display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
+    display_obj.tft.println("ATmega32U4 Found!");
+    display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
+  }
+  else {
+    display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
+    display_obj.tft.println("ATmega32U4 Not Found");
+    display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
+    Serial.print("A32U4 Said: ");
+    Serial.println(a32u4_rep);
+  }
+
   this->initTime = millis();
   this->initTime = millis();
 }
 }
 
 

+ 7 - 0
esp32_marauder/esp_interface.cpp

@@ -40,10 +40,17 @@ void EspInterface::begin() {
   Serial.println("\nDisplay string: " + (String)display_string);
   Serial.println("\nDisplay string: " + (String)display_string);
   
   
   if (display_string == "ESP8266 Pong") {
   if (display_string == "ESP8266 Pong") {
+    display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
     display_obj.tft.println("ESP8266 Found!");
     display_obj.tft.println("ESP8266 Found!");
+    display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
     Serial.println("ESP8266 Found!");
     Serial.println("ESP8266 Found!");
     this->supported = true;
     this->supported = true;
   }
   }
+  else {
+    display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
+    display_obj.tft.println("ESP8266 Not Found");
+    display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
+  }
 
 
   this->initTime = millis();
   this->initTime = millis();
 }
 }