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 (2897B)

      1 /*
      2  Font draw speed and flicker test, draws all numbers 0-999 in each font
      3  (0-99 in font 8)
      4  Average time in milliseconds to draw a character is shown in red
      5  A total of 2890 characters are drawn in each font (190 in font 8)
      6  
      7  Needs fonts 2, 4, 6, 7 and 8
      8 
      9  Make sure all the display driver and pin connections are correct by
     10  editing the User_Setup.h file in the TFT_eSPI library folder.
     11 
     12  Note that yield() or delay(0) must be called in long duration for/while
     13  loops to stop the ESP8266 watchdog triggering.
     14 
     15  #########################################################################
     16  ###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
     17  #########################################################################
     18  */
     19 
     20 
     21 #include <TFT_eSPI.h> // Graphics and font library for ILI9341 driver chip
     22 #include <SPI.h>
     23 
     24 TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h
     25 
     26 unsigned long drawTime = 0;
     27 
     28 void setup(void) {
     29   tft.init();
     30   tft.setRotation(1);
     31 }
     32 
     33 void loop() {
     34 
     35   tft.fillScreen(TFT_BLACK);
     36   tft.setTextColor(TFT_WHITE, TFT_BLACK);
     37 
     38   drawTime = millis();
     39 
     40   for (int i = 0; i < 1000; i++) {
     41     tft.drawNumber(i, 0, 0, 1);
     42   }
     43 
     44   drawTime = millis() - drawTime;
     45 
     46   tft.setTextColor(TFT_RED, TFT_BLACK);
     47   tft.drawFloat(drawTime / 2890.0, 3, 0, 80, 4);
     48  
     49   delay(4000);
     50   tft.fillScreen(TFT_BLACK);
     51   tft.setTextColor(TFT_WHITE, TFT_BLACK);
     52   drawTime = millis();
     53 
     54   for (int i = 0; i < 1000; i++) {
     55     tft.drawNumber(i, 0, 0, 2);
     56   }
     57 
     58   drawTime = millis() - drawTime;
     59 
     60   tft.setTextColor(TFT_RED, TFT_BLACK);
     61   tft.drawFloat(drawTime / 2890.0, 3, 0, 80, 4);
     62 
     63   delay(4000);
     64   tft.fillScreen(TFT_BLACK);
     65   tft.setTextColor(TFT_WHITE, TFT_BLACK);
     66   drawTime = millis();
     67 
     68   for (int i = 0; i < 1000; i++) {
     69     tft.drawNumber(i, 0, 0, 4);
     70   }
     71 
     72   drawTime = millis() - drawTime;
     73 
     74   tft.setTextColor(TFT_RED, TFT_BLACK);
     75   tft.drawFloat(drawTime / 2890.0, 3, 0, 80, 4);
     76 
     77   delay(4000);
     78   tft.fillScreen(TFT_BLACK);
     79   tft.setTextColor(TFT_WHITE, TFT_BLACK);
     80   drawTime = millis();
     81 
     82   for (int i = 0; i < 1000; i++) {
     83     yield(); tft.drawNumber(i, 0, 0, 6);
     84   }
     85 
     86   drawTime = millis() - drawTime;
     87 
     88   tft.setTextColor(TFT_RED, TFT_BLACK);
     89   tft.drawFloat(drawTime / 2890.0, 3, 0, 80, 4);
     90  
     91   delay(4000);
     92   tft.fillScreen(TFT_BLACK);
     93   tft.setTextColor(TFT_WHITE, TFT_BLACK);
     94   drawTime = millis();
     95 
     96   for (int i = 0; i < 1000; i++) {
     97     yield(); tft.drawNumber(i, 0, 0, 7);
     98   }
     99 
    100   drawTime = millis() - drawTime;
    101 
    102   tft.setTextColor(TFT_RED, TFT_BLACK);
    103   tft.drawFloat(drawTime / 2890.0, 3, 0, 80, 4);
    104 
    105   delay(4000);
    106   tft.fillScreen(TFT_BLACK);
    107   tft.setTextColor(TFT_WHITE, TFT_BLACK);
    108   drawTime = millis();
    109 
    110   for (int i = 0; i < 100; i++) {
    111     yield(); tft.drawNumber(i, 0, 0, 8);
    112   }
    113 
    114   drawTime = millis() - drawTime;
    115 
    116   tft.setTextColor(TFT_RED, TFT_BLACK);
    117   tft.drawFloat(drawTime / 190.0, 3, 0, 80, 4);
    118 
    119   delay(4000);
    120 }
    121 
    122 
    123 
    124 
    125 
    126 
    127 
    128