       (nPinYp != ADATOUCH_PIN_YP) || (nPinYm != ADATOUCH_PIN_YM))
     {
       GSLC_DEBUG_PRINT("MISMATCH - Please update config\n", "");
-      return false;
+      bRet = true;
     }
     else {
       GSLC_DEBUG_PRINT("OK - No need to update config\n", "");
-      return true;
-    }
-    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");
-
+      bRet = true;
+    }
   }
   else {
-    return false;
-  }
-
+    GSLC_DEBUG_PRINT("\nERROR - Touchscreen is probably broken\n", "");
+    bRet = false;
+  }
+
+  GSLC_DEBUG_PRINT("-----------------------------------------------\n\n", "");
+  return bRet;
 }
 
 
 void setup()
 {
+  bool bDetectPinsOk = false;
+
   // Initialize debug output
   Serial.begin(9600);
   gslc_InitDebug(&DebugOut);
   //delay(1000);  // NOTE: Some devices require a delay after Serial.begin() before serial port can be used
 
+  // Detect pins before we initialize the display driver
+  DetectId();
+  bDetectPinsOk = DetectPins();
+
+  // mcufriend displays need re-init after detect
+  #if defined(DRV_DISP_ADAGFX_MCUFRIEND)
+    m_disp.begin(m_nMcuFriendId);
+  #endif // DRV_DISP_ADAGFX_MCUFRIEND
+
   // Initialize (with no support for GUI elements)
   if (!gslc_Init(&m_gui, &m_drv, NULL, 0, m_asFont, MAX_FONT)) { return; }
 

char m_acTxt[MAX_STR];
gslc_tsRect m_rStatus = (gslc_tsRect) { 40, 60, 50, 10 };
gslc_tsRect m_rReport = (gslc_tsRect) { 40, 80, 140, 10 };
gslc_tsFont* m_pFont = NULL;

#define MAX_FONT                1

  int nPinYm = -1;

  int i, j, value, Apins[2], Dpins[2], Values[2], found = 0;
  bool bRet = false;

  GSLC_DEBUG_PRINT("Making all control and bus pins INPUT_PULLUP\n", "");
  GSLC_DEBUG_PRINT("Typical 30k Analog pullup with corresponding pin\n", "");
