Просмотр исходного кода

Add kit firmware modifications

Just Call Me Koko 4 лет назад
Родитель
Сommit
a23e7a4c48

+ 4 - 0
esp32_marauder/Display.cpp

@@ -68,6 +68,10 @@ void Display::RunSetup()
   //digitalWrite(TFT_BL, HIGH);
 
   //delay(5000);
+
+  #ifdef KIT
+    pinMode(KIT_LED_BUILTIN, OUTPUT);
+  #endif
 }
 
 /* Interrupt driven periodic handler */

+ 4 - 1
esp32_marauder/Display.h

@@ -48,6 +48,7 @@
 
 #define TFT_SHIELD
 //#define TFT_DIY
+//#define KIT
 
 #define SCREEN_WIDTH 240
 #define SCREEN_HEIGHT 320
@@ -70,6 +71,8 @@
 
 #define STATUSBAR_COLOR 0x4A49
 
+#define KIT_LED_BUILTIN 13
+
 /*
 PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
 PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
@@ -108,7 +111,7 @@ class Display
     TFT_eSPI tft = TFT_eSPI();
     TFT_eSprite img = TFT_eSprite(&tft);
     TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
-    const String PROGMEM version_number = "v0.9.1";
+    const String PROGMEM version_number = "v0.9.2";
 
     bool printing = false;
     bool loading = false;

+ 29 - 0
esp32_marauder/SDInterface.cpp

@@ -2,6 +2,18 @@
 
 bool SDInterface::initSD() {
   String display_string = "";
+
+  #ifdef KIT
+    pinMode(SD_DET, INPUT);
+    if (digitalRead(SD_DET) == LOW) {
+      Serial.println(F("SD Card Detect Pin Detected"));
+    }
+    else {
+      Serial.println(F("SD Card Detect Pin Not Detected"));
+      this->supported = false;
+      return false;
+    }
+  #endif
   
   if (!SD.begin(SD_CS)) {
     Serial.println(F("Failed to mount SD Card"));
@@ -167,11 +179,28 @@ void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
   }
 }
 
+bool SDInterface::checkDetectPin() {
+  #ifdef KIT
+    if (digitalRead(SD_DET) == LOW)
+      return true;
+    else
+      return false;
+  #endif
+
+  return false;
+}
+
 void SDInterface::main() {
   if ((this->supported) && (this->do_save)) {
     //Serial.println("Saving packet...");
     buffer_obj.forceSave(&SD);
   }
+  else if (!this->supported) {
+    if (checkDetectPin()) {
+      delay(100);
+      this->initSD();
+    }
+  }
 }
 
 //void SDInterface::savePacket(uint8_t* buf, uint32_t len) {

+ 5 - 0
esp32_marauder/SDInterface.h

@@ -11,9 +11,14 @@ extern Display display_obj;
 
 #define SD_CS 12
 
+#ifdef KIT
+  #define SD_DET 4
+#endif
+
 class SDInterface {
 
   private:
+    bool checkDetectPin();
 
   public:
     uint8_t cardType;

BIN
pictures/IMG_3475 - Copy.jpg


BIN
pictures/IMG_3484 - Copy.jpg


BIN
pictures/IMG_3485 - Copy.jpg


BIN
pictures/IMG_3491 - Copy.jpg