acidportal- 😈 Worlds smallest Evil Portal on a LilyGo T-QT |
git clone git://git.acid.vegas/acidportal.git |
Log | Files | Refs | Archive | README | LICENSE |
TFT_Char_times.ino (3653B)
1 /* 2 Font draw speed and flicker test, draws all numbers 0-999 in each font 3 Average time in milliseconds to draw is shown in red 4 A total of 2890 characters are drawn in each font 5 6 Needs fonts 2, 4, 6, 7 and 8 7 8 Make sure all the display driver and pin connections are correct by 9 editing the User_Setup.h file in the TFT_eSPI library folder. 10 11 ######################################################################### 12 ###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ###### 13 ######################################################################### 14 */ 15 16 17 #include <TFT_eSPI.h> // Hardware-specific library 18 #include <SPI.h> 19 20 TFT_eSPI tft = TFT_eSPI(); // Invoke custom library 21 22 unsigned long drawTime = 0; 23 24 void setup(void) { 25 tft.init(); 26 tft.setRotation(1); 27 } 28 29 void loop() { 30 31 tft.fillScreen(TFT_BLACK); 32 tft.setTextColor(TFT_WHITE, TFT_BLACK); 33 34 drawTime = millis(); 35 36 for (int i = 0; i < 1000; i++) { 37 yield();tft.drawNumber(i, 100, 80, 1); 38 } 39 40 drawTime = millis() - drawTime; 41 42 tft.setTextColor(TFT_RED, TFT_BLACK); 43 int xpos = 20; 44 xpos += tft.drawFloat(drawTime / 2890.0, 3, xpos, 180, 4); 45 tft.drawString(" ms per character", xpos, 180, 4); 46 if (drawTime < 100) tft.drawString("Font 1 not loaded!", 50, 210, 4); 47 48 delay(4000); 49 tft.fillScreen(TFT_BLACK); 50 tft.setTextColor(TFT_WHITE, TFT_BLACK); 51 drawTime = millis(); 52 53 for (int i = 0; i < 1000; i++) { 54 yield();tft.drawNumber(i, 100, 80, 2); 55 } 56 57 drawTime = millis() - drawTime; 58 59 tft.setTextColor(TFT_RED, TFT_BLACK); 60 xpos = 20; 61 xpos += tft.drawFloat(drawTime / 2890.0, 3, xpos, 180, 4); 62 tft.drawString(" ms per character", xpos, 180, 4); 63 if (drawTime < 200) tft.drawString("Font 2 not loaded!", 50, 210, 4); 64 65 delay(4000); 66 tft.fillScreen(TFT_BLACK); 67 tft.setTextColor(TFT_WHITE, TFT_BLACK); 68 drawTime = millis(); 69 70 for (int i = 0; i < 1000; i++) { 71 yield();tft.drawNumber(i, 100, 80, 4); 72 } 73 74 drawTime = millis() - drawTime; 75 76 tft.setTextColor(TFT_RED, TFT_BLACK); 77 xpos = 20; 78 xpos += tft.drawFloat(drawTime / 2890.0, 3, xpos, 180, 4); 79 tft.drawString(" ms per character", xpos, 180, 4); 80 if (drawTime < 200) tft.drawString("Font 4 not loaded!", 50, 210, 4); 81 82 delay(4000); 83 tft.fillScreen(TFT_BLACK); 84 tft.setTextColor(TFT_WHITE, TFT_BLACK); 85 drawTime = millis(); 86 87 for (int i = 0; i < 1000; i++) { 88 yield();tft.drawNumber(i, 100, 80, 6); 89 } 90 91 drawTime = millis() - drawTime; 92 93 tft.setTextColor(TFT_RED, TFT_BLACK); 94 xpos = 20; 95 xpos += tft.drawFloat(drawTime / 2890.0, 3, xpos, 180, 4); 96 tft.drawString(" ms per character", xpos, 180, 4); 97 if (drawTime < 200) tft.drawString("Font 6 not loaded!", 50, 210, 4); 98 99 delay(4000); 100 tft.fillScreen(TFT_BLACK); 101 tft.setTextColor(TFT_WHITE, TFT_BLACK); 102 drawTime = millis(); 103 104 for (int i = 0; i < 1000; i++) { 105 yield();tft.drawNumber(i, 100, 80, 7); 106 } 107 108 drawTime = millis() - drawTime; 109 110 tft.setTextColor(TFT_RED, TFT_BLACK); 111 xpos = 20; 112 xpos += tft.drawFloat(drawTime / 2890.0, 3, xpos, 180, 4); 113 tft.drawString(" ms per character", xpos, 180, 4); 114 if (drawTime < 200) tft.drawString("Font 7 not loaded!", 50, 210, 4); 115 116 delay(4000); 117 tft.fillScreen(TFT_YELLOW); 118 tft.setTextColor(TFT_WHITE, TFT_BLACK); 119 drawTime = millis(); 120 121 for (int i = 0; i < 1000; i++) { 122 yield();tft.drawNumber(i, 100, 80, 8); 123 } 124 125 drawTime = millis() - drawTime; 126 127 tft.setTextColor(TFT_RED, TFT_BLACK); 128 xpos = 20; 129 xpos += tft.drawFloat(drawTime / 2890.0, 3, xpos, 180, 4); 130 tft.drawString(" ms per character", xpos, 180, 4); 131 if (drawTime < 200) tft.drawString("Font 8 not loaded!", 50, 210, 4); 132 133 delay(4000); 134 } 135 136 137 138 139 140 141 142