Display.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. #include "Display.h"
  2. /*
  3. Big thanks to bodmer for having great TFT and JPEG libraries
  4. https://github.com/bodmer
  5. */
  6. Display::Display()
  7. {
  8. }
  9. // Function to prepare the display and the menus
  10. void Display::RunSetup()
  11. {
  12. run_setup = false;
  13. // Need to declare new
  14. display_buffer = new LinkedList<String>();
  15. tft.init();
  16. tft.setRotation(0); // Portrait
  17. tft.setCursor(0, 0);
  18. //tft.setFreeFont(&FreeMonoBold9pt7b);
  19. // Calibration data
  20. //uint16_t calData[5] = { 390, 3516, 253, 3520, 7 }; tft.setRotation(1); // Portrait
  21. uint16_t calData[5] = { 275, 3494, 361, 3528, 4 }; // tft.setRotation(0); // Portrait
  22. tft.setTouch(calData);
  23. //tft.fillScreen(TFT_BLACK);
  24. clearScreen();
  25. // Initialize file system
  26. // This should probably have its own class
  27. if (!SPIFFS.begin()) {
  28. Serial.println("SPIFFS initialisation failed!");
  29. while (1) yield(); // Stay here twiddling thumbs waiting
  30. }
  31. // Draw the title screen
  32. drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
  33. //showCenterText(version_number, 250);
  34. tft.drawCentreString(version_number, 120, 250, 2);
  35. digitalWrite(TFT_BL, HIGH);
  36. delay(5000);
  37. }
  38. void Display::tftDrawGraphObjects(byte x_scale)
  39. {
  40. //draw the graph objects
  41. tft.fillRect(11, 5, x_scale+1, 120, TFT_BLACK); // positive start point
  42. tft.fillRect(11, 121, x_scale+1, 119, TFT_BLACK); // negative start point
  43. tft.drawFastVLine(10, 5, 230, TFT_WHITE); // y axis
  44. tft.drawFastHLine(10, HEIGHT_1 - 1, 310, TFT_WHITE); // x axis
  45. tft.setTextColor(TFT_YELLOW); tft.setTextSize(1); // set parameters for y axis labels
  46. //tft.setCursor(3, 116); tft.print(midway); // "0" at center of ya axis
  47. tft.setCursor(3, 6); tft.print("+"); // "+' at top of y axis
  48. tft.setCursor(3, 228); tft.print("0"); // "-" at bottom of y axis
  49. }
  50. void Display::tftDrawColorKey()
  51. {
  52. //Display color key
  53. tft.setTextSize(1); tft.setTextColor(TFT_WHITE);
  54. tft.fillRect(14, 0, 15, 8, TFT_GREEN); tft.setCursor(30, 0); tft.print(" - Beacons");
  55. tft.fillRect(14, 8, 15, 8, TFT_RED); tft.setCursor(30, 8); tft.print(" - Deauths");
  56. tft.fillRect(14, 16, 15, 8, TFT_BLUE); tft.setCursor(30, 16); tft.print(" - Probes");
  57. }
  58. void Display::tftDrawXScaleButtons(byte x_scale)
  59. {
  60. tft.drawFastVLine(234, 0, 20, TFT_WHITE);
  61. tft.setCursor(208, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("X Scale:"); tft.print(x_scale);
  62. key[0].initButton(&tft, // x - box
  63. 220,
  64. 10, // x, y, w, h, outline, fill, text
  65. 20,
  66. 20,
  67. TFT_BLACK, // Outline
  68. TFT_CYAN, // Fill
  69. TFT_BLACK, // Text
  70. "-",
  71. 2);
  72. key[1].initButton(&tft, // x + box
  73. 249,
  74. 10, // x, y, w, h, outline, fill, text
  75. 20,
  76. 20,
  77. TFT_BLACK, // Outline
  78. TFT_CYAN, // Fill
  79. TFT_BLACK, // Text
  80. "+",
  81. 2);
  82. key[0].setLabelDatum(1, 5, MC_DATUM);
  83. key[1].setLabelDatum(1, 5, MC_DATUM);
  84. key[0].drawButton();
  85. key[1].drawButton();
  86. }
  87. void Display::tftDrawYScaleButtons(byte y_scale)
  88. {
  89. tft.drawFastVLine(290, 0, 20, TFT_WHITE);
  90. tft.setCursor(265, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("Y Scale:"); tft.print(y_scale);
  91. key[2].initButton(&tft, // y - box
  92. 276,
  93. 10, // x, y, w, h, outline, fill, text
  94. 20,
  95. 20,
  96. TFT_BLACK, // Outline
  97. TFT_MAGENTA, // Fill
  98. TFT_BLACK, // Text
  99. "-",
  100. 2);
  101. key[3].initButton(&tft, // y + box
  102. 305,
  103. 10, // x, y, w, h, outline, fill, text
  104. 20,
  105. 20,
  106. TFT_BLACK, // Outline
  107. TFT_MAGENTA, // Fill
  108. TFT_BLACK, // Text
  109. "+",
  110. 2);
  111. key[2].setLabelDatum(1, 5, MC_DATUM);
  112. key[3].setLabelDatum(1, 5, MC_DATUM);
  113. key[2].drawButton();
  114. key[3].drawButton();
  115. }
  116. void Display::tftDrawChannelScaleButtons(int set_channel)
  117. {
  118. tft.drawFastVLine(178, 0, 20, TFT_WHITE);
  119. tft.setCursor(145, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("Channel:"); tft.print(set_channel);
  120. key[4].initButton(&tft, // channel - box
  121. 164,
  122. 10, // x, y, w, h, outline, fill, text
  123. 20,
  124. 20,
  125. TFT_BLACK, // Outline
  126. TFT_BLUE, // Fill
  127. TFT_BLACK, // Text
  128. "-",
  129. 2);
  130. key[5].initButton(&tft, // channel + box
  131. 193,
  132. 10, // x, y, w, h, outline, fill, text
  133. 20,
  134. 20,
  135. TFT_BLACK, // Outline
  136. TFT_BLUE, // Fill
  137. TFT_BLACK, // Text
  138. "+",
  139. 2);
  140. key[4].setLabelDatum(1, 5, MC_DATUM);
  141. key[5].setLabelDatum(1, 5, MC_DATUM);
  142. key[4].drawButton();
  143. key[5].drawButton();
  144. }
  145. void Display::tftDrawExitScaleButtons()
  146. {
  147. //tft.drawFastVLine(178, 0, 20, TFT_WHITE);
  148. //tft.setCursor(145, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("Channel:"); tft.print(set_channel);
  149. key[6].initButton(&tft, // Exit box
  150. 137,
  151. 10, // x, y, w, h, outline, fill, text
  152. 20,
  153. 20,
  154. TFT_ORANGE, // Outline
  155. TFT_RED, // Fill
  156. TFT_BLACK, // Text
  157. "X",
  158. 2);
  159. key[6].setLabelDatum(1, 5, MC_DATUM);
  160. key[6].drawButton();
  161. }
  162. void Display::twoPartDisplay(String center_text)
  163. {
  164. tft.setTextColor(TFT_BLACK, TFT_YELLOW);
  165. tft.fillRect(0,16,HEIGHT_1,144, TFT_YELLOW);
  166. //tft.drawCentreString(center_text,120,82,1);
  167. tft.setTextWrap(true);
  168. tft.setFreeFont(NULL);
  169. //showCenterText(center_text, 82);
  170. //tft.drawCentreString(center_text,120,82,1);
  171. tft.setCursor(0, 82);
  172. tft.println(center_text);
  173. tft.setFreeFont(MENU_FONT);
  174. tft.setTextWrap(false);
  175. }
  176. void Display::touchToExit()
  177. {
  178. tft.setTextColor(TFT_BLACK, TFT_LIGHTGREY);
  179. tft.fillRect(0,16,HEIGHT_1,16, TFT_LIGHTGREY);
  180. tft.drawCentreString("Touch screen to exit",120,16,2);
  181. }
  182. // Function to just draw the screen black
  183. void Display::clearScreen()
  184. {
  185. Serial.println("clearScreen()");
  186. tft.fillScreen(TFT_BLACK);
  187. tft.setCursor(0, 0);
  188. }
  189. void Display::displayBuffer(bool do_clear)
  190. {
  191. if (this->display_buffer->size() > 0)
  192. {
  193. delay(1);
  194. while (display_buffer->size() > 0)
  195. {
  196. xPos = 0;
  197. if ((display_buffer->size() > 0) && (!loading))
  198. {
  199. printing = true;
  200. delay(print_delay_1);
  201. yDraw = scroll_line(TFT_RED);
  202. tft.setCursor(xPos, yDraw);
  203. tft.print(display_buffer->shift());
  204. printing = false;
  205. delay(print_delay_2);
  206. }
  207. if (!tteBar)
  208. blank[(18+(yStart - TOP_FIXED_AREA) / TEXT_HEIGHT)%19] = xPos;
  209. else
  210. blank[(18+(yStart - TOP_FIXED_AREA_2) / TEXT_HEIGHT)%19] = xPos;
  211. }
  212. }
  213. }
  214. void Display::showCenterText(String text, int y)
  215. {
  216. tft.setCursor((SCREEN_WIDTH - (text.length() * 6)) / 2, y);
  217. tft.println(text);
  218. }
  219. void Display::initScrollValues(bool tte)
  220. {
  221. Serial.println("initScrollValues()");
  222. yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
  223. xPos = 0;
  224. if (!tte)
  225. {
  226. yStart = TOP_FIXED_AREA;
  227. yArea = YMAX - TOP_FIXED_AREA - BOT_FIXED_AREA;
  228. }
  229. else
  230. {
  231. yStart = TOP_FIXED_AREA_2;
  232. yArea = YMAX - TOP_FIXED_AREA_2 - BOT_FIXED_AREA;
  233. }
  234. for(int i = 0; i < 18; i++) blank[i] = 0;
  235. }
  236. // Function to execute hardware scroll for TFT screen
  237. int Display::scroll_line(uint32_t color) {
  238. //Serial.println("scroll_line()");
  239. int yTemp = yStart; // Store the old yStart, this is where we draw the next line
  240. // Use the record of line lengths to optimise the rectangle size we need to erase the top line
  241. // Check if we have the "touch to exit bar"
  242. if (!tteBar)
  243. {
  244. tft.fillRect(0,yStart,blank[(yStart-TOP_FIXED_AREA)/TEXT_HEIGHT],TEXT_HEIGHT, color);
  245. // Change the top of the scroll area
  246. yStart+=TEXT_HEIGHT;
  247. // The value must wrap around as the screen memory is a circular buffer
  248. if (yStart >= YMAX - BOT_FIXED_AREA) yStart = TOP_FIXED_AREA + (yStart - YMAX + BOT_FIXED_AREA);
  249. }
  250. else
  251. {
  252. tft.fillRect(0,yStart,blank[(yStart-TOP_FIXED_AREA_2)/TEXT_HEIGHT],TEXT_HEIGHT, color);
  253. // Change the top of the scroll area
  254. yStart+=TEXT_HEIGHT;
  255. // The value must wrap around as the screen memory is a circular buffer
  256. if (yStart >= YMAX - BOT_FIXED_AREA) yStart = TOP_FIXED_AREA_2 + (yStart - YMAX + BOT_FIXED_AREA);
  257. }
  258. // Now we can scroll the display
  259. scrollAddress(yStart);
  260. return yTemp;
  261. }
  262. // Function to setup hardware scroll for TFT screen
  263. void Display::setupScrollArea(uint16_t tfa, uint16_t bfa) {
  264. Serial.println("setupScrollAread()");
  265. tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition
  266. tft.writedata(tfa >> 8); // Top Fixed Area line count
  267. tft.writedata(tfa);
  268. tft.writedata((YMAX-tfa-bfa)>>8); // Vertical Scrolling Area line count
  269. tft.writedata(YMAX-tfa-bfa);
  270. tft.writedata(bfa >> 8); // Bottom Fixed Area line count
  271. tft.writedata(bfa);
  272. }
  273. void Display::scrollAddress(uint16_t vsp) {
  274. tft.writecommand(ILI9341_VSCRSADD); // Vertical scrolling pointer
  275. tft.writedata(vsp>>8);
  276. tft.writedata(vsp);
  277. }
  278. // JPEG_functions
  279. void Display::drawJpeg(const char *filename, int xpos, int ypos) {
  280. // Open the named file (the Jpeg decoder library will close it after rendering image)
  281. fs::File jpegFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
  282. //ESP32 always seems to return 1 for jpegFile so this null trap does not work
  283. if ( !jpegFile ) {
  284. Serial.print("ERROR: File \""); Serial.print(filename); Serial.println ("\" not found!");
  285. return;
  286. }
  287. // Use one of the three following methods to initialise the decoder,
  288. // the filename can be a String or character array type:
  289. boolean decoded = JpegDec.decodeFsFile(filename); // or pass the filename (leading / distinguishes SPIFFS files)
  290. if (decoded) {
  291. // print information about the image to the serial port
  292. jpegInfo();
  293. // render the image onto the screen at given coordinates
  294. jpegRender(xpos, ypos);
  295. }
  296. else {
  297. Serial.println("Jpeg file format not supported!");
  298. }
  299. }
  300. void Display::drawStylus()
  301. {
  302. uint16_t x = 0, y = 0; // To store the touch coordinates
  303. // Pressed will be set true is there is a valid touch on the screen
  304. boolean pressed = tft.getTouch(&x, &y);
  305. // Draw a white spot at the detected coordinates
  306. if (pressed) {
  307. tft.fillCircle(x, y, 2, TFT_WHITE);
  308. //Serial.print("x,y = ");
  309. //Serial.print(x);
  310. //Serial.print(",");
  311. //Serial.println(y);
  312. }
  313. }
  314. //====================================================================================
  315. // Decode and render the Jpeg image onto the TFT screen
  316. //====================================================================================
  317. void Display::jpegRender(int xpos, int ypos) {
  318. // retrieve infomration about the image
  319. uint16_t *pImg;
  320. int16_t mcu_w = JpegDec.MCUWidth;
  321. int16_t mcu_h = JpegDec.MCUHeight;
  322. int32_t max_x = JpegDec.width;
  323. int32_t max_y = JpegDec.height;
  324. // Jpeg images are draw as a set of image block (tiles) called Minimum Coding Units (MCUs)
  325. // Typically these MCUs are 16x16 pixel blocks
  326. // Determine the width and height of the right and bottom edge image blocks
  327. int32_t min_w = minimum(mcu_w, max_x % mcu_w);
  328. int32_t min_h = minimum(mcu_h, max_y % mcu_h);
  329. // save the current image block size
  330. int32_t win_w = mcu_w;
  331. int32_t win_h = mcu_h;
  332. // record the current time so we can measure how long it takes to draw an image
  333. uint32_t drawTime = millis();
  334. // save the coordinate of the right and bottom edges to assist image cropping
  335. // to the screen size
  336. max_x += xpos;
  337. max_y += ypos;
  338. // read each MCU block until there are no more
  339. while ( JpegDec.readSwappedBytes()) { // Swapped byte order read
  340. // save a pointer to the image block
  341. pImg = JpegDec.pImage;
  342. // calculate where the image block should be drawn on the screen
  343. int mcu_x = JpegDec.MCUx * mcu_w + xpos; // Calculate coordinates of top left corner of current MCU
  344. int mcu_y = JpegDec.MCUy * mcu_h + ypos;
  345. // check if the image block size needs to be changed for the right edge
  346. if (mcu_x + mcu_w <= max_x) win_w = mcu_w;
  347. else win_w = min_w;
  348. // check if the image block size needs to be changed for the bottom edge
  349. if (mcu_y + mcu_h <= max_y) win_h = mcu_h;
  350. else win_h = min_h;
  351. // copy pixels into a contiguous block
  352. if (win_w != mcu_w)
  353. {
  354. for (int h = 1; h < win_h-1; h++)
  355. {
  356. memcpy(pImg + h * win_w, pImg + (h + 1) * mcu_w, win_w << 1);
  357. }
  358. }
  359. // draw image MCU block only if it will fit on the screen
  360. if ( mcu_x < tft.width() && mcu_y < tft.height())
  361. {
  362. // Now push the image block to the screen
  363. tft.pushImage(mcu_x, mcu_y, win_w, win_h, pImg);
  364. }
  365. else if ( ( mcu_y + win_h) >= tft.height()) JpegDec.abort();
  366. }
  367. // calculate how long it took to draw the image
  368. drawTime = millis() - drawTime; // Calculate the time it took
  369. }
  370. //====================================================================================
  371. // Print information decoded from the Jpeg image
  372. //====================================================================================
  373. void Display::jpegInfo() {
  374. /*
  375. Serial.println("===============");
  376. Serial.println("JPEG image info");
  377. Serial.println("===============");
  378. Serial.print ("Width :"); Serial.println(JpegDec.width);
  379. Serial.print ("Height :"); Serial.println(JpegDec.height);
  380. Serial.print ("Components :"); Serial.println(JpegDec.comps);
  381. Serial.print ("MCU / row :"); Serial.println(JpegDec.MCUSPerRow);
  382. Serial.print ("MCU / col :"); Serial.println(JpegDec.MCUSPerCol);
  383. Serial.print ("Scan type :"); Serial.println(JpegDec.scanType);
  384. Serial.print ("MCU width :"); Serial.println(JpegDec.MCUWidth);
  385. Serial.print ("MCU height :"); Serial.println(JpegDec.MCUHeight);
  386. Serial.println("===============");
  387. Serial.println("");
  388. */
  389. }
  390. //====================================================================================
  391. // Open a Jpeg file and send it to the Serial port in a C array compatible format
  392. //====================================================================================
  393. void createArray(const char *filename) {
  394. // Open the named file
  395. fs::File jpgFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
  396. // File jpgFile = SD.open( filename, FILE_READ); // or, file handle reference for SD library
  397. if ( !jpgFile ) {
  398. Serial.print("ERROR: File \""); Serial.print(filename); Serial.println ("\" not found!");
  399. return;
  400. }
  401. uint8_t data;
  402. byte line_len = 0;
  403. Serial.println("");
  404. Serial.println("// Generated by a JPEGDecoder library example sketch:");
  405. Serial.println("// https://github.com/Bodmer/JPEGDecoder");
  406. Serial.println("");
  407. Serial.println("#if defined(__AVR__)");
  408. Serial.println(" #include <avr/pgmspace.h>");
  409. Serial.println("#endif");
  410. Serial.println("");
  411. Serial.print ("const uint8_t ");
  412. while (*filename != '.') Serial.print(*filename++);
  413. Serial.println("[] PROGMEM = {"); // PROGMEM added for AVR processors, it is ignored by Due
  414. while ( jpgFile.available()) {
  415. data = jpgFile.read();
  416. Serial.print("0x"); if (abs(data) < 16) Serial.print("0");
  417. Serial.print(data, HEX); Serial.print(",");// Add value and comma
  418. line_len++;
  419. if ( line_len >= 32) {
  420. line_len = 0;
  421. Serial.println();
  422. }
  423. }
  424. Serial.println("};\r\n");
  425. jpgFile.close();
  426. }
  427. // End JPEG_functions
  428. // SPIFFS_functions
  429. #ifdef ESP8266
  430. void Display::listFiles(void) {
  431. Serial.println();
  432. Serial.println("SPIFFS files found:");
  433. fs::Dir dir = SPIFFS.openDir("/"); // Root directory
  434. String line = "=====================================";
  435. Serial.println(line);
  436. Serial.println(" File name Size");
  437. Serial.println(line);
  438. while (dir.next()) {
  439. String fileName = dir.fileName();
  440. Serial.print(fileName);
  441. int spaces = 21 - fileName.length(); // Tabulate nicely
  442. while (spaces--) Serial.print(" ");
  443. fs::File f = dir.openFile("r");
  444. String fileSize = (String) f.size();
  445. spaces = 10 - fileSize.length(); // Tabulate nicely
  446. while (spaces--) Serial.print(" ");
  447. Serial.println(fileSize + " bytes");
  448. }
  449. Serial.println(line);
  450. Serial.println();
  451. delay(1000);
  452. }
  453. #endif
  454. //====================================================================================
  455. #ifdef ESP32
  456. void Display::listFiles(void) {
  457. listDir(SPIFFS, "/", 0);
  458. }
  459. void Display::listDir(fs::FS &fs, const char * dirname, uint8_t levels) {
  460. Serial.println();
  461. Serial.println("SPIFFS files found:");
  462. Serial.printf("Listing directory: %s\n", "/");
  463. String line = "=====================================";
  464. Serial.println(line);
  465. Serial.println(" File name Size");
  466. Serial.println(line);
  467. fs::File root = fs.open(dirname);
  468. if (!root) {
  469. Serial.println("Failed to open directory");
  470. return;
  471. }
  472. if (!root.isDirectory()) {
  473. Serial.println("Not a directory");
  474. return;
  475. }
  476. fs::File file = root.openNextFile();
  477. while (file) {
  478. if (file.isDirectory()) {
  479. Serial.print("DIR : ");
  480. String fileName = file.name();
  481. Serial.print(fileName);
  482. if (levels) {
  483. listDir(fs, file.name(), levels - 1);
  484. }
  485. } else {
  486. String fileName = file.name();
  487. Serial.print(" " + fileName);
  488. int spaces = 20 - fileName.length(); // Tabulate nicely
  489. while (spaces--) Serial.print(" ");
  490. String fileSize = (String) file.size();
  491. spaces = 10 - fileSize.length(); // Tabulate nicely
  492. while (spaces--) Serial.print(" ");
  493. Serial.println(fileSize + " bytes");
  494. }
  495. file = root.openNextFile();
  496. }
  497. Serial.println(line);
  498. Serial.println();
  499. delay(1000);
  500. }
  501. #endif
  502. void Display::updateBanner(String msg)
  503. {
  504. this->img.deleteSprite();
  505. this->img.setColorDepth(8);
  506. this->img.createSprite(SCREEN_WIDTH, TEXT_HEIGHT);
  507. this->buildBanner(msg, current_banner_pos);
  508. this->img.pushSprite(0, 0);
  509. current_banner_pos--;
  510. if (current_banner_pos <= 0)
  511. current_banner_pos = SCREEN_WIDTH;
  512. }
  513. void Display::buildBanner(String msg, int xpos)
  514. {
  515. int h = TEXT_HEIGHT;
  516. // We could just use fillSprite(color) but lets be a bit more creative...
  517. // Fill with rainbow stripes
  518. //while (h--) img.drawFastHLine(0, h, SCREEN_WIDTH, 255);
  519. // Draw some graphics, the text will apear to scroll over these
  520. //img.fillRect (SCREEN_WIDTH / 2 - 20, TEXT_HEIGHT / 2 - 10, 40, 20, TFT_YELLOW);
  521. //img.fillCircle(SCREEN_WIDTH / 2, TEXT_HEIGHT / 2, 10, TFT_ORANGE);
  522. // Now print text on top of the graphics
  523. img.setTextSize(2); // Font size scaling is x1
  524. img.setTextFont(0); // Font 4 selected
  525. img.setTextColor(TFT_WHITE); // Black text, no background colour
  526. img.setTextWrap(false); // Turn of wrap so we can print past end of sprite
  527. // Need to print twice so text appears to wrap around at left and right edges
  528. img.setCursor(xpos, 2); // Print text at xpos
  529. img.print(msg);
  530. img.setCursor(xpos - SCREEN_WIDTH, 2); // Print text at xpos - sprite width
  531. img.print(msg);
  532. }
  533. void Display::main()
  534. {
  535. return;
  536. }
  537. // End SPIFFS_functions