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