GxEPD2_Example.ino 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  1. // Display Library example for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
  2. // Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines!
  3. //
  4. // Display Library based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html
  5. //
  6. // Author: Jean-Marc Zingg
  7. //
  8. // Version: see library.properties
  9. //
  10. // Library: https://github.com/ZinggJM/GxEPD2
  11. // Supporting Arduino Forum Topics:
  12. // Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
  13. // Good Display ePaper for Arduino: https://forum.arduino.cc/index.php?topic=436411.0
  14. // see GxEPD2_wiring_examples.h for wiring suggestions and examples
  15. // base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter, uses ~1.2k more code
  16. // enable or disable GxEPD2_GFX base class
  17. #define ENABLE_GxEPD2_GFX 0
  18. // uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX
  19. //#include <GFX.h>
  20. // Note: if you use this with ENABLE_GxEPD2_GFX 1:
  21. // uncomment it in GxEPD2_GFX.h too, or add #include <GFX.h> before any #include <GxEPD2_GFX.h>
  22. #include <GxEPD2_BW.h>
  23. #include <GxEPD2_3C.h>
  24. #include <GxEPD2_7C.h>
  25. #include <Fonts/FreeMonoBold9pt7b.h>
  26. // select the display constructor line in one of the following files (old style):
  27. #include "GxEPD2_display_selection.h"
  28. #include "GxEPD2_display_selection_added.h"
  29. //#include "GxEPD2_display_selection_more.h" // private
  30. // or select the display class and display driver class in the following file (new style):
  31. #include "GxEPD2_display_selection_new_style.h"
  32. #if !defined(__AVR) && !defined(_BOARD_GENERIC_STM32F103C_H_) && !defined(ARDUINO_BLUEPILL_F103C8)
  33. // note 16.11.2019: the compiler may exclude code based on constant if statements (display.epd2.panel == constant),
  34. // therefore bitmaps may get optimized out by the linker
  35. // comment out unused bitmaps to reduce code space used
  36. #include "bitmaps/Bitmaps80x128.h" // 1.02" b/w
  37. #include "bitmaps/Bitmaps152x152.h" // 1.54" b/w
  38. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  39. #include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  40. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  41. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  42. #include "bitmaps/Bitmaps152x296.h" // 2.6" b/w
  43. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  44. #include "bitmaps/Bitmaps240x416.h" // 3.71" b/w
  45. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  46. #include "bitmaps/Bitmaps648x480.h" // 5.38" b/w
  47. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  48. #include "bitmaps/Bitmaps800x480.h" // 7.5" b/w
  49. // 3-color
  50. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  51. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  52. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  53. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  54. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  55. #if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
  56. #include "bitmaps/Bitmaps3c800x480.h" // 7.5" b/w/r
  57. #include "bitmaps/Bitmaps3c880x528.h" // 7.5" b/w/r
  58. #include "bitmaps/WS_Bitmaps800x600.h" // 6.0" grey
  59. #include "bitmaps/WS_Bitmaps7c192x143.h" // 5.65" 7-color
  60. #endif
  61. #if defined(ESP32)
  62. #include "bitmaps/Bitmaps1304x984.h" // 12.48" b/w
  63. #endif
  64. #else
  65. // select only one to fit in code space
  66. //#include "bitmaps/Bitmaps80x128.h" // 1.02" b/w
  67. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  68. //#include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  69. //#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  70. //#include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  71. //#include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  72. ////#include "bitmaps/Bitmaps400x300.h" // 4.2" b/w // not enough code space
  73. ////#include "bitmaps/Bitmaps640x384.h" // 7.5" b/w // not enough code space
  74. // 3-color
  75. //#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  76. //#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  77. //#include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  78. //#include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  79. ////#include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r // not enough code space
  80. #endif
  81. #if defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_RASPBERRY_PI_PICO)
  82. // SPI pins used by GoodDisplay DESPI-PICO. note: steals standard I2C pins PIN_WIRE_SDA (6), PIN_WIRE_SCL (7)
  83. // uncomment next line for use with GoodDisplay DESPI-PICO.
  84. arduino::MbedSPI SPI0(4, 7, 6); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  85. #endif
  86. void setup()
  87. {
  88. Serial.begin(115200);
  89. Serial.println();
  90. Serial.println("setup");
  91. delay(100);
  92. #if defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_RASPBERRY_PI_PICO)
  93. // uncomment next line for use with GoodDisplay DESPI-PICO, or use the extended init method
  94. //display.epd2.selectSPI(SPI0, SPISettings(4000000, MSBFIRST, SPI_MODE0));
  95. // uncomment next 2 lines to allow recovery from configuration failures
  96. pinMode(15, INPUT_PULLUP); // safety pin
  97. while (!digitalRead(15)) delay(100); // check safety pin for fail recovery
  98. #endif
  99. display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
  100. //display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
  101. //display.init(115200, true, 10, false, SPI0, SPISettings(4000000, MSBFIRST, SPI_MODE0)); // extended init method with SPI channel and/or settings selection
  102. // first update should be full refresh
  103. helloWorld();
  104. delay(1000);
  105. // partial refresh mode can be used to full screen,
  106. // effective if display panel hasFastPartialUpdate
  107. helloFullScreenPartialMode();
  108. delay(1000);
  109. //stripeTest(); return; // GDEH029Z13 issue
  110. helloArduino();
  111. delay(1000);
  112. helloEpaper();
  113. delay(1000);
  114. //helloValue(123.9, 1);
  115. //delay(1000);
  116. showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  117. delay(1000);
  118. if (display.epd2.WIDTH < 104)
  119. {
  120. showFont("glcdfont", 0);
  121. delay(1000);
  122. }
  123. drawBitmaps();
  124. #if !defined(__AVR) // takes too long!
  125. if (display.epd2.panel == GxEPD2::ACeP565)
  126. {
  127. //draw7colorlines();
  128. //delay(2000);
  129. draw7colors();
  130. delay(4000);
  131. }
  132. #endif
  133. if (display.epd2.hasPartialUpdate)
  134. {
  135. showPartialUpdate();
  136. delay(1000);
  137. } // else // on GDEW0154Z04 only full update available, doesn't look nice
  138. //drawCornerTest();
  139. //showBox(16, 16, 48, 32, false);
  140. //showBox(16, 56, 48, 32, true);
  141. display.powerOff();
  142. deepSleepTest();
  143. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  144. drawBitmaps1304x984();
  145. display.powerOff();
  146. #endif
  147. Serial.println("setup done");
  148. }
  149. void loop()
  150. {
  151. }
  152. // note for partial update window and setPartialWindow() method:
  153. // partial update window size and position is on byte boundary in physical x direction
  154. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  155. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  156. const char HelloWorld[] = "Hello World!";
  157. const char HelloArduino[] = "Hello Arduino!";
  158. const char HelloEpaper[] = "Hello E-Paper!";
  159. void helloWorld()
  160. {
  161. //Serial.println("helloWorld");
  162. display.setRotation(1);
  163. display.setFont(&FreeMonoBold9pt7b);
  164. if (display.epd2.WIDTH < 104) display.setFont(0);
  165. display.setTextColor(GxEPD_BLACK);
  166. int16_t tbx, tby; uint16_t tbw, tbh;
  167. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  168. // center bounding box by transposition of origin:
  169. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  170. uint16_t y = ((display.height() - tbh) / 2) - tby;
  171. display.setFullWindow();
  172. display.firstPage();
  173. do
  174. {
  175. display.fillScreen(GxEPD_WHITE);
  176. display.setCursor(x, y);
  177. display.print(HelloWorld);
  178. }
  179. while (display.nextPage());
  180. //Serial.println("helloWorld done");
  181. }
  182. void helloWorldForDummies()
  183. {
  184. //Serial.println("helloWorld");
  185. const char text[] = "Hello World!";
  186. // most e-papers have width < height (portrait) as native orientation, especially the small ones
  187. // in GxEPD2 rotation 0 is used for native orientation (most TFT libraries use 0 fix for portrait orientation)
  188. // set rotation to 1 (rotate right 90 degrees) to have enough space on small displays (landscape)
  189. display.setRotation(1);
  190. // select a suitable font in Adafruit_GFX
  191. display.setFont(&FreeMonoBold9pt7b);
  192. // on e-papers black on white is more pleasant to read
  193. display.setTextColor(GxEPD_BLACK);
  194. // Adafruit_GFX has a handy method getTextBounds() to determine the boundary box for a text for the actual font
  195. int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
  196. display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
  197. // center bounding box by transposition of origin:
  198. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  199. uint16_t y = ((display.height() - tbh) / 2) - tby;
  200. // full window mode is the initial mode, set it anyway
  201. display.setFullWindow();
  202. // here we use paged drawing, even if the processor has enough RAM for full buffer
  203. // so this can be used with any supported processor board.
  204. // the cost in code overhead and execution time penalty is marginal
  205. // tell the graphics class to use paged drawing mode
  206. display.firstPage();
  207. do
  208. {
  209. // this part of code is executed multiple times, as many as needed,
  210. // in case of full buffer it is executed once
  211. // IMPORTANT: each iteration needs to draw the same, to avoid strange effects
  212. // use a copy of values that might change, don't read e.g. from analog or pins in the loop!
  213. display.fillScreen(GxEPD_WHITE); // set the background to white (fill the buffer with value for white)
  214. display.setCursor(x, y); // set the postition to start printing text
  215. display.print(text); // print some text
  216. // end of part executed multiple times
  217. }
  218. // tell the graphics class to transfer the buffer content (page) to the controller buffer
  219. // the graphics class will command the controller to refresh to the screen when the last page has been transferred
  220. // returns true if more pages need be drawn and transferred
  221. // returns false if the last page has been transferred and the screen refreshed for panels without fast partial update
  222. // returns false for panels with fast partial update when the controller buffer has been written once more, to make the differential buffers equal
  223. // (for full buffered with fast partial update the (full) buffer is just transferred again, and false returned)
  224. while (display.nextPage());
  225. //Serial.println("helloWorld done");
  226. }
  227. void helloFullScreenPartialMode()
  228. {
  229. //Serial.println("helloFullScreenPartialMode");
  230. const char fullscreen[] = "full screen update";
  231. const char fpm[] = "fast partial mode";
  232. const char spm[] = "slow partial mode";
  233. const char npm[] = "no partial mode";
  234. display.setPartialWindow(0, 0, display.width(), display.height());
  235. display.setRotation(1);
  236. display.setFont(&FreeMonoBold9pt7b);
  237. if (display.epd2.WIDTH < 104) display.setFont(0);
  238. display.setTextColor(GxEPD_BLACK);
  239. const char* updatemode;
  240. if (display.epd2.hasFastPartialUpdate)
  241. {
  242. updatemode = fpm;
  243. }
  244. else if (display.epd2.hasPartialUpdate)
  245. {
  246. updatemode = spm;
  247. }
  248. else
  249. {
  250. updatemode = npm;
  251. }
  252. // do this outside of the loop
  253. int16_t tbx, tby; uint16_t tbw, tbh;
  254. // center update text
  255. display.getTextBounds(fullscreen, 0, 0, &tbx, &tby, &tbw, &tbh);
  256. uint16_t utx = ((display.width() - tbw) / 2) - tbx;
  257. uint16_t uty = ((display.height() / 4) - tbh / 2) - tby;
  258. // center update mode
  259. display.getTextBounds(updatemode, 0, 0, &tbx, &tby, &tbw, &tbh);
  260. uint16_t umx = ((display.width() - tbw) / 2) - tbx;
  261. uint16_t umy = ((display.height() * 3 / 4) - tbh / 2) - tby;
  262. // center HelloWorld
  263. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  264. uint16_t hwx = ((display.width() - tbw) / 2) - tbx;
  265. uint16_t hwy = ((display.height() - tbh) / 2) - tby;
  266. display.firstPage();
  267. do
  268. {
  269. display.fillScreen(GxEPD_WHITE);
  270. display.setCursor(hwx, hwy);
  271. display.print(HelloWorld);
  272. display.setCursor(utx, uty);
  273. display.print(fullscreen);
  274. display.setCursor(umx, umy);
  275. display.print(updatemode);
  276. }
  277. while (display.nextPage());
  278. //Serial.println("helloFullScreenPartialMode done");
  279. }
  280. void helloArduino()
  281. {
  282. //Serial.println("helloArduino");
  283. display.setRotation(1);
  284. display.setFont(&FreeMonoBold9pt7b);
  285. if (display.epd2.WIDTH < 104) display.setFont(0);
  286. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  287. int16_t tbx, tby; uint16_t tbw, tbh;
  288. // align with centered HelloWorld
  289. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  290. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  291. // height might be different
  292. display.getTextBounds(HelloArduino, 0, 0, &tbx, &tby, &tbw, &tbh);
  293. uint16_t y = ((display.height() / 4) - tbh / 2) - tby; // y is base line!
  294. // make the window big enough to cover (overwrite) descenders of previous text
  295. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  296. uint16_t wy = (display.height() / 4) - wh / 2;
  297. display.setPartialWindow(0, wy, display.width(), wh);
  298. display.firstPage();
  299. do
  300. {
  301. display.fillScreen(GxEPD_WHITE);
  302. //display.drawRect(x, y - tbh, tbw, tbh, GxEPD_BLACK);
  303. display.setCursor(x, y);
  304. display.print(HelloArduino);
  305. }
  306. while (display.nextPage());
  307. delay(1000);
  308. //Serial.println("helloArduino done");
  309. }
  310. void helloEpaper()
  311. {
  312. //Serial.println("helloEpaper");
  313. display.setRotation(1);
  314. display.setFont(&FreeMonoBold9pt7b);
  315. if (display.epd2.WIDTH < 104) display.setFont(0);
  316. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  317. int16_t tbx, tby; uint16_t tbw, tbh;
  318. // align with centered HelloWorld
  319. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  320. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  321. // height might be different
  322. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  323. uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
  324. // make the window big enough to cover (overwrite) descenders of previous text
  325. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  326. uint16_t wy = (display.height() * 3 / 4) - wh / 2;
  327. display.setPartialWindow(0, wy, display.width(), wh);
  328. display.firstPage();
  329. do
  330. {
  331. display.fillScreen(GxEPD_WHITE);
  332. display.setCursor(x, y);
  333. display.print(HelloEpaper);
  334. }
  335. while (display.nextPage());
  336. //Serial.println("helloEpaper done");
  337. }
  338. // test partial window issue on GDEW0213Z19 and GDEH029Z13
  339. void stripeTest()
  340. {
  341. helloStripe(104);
  342. delay(2000);
  343. helloStripe(96);
  344. }
  345. const char HelloStripe[] = "Hello Stripe!";
  346. void helloStripe(uint16_t pw_xe) // end of partial window in physcal x direction
  347. {
  348. //Serial.print("HelloStripe("); Serial.print(pw_xe); Serial.println(")");
  349. display.setRotation(3);
  350. display.setFont(&FreeMonoBold9pt7b);
  351. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  352. int16_t tbx, tby; uint16_t tbw, tbh;
  353. display.getTextBounds(HelloStripe, 0, 0, &tbx, &tby, &tbw, &tbh);
  354. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  355. uint16_t wy = pw_xe - wh;
  356. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  357. uint16_t y = wy - tby;
  358. display.setPartialWindow(0, wy, display.width(), wh);
  359. display.firstPage();
  360. do
  361. {
  362. display.fillScreen(GxEPD_WHITE);
  363. display.setCursor(x, y);
  364. display.print(HelloStripe);
  365. }
  366. while (display.nextPage());
  367. //Serial.println("HelloStripe done");
  368. }
  369. #if defined(ESP8266) || defined(ESP32)
  370. #include <StreamString.h>
  371. #define PrintString StreamString
  372. #else
  373. class PrintString : public Print, public String
  374. {
  375. public:
  376. size_t write(uint8_t data) override
  377. {
  378. return concat(char(data));
  379. };
  380. };
  381. #endif
  382. void helloValue(double v, int digits)
  383. {
  384. //Serial.println("helloValue");
  385. display.setRotation(1);
  386. display.setFont(&FreeMonoBold9pt7b);
  387. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  388. PrintString valueString;
  389. valueString.print(v, digits);
  390. int16_t tbx, tby; uint16_t tbw, tbh;
  391. display.getTextBounds(valueString, 0, 0, &tbx, &tby, &tbw, &tbh);
  392. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  393. uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
  394. // show what happens, if we use the bounding box for partial window
  395. uint16_t wx = (display.width() - tbw) / 2;
  396. uint16_t wy = ((display.height() * 3 / 4) - tbh / 2);
  397. display.setPartialWindow(wx, wy, tbw, tbh);
  398. display.firstPage();
  399. do
  400. {
  401. display.fillScreen(GxEPD_WHITE);
  402. display.setCursor(x, y);
  403. display.print(valueString);
  404. }
  405. while (display.nextPage());
  406. delay(2000);
  407. // make the partial window big enough to cover the previous text
  408. uint16_t ww = tbw; // remember window width
  409. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  410. // adjust, because HelloEpaper was aligned, not centered (could calculate this to be precise)
  411. ww = max(ww, uint16_t(tbw + 12)); // 12 seems ok
  412. wx = (display.width() - tbw) / 2;
  413. // make the window big enough to cover (overwrite) descenders of previous text
  414. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  415. wy = (display.height() * 3 / 4) - wh / 2;
  416. display.setPartialWindow(wx, wy, ww, wh);
  417. // alternately use the whole width for partial window
  418. //display.setPartialWindow(0, wy, display.width(), wh);
  419. display.firstPage();
  420. do
  421. {
  422. display.fillScreen(GxEPD_WHITE);
  423. display.setCursor(x, y);
  424. display.print(valueString);
  425. }
  426. while (display.nextPage());
  427. //Serial.println("helloValue done");
  428. }
  429. void deepSleepTest()
  430. {
  431. //Serial.println("deepSleepTest");
  432. const char hibernating[] = "hibernating ...";
  433. const char wokeup[] = "woke up";
  434. const char from[] = "from deep sleep";
  435. const char again[] = "again";
  436. display.setRotation(1);
  437. display.setFont(&FreeMonoBold9pt7b);
  438. if (display.epd2.WIDTH < 104) display.setFont(0);
  439. display.setTextColor(GxEPD_BLACK);
  440. int16_t tbx, tby; uint16_t tbw, tbh;
  441. // center text
  442. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  443. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  444. uint16_t y = ((display.height() - tbh) / 2) - tby;
  445. display.setFullWindow();
  446. display.firstPage();
  447. do
  448. {
  449. display.fillScreen(GxEPD_WHITE);
  450. display.setCursor(x, y);
  451. display.print(hibernating);
  452. }
  453. while (display.nextPage());
  454. display.hibernate();
  455. delay(5000);
  456. display.getTextBounds(wokeup, 0, 0, &tbx, &tby, &tbw, &tbh);
  457. uint16_t wx = (display.width() - tbw) / 2;
  458. uint16_t wy = ((display.height() / 3) - tbh / 2) - tby; // y is base line!
  459. display.getTextBounds(from, 0, 0, &tbx, &tby, &tbw, &tbh);
  460. uint16_t fx = (display.width() - tbw) / 2;
  461. uint16_t fy = ((display.height() * 2 / 3) - tbh / 2) - tby; // y is base line!
  462. display.firstPage();
  463. do
  464. {
  465. display.fillScreen(GxEPD_WHITE);
  466. display.setCursor(wx, wy);
  467. display.print(wokeup);
  468. display.setCursor(fx, fy);
  469. display.print(from);
  470. }
  471. while (display.nextPage());
  472. delay(5000);
  473. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  474. uint16_t hx = (display.width() - tbw) / 2;
  475. uint16_t hy = ((display.height() / 3) - tbh / 2) - tby; // y is base line!
  476. display.getTextBounds(again, 0, 0, &tbx, &tby, &tbw, &tbh);
  477. uint16_t ax = (display.width() - tbw) / 2;
  478. uint16_t ay = ((display.height() * 2 / 3) - tbh / 2) - tby; // y is base line!
  479. display.firstPage();
  480. do
  481. {
  482. display.fillScreen(GxEPD_WHITE);
  483. display.setCursor(hx, hy);
  484. display.print(hibernating);
  485. display.setCursor(ax, ay);
  486. display.print(again);
  487. }
  488. while (display.nextPage());
  489. display.hibernate();
  490. //Serial.println("deepSleepTest done");
  491. }
  492. void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  493. {
  494. //Serial.println("showBox");
  495. display.setRotation(1);
  496. if (partial)
  497. {
  498. display.setPartialWindow(x, y, w, h);
  499. }
  500. else
  501. {
  502. display.setFullWindow();
  503. }
  504. display.firstPage();
  505. do
  506. {
  507. display.fillScreen(GxEPD_WHITE);
  508. display.fillRect(x, y, w, h, GxEPD_BLACK);
  509. }
  510. while (display.nextPage());
  511. //Serial.println("showBox done");
  512. }
  513. void drawCornerTest()
  514. {
  515. display.setFullWindow();
  516. display.setFont(&FreeMonoBold9pt7b);
  517. display.setTextColor(GxEPD_BLACK);
  518. for (uint16_t r = 0; r <= 4; r++)
  519. {
  520. display.setRotation(r);
  521. display.firstPage();
  522. do
  523. {
  524. display.fillScreen(GxEPD_WHITE);
  525. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  526. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  527. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  528. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  529. display.setCursor(display.width() / 2, display.height() / 2);
  530. display.print(display.getRotation());
  531. }
  532. while (display.nextPage());
  533. delay(2000);
  534. }
  535. }
  536. void showFont(const char name[], const GFXfont* f)
  537. {
  538. display.setFullWindow();
  539. display.setRotation(0);
  540. display.setTextColor(GxEPD_BLACK);
  541. display.firstPage();
  542. do
  543. {
  544. drawFont(name, f);
  545. }
  546. while (display.nextPage());
  547. }
  548. void drawFont(const char name[], const GFXfont* f)
  549. {
  550. //display.setRotation(0);
  551. display.fillScreen(GxEPD_WHITE);
  552. display.setTextColor(GxEPD_BLACK);
  553. display.setFont(f);
  554. display.setCursor(0, 0);
  555. display.println();
  556. display.println(name);
  557. display.println(" !\"#$%&'()*+,-./");
  558. display.println("0123456789:;<=>?");
  559. display.println("@ABCDEFGHIJKLMNO");
  560. display.println("PQRSTUVWXYZ[\\]^_");
  561. if (display.epd2.hasColor)
  562. {
  563. display.setTextColor(GxEPD_RED);
  564. }
  565. display.println("`abcdefghijklmno");
  566. display.println("pqrstuvwxyz{|}~ ");
  567. }
  568. // note for partial update window and setPartialWindow() method:
  569. // partial update window size and position is on byte boundary in physical x direction
  570. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  571. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  572. // showPartialUpdate() purposely uses values that are not multiples of 8 to test this
  573. void showPartialUpdate()
  574. {
  575. // some useful background
  576. helloWorld();
  577. // use asymmetric values for test
  578. uint16_t box_x = 10;
  579. uint16_t box_y = 15;
  580. uint16_t box_w = 70;
  581. uint16_t box_h = 20;
  582. uint16_t cursor_y = box_y + box_h - 6;
  583. if (display.epd2.WIDTH < 104) cursor_y = box_y + 6;
  584. float value = 13.95;
  585. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  586. display.setFont(&FreeMonoBold9pt7b);
  587. if (display.epd2.WIDTH < 104) display.setFont(0);
  588. display.setTextColor(GxEPD_BLACK);
  589. // show where the update box is
  590. for (uint16_t r = 0; r < 4; r++)
  591. {
  592. display.setRotation(r);
  593. display.setPartialWindow(box_x, box_y, box_w, box_h);
  594. display.firstPage();
  595. do
  596. {
  597. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  598. //display.fillScreen(GxEPD_BLACK);
  599. }
  600. while (display.nextPage());
  601. delay(2000);
  602. display.firstPage();
  603. do
  604. {
  605. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  606. }
  607. while (display.nextPage());
  608. delay(1000);
  609. }
  610. //return;
  611. // show updates in the update box
  612. for (uint16_t r = 0; r < 4; r++)
  613. {
  614. display.setRotation(r);
  615. display.setPartialWindow(box_x, box_y, box_w, box_h);
  616. for (uint16_t i = 1; i <= 10; i += incr)
  617. {
  618. display.firstPage();
  619. do
  620. {
  621. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  622. display.setCursor(box_x, cursor_y);
  623. display.print(value * i, 2);
  624. }
  625. while (display.nextPage());
  626. delay(500);
  627. }
  628. delay(1000);
  629. display.firstPage();
  630. do
  631. {
  632. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  633. }
  634. while (display.nextPage());
  635. delay(1000);
  636. }
  637. }
  638. void drawBitmaps()
  639. {
  640. display.setFullWindow();
  641. #ifdef _GxBitmaps80x128_H_
  642. drawBitmaps80x128();
  643. #endif
  644. #ifdef _GxBitmaps152x152_H_
  645. drawBitmaps152x152();
  646. #endif
  647. #ifdef _GxBitmaps104x212_H_
  648. drawBitmaps104x212();
  649. #endif
  650. #ifdef _GxBitmaps128x250_H_
  651. drawBitmaps128x250();
  652. #endif
  653. #ifdef _GxBitmaps128x296_H_
  654. drawBitmaps128x296();
  655. #endif
  656. #ifdef _GxBitmaps176x264_H_
  657. drawBitmaps176x264();
  658. #endif
  659. #ifdef _GxBitmaps400x300_H_
  660. drawBitmaps400x300();
  661. #endif
  662. #ifdef _GxBitmaps640x384_H_
  663. drawBitmaps640x384();
  664. #endif
  665. #ifdef _GxBitmaps648x480_H_
  666. drawBitmaps648x480();
  667. #endif
  668. #ifdef _GxBitmaps800x480_H_
  669. drawBitmaps800x480();
  670. #endif
  671. #ifdef _WS_Bitmaps800x600_H_
  672. drawBitmaps800x600();
  673. #endif
  674. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  675. drawBitmaps1304x984();
  676. #endif
  677. // 3-color
  678. #ifdef _GxBitmaps3c104x212_H_
  679. drawBitmaps3c104x212();
  680. #endif
  681. #ifdef _GxBitmaps3c128x296_H_
  682. drawBitmaps3c128x296();
  683. #endif
  684. #ifdef _GxBitmaps152x296_H_
  685. drawBitmaps152x296();
  686. #endif
  687. #ifdef _GxBitmaps3c176x264_H_
  688. drawBitmaps3c176x264();
  689. #endif
  690. #ifdef _GxBitmaps240x416_H_
  691. drawBitmaps240x416();
  692. #endif
  693. #ifdef _GxBitmaps3c400x300_H_
  694. drawBitmaps3c400x300();
  695. #endif
  696. #ifdef _GxBitmaps3c800x480_H_
  697. drawBitmaps3c800x480();
  698. #endif
  699. #ifdef _GxBitmaps3c880x528_H_
  700. drawBitmaps3c880x528();
  701. #endif
  702. #if defined(_WS_Bitmaps7c192x143_H_)
  703. drawBitmaps7c192x143();
  704. #endif
  705. if ((display.epd2.WIDTH >= 200) && (display.epd2.HEIGHT >= 200))
  706. {
  707. // show these after the specific bitmaps
  708. #ifdef _GxBitmaps200x200_H_
  709. drawBitmaps200x200();
  710. #endif
  711. // 3-color
  712. #ifdef _GxBitmaps3c200x200_H_
  713. drawBitmaps3c200x200();
  714. #endif
  715. }
  716. }
  717. #ifdef _GxBitmaps80x128_H_
  718. void drawBitmaps80x128()
  719. {
  720. #if !defined(__AVR)
  721. const unsigned char* bitmaps[] =
  722. {
  723. Bitmap80x128_1, Bitmap80x128_2, Bitmap80x128_3, Bitmap80x128_4, Bitmap80x128_5
  724. };
  725. #else
  726. const unsigned char* bitmaps[] =
  727. {
  728. Bitmap80x128_1, Bitmap80x128_2, Bitmap80x128_3, Bitmap80x128_4, Bitmap80x128_5
  729. };
  730. #endif
  731. if ((display.epd2.WIDTH == 80) && (display.epd2.HEIGHT == 128))
  732. {
  733. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  734. {
  735. display.firstPage();
  736. do
  737. {
  738. display.fillScreen(GxEPD_WHITE);
  739. display.drawInvertedBitmap(0, 0, bitmaps[i], 80, 128, GxEPD_BLACK);
  740. }
  741. while (display.nextPage());
  742. delay(2000);
  743. }
  744. display.firstPage();
  745. do
  746. {
  747. display.fillScreen(GxEPD_WHITE);
  748. display.drawBitmap(0, 0, WS_Bitmap80x128, 80, 128, GxEPD_BLACK);
  749. }
  750. while (display.nextPage());
  751. delay(2000);
  752. }
  753. }
  754. #endif
  755. #ifdef _GxBitmaps152x152_H_
  756. void drawBitmaps152x152()
  757. {
  758. #if !defined(__AVR)
  759. const unsigned char* bitmaps[] =
  760. {
  761. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  762. };
  763. #else
  764. const unsigned char* bitmaps[] =
  765. {
  766. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  767. };
  768. #endif
  769. if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 152))
  770. {
  771. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  772. {
  773. display.firstPage();
  774. do
  775. {
  776. display.fillScreen(GxEPD_WHITE);
  777. display.drawInvertedBitmap(0, 0, bitmaps[i], 152, 152, GxEPD_BLACK);
  778. }
  779. while (display.nextPage());
  780. delay(2000);
  781. }
  782. }
  783. }
  784. #endif
  785. #ifdef _GxBitmaps200x200_H_
  786. void drawBitmaps200x200()
  787. {
  788. #if defined(ARDUINO_AVR_PRO)
  789. const unsigned char* bitmaps[] =
  790. {
  791. logo200x200
  792. };
  793. #elif defined(__AVR)
  794. const unsigned char* bitmaps[] =
  795. {
  796. logo200x200, //first200x200
  797. };
  798. #elif defined(_BOARD_GENERIC_STM32F103C_H_) || defined(STM32F1xx)
  799. const unsigned char* bitmaps[] =
  800. {
  801. logo200x200, first200x200, second200x200, third200x200, //fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  802. };
  803. #else
  804. const unsigned char* bitmaps[] =
  805. {
  806. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  807. //logo200x200, first200x200, second200x200, fourth200x200, third200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200 // ED037TC1 test
  808. };
  809. #endif
  810. if ((display.epd2.WIDTH == 200) && (display.epd2.HEIGHT == 200) && !display.epd2.hasColor)
  811. {
  812. bool m = display.mirror(true);
  813. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  814. {
  815. display.firstPage();
  816. do
  817. {
  818. display.fillScreen(GxEPD_WHITE);
  819. display.drawInvertedBitmap(0, 0, bitmaps[i], 200, 200, GxEPD_BLACK);
  820. }
  821. while (display.nextPage());
  822. delay(2000);
  823. }
  824. display.mirror(m);
  825. }
  826. //else
  827. {
  828. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  829. display.clearScreen(); // use default for white
  830. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  831. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  832. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  833. {
  834. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  835. delay(2000);
  836. }
  837. }
  838. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  839. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  840. {
  841. int16_t x = -60;
  842. int16_t y = -60;
  843. for (uint16_t j = 0; j < 10; j++)
  844. {
  845. display.writeScreenBuffer(); // use default for white
  846. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  847. display.refresh(true);
  848. if (display.epd2.hasFastPartialUpdate)
  849. {
  850. // for differential update: set previous buffer equal to current buffer in controller
  851. display.epd2.writeScreenBufferAgain(); // use default for white
  852. display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  853. }
  854. delay(2000);
  855. x += display.epd2.WIDTH / 4;
  856. y += display.epd2.HEIGHT / 4;
  857. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  858. }
  859. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  860. break; // comment out for full show
  861. }
  862. display.writeScreenBuffer(); // use default for white
  863. display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  864. display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  865. display.refresh(true);
  866. // for differential update: set previous buffer equal to current buffer in controller
  867. display.epd2.writeScreenBufferAgain(); // use default for white
  868. display.epd2.writeImageAgain(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  869. display.epd2.writeImageAgain(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  870. delay(2000);
  871. }
  872. #endif
  873. #ifdef _GxBitmaps104x212_H_
  874. void drawBitmaps104x212()
  875. {
  876. #if !defined(__AVR)
  877. const unsigned char* bitmaps[] =
  878. {
  879. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  880. };
  881. #else
  882. const unsigned char* bitmaps[] =
  883. {
  884. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  885. };
  886. #endif
  887. if ((display.epd2.WIDTH == 104) && (display.epd2.HEIGHT == 212) && !display.epd2.hasColor)
  888. {
  889. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  890. {
  891. display.firstPage();
  892. do
  893. {
  894. display.fillScreen(GxEPD_WHITE);
  895. display.drawBitmap(0, 0, bitmaps[i], 104, 212, GxEPD_BLACK);
  896. }
  897. while (display.nextPage());
  898. delay(2000);
  899. }
  900. }
  901. }
  902. #endif
  903. #ifdef _GxBitmaps128x250_H_
  904. void drawBitmaps128x250()
  905. {
  906. #if !defined(__AVR)
  907. const unsigned char* bitmaps[] =
  908. {
  909. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  910. };
  911. #else
  912. const unsigned char* bitmaps[] =
  913. {
  914. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  915. };
  916. #endif
  917. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 250) && !display.epd2.hasColor)
  918. {
  919. bool m = display.mirror(true);
  920. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  921. {
  922. display.firstPage();
  923. do
  924. {
  925. display.fillScreen(GxEPD_WHITE);
  926. display.drawInvertedBitmap(0, 0, bitmaps[i], 128, 250, GxEPD_BLACK);
  927. }
  928. while (display.nextPage());
  929. delay(2000);
  930. }
  931. display.mirror(m);
  932. }
  933. }
  934. #endif
  935. #ifdef _GxBitmaps128x296_H_
  936. void drawBitmaps128x296()
  937. {
  938. #if !defined(__AVR)
  939. const unsigned char* bitmaps[] =
  940. {
  941. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  942. };
  943. #else
  944. const unsigned char* bitmaps[] =
  945. {
  946. Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
  947. };
  948. #endif
  949. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 296) && !display.epd2.hasColor)
  950. {
  951. bool m = display.mirror(true);
  952. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  953. {
  954. display.firstPage();
  955. do
  956. {
  957. display.fillScreen(GxEPD_WHITE);
  958. display.drawInvertedBitmap(0, 0, bitmaps[i], 128, 296, GxEPD_BLACK);
  959. }
  960. while (display.nextPage());
  961. delay(2000);
  962. }
  963. display.mirror(m);
  964. }
  965. }
  966. #endif
  967. #ifdef _GxBitmaps152x296_H_
  968. void drawBitmaps152x296()
  969. {
  970. #if !defined(__AVR)
  971. const unsigned char* bitmaps[] =
  972. {
  973. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  974. };
  975. #else
  976. const unsigned char* bitmaps[] =
  977. {
  978. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  979. };
  980. #endif
  981. if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 296) && !display.epd2.hasColor)
  982. {
  983. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  984. {
  985. display.firstPage();
  986. do
  987. {
  988. display.fillScreen(GxEPD_WHITE);
  989. display.drawInvertedBitmap(0, 0, bitmaps[i], 152, 296, GxEPD_BLACK);
  990. }
  991. while (display.nextPage());
  992. delay(2000);
  993. }
  994. }
  995. }
  996. #endif
  997. #ifdef _GxBitmaps176x264_H_
  998. void drawBitmaps176x264()
  999. {
  1000. #if !defined(__AVR)
  1001. const unsigned char* bitmaps[] =
  1002. {
  1003. Bitmap176x264_1, Bitmap176x264_2, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1004. };
  1005. #else
  1006. const unsigned char* bitmaps[] =
  1007. {
  1008. Bitmap176x264_1, Bitmap176x264_2 //, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1009. };
  1010. #endif
  1011. if ((display.epd2.WIDTH == 176) && (display.epd2.HEIGHT == 264) && !display.epd2.hasColor)
  1012. {
  1013. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1014. {
  1015. display.firstPage();
  1016. do
  1017. {
  1018. display.fillScreen(GxEPD_WHITE);
  1019. display.drawInvertedBitmap(0, 0, bitmaps[i], 176, 264, GxEPD_BLACK);
  1020. }
  1021. while (display.nextPage());
  1022. delay(2000);
  1023. }
  1024. }
  1025. }
  1026. #endif
  1027. #ifdef _GxBitmaps240x416_H_
  1028. void drawBitmaps240x416()
  1029. {
  1030. #if !defined(__AVR)
  1031. const unsigned char* bitmaps[] =
  1032. {
  1033. Bitmap240x416_1, Bitmap240x416_2, Bitmap240x416_3
  1034. };
  1035. #else
  1036. const unsigned char* bitmaps[] =
  1037. {
  1038. Bitmap240x460_1, Bitmap240x460_2, Bitmap240x460_3
  1039. };
  1040. #endif
  1041. if ((display.epd2.WIDTH == 240) && (display.epd2.HEIGHT == 416) && !display.epd2.hasColor)
  1042. {
  1043. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1044. {
  1045. display.firstPage();
  1046. do
  1047. {
  1048. display.fillScreen(GxEPD_WHITE);
  1049. display.drawInvertedBitmap(0, 0, bitmaps[i], 240, 416, GxEPD_BLACK);
  1050. }
  1051. while (display.nextPage());
  1052. delay(2000);
  1053. }
  1054. }
  1055. }
  1056. #endif
  1057. #ifdef _GxBitmaps400x300_H_
  1058. void drawBitmaps400x300()
  1059. {
  1060. #if !defined(__AVR)
  1061. const unsigned char* bitmaps[] =
  1062. {
  1063. Bitmap400x300_1, Bitmap400x300_2
  1064. };
  1065. #else
  1066. const unsigned char* bitmaps[] = {}; // not enough code space
  1067. #endif
  1068. if ((display.epd2.WIDTH == 400) && (display.epd2.HEIGHT == 300) && !display.epd2.hasColor)
  1069. {
  1070. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1071. {
  1072. display.firstPage();
  1073. do
  1074. {
  1075. display.fillScreen(GxEPD_WHITE);
  1076. display.drawInvertedBitmap(0, 0, bitmaps[i], 400, 300, GxEPD_BLACK);
  1077. }
  1078. while (display.nextPage());
  1079. delay(2000);
  1080. }
  1081. }
  1082. }
  1083. #endif
  1084. #ifdef _GxBitmaps640x384_H_
  1085. void drawBitmaps640x384()
  1086. {
  1087. #if !defined(__AVR)
  1088. const unsigned char* bitmaps[] =
  1089. {
  1090. Bitmap640x384_1, Bitmap640x384_2
  1091. };
  1092. #else
  1093. const unsigned char* bitmaps[] = {}; // not enough code space
  1094. #endif
  1095. if ((display.epd2.WIDTH == 640) && (display.epd2.HEIGHT == 384))
  1096. {
  1097. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1098. {
  1099. display.firstPage();
  1100. do
  1101. {
  1102. display.fillScreen(GxEPD_WHITE);
  1103. display.drawInvertedBitmap(0, 0, bitmaps[i], 640, 384, GxEPD_BLACK);
  1104. }
  1105. while (display.nextPage());
  1106. delay(2000);
  1107. }
  1108. }
  1109. }
  1110. #endif
  1111. #ifdef _GxBitmaps648x480_H_
  1112. void drawBitmaps648x480()
  1113. {
  1114. #if !defined(__AVR)
  1115. const unsigned char* bitmaps[] =
  1116. {
  1117. Bitmap648x480_1, Bitmap648x480_2, Bitmap648x480_3
  1118. };
  1119. #else
  1120. const unsigned char* bitmaps[] = {}; // not enough code space
  1121. #endif
  1122. if ((display.epd2.WIDTH == 648) && (display.epd2.HEIGHT == 480) && !display.epd2.hasColor)
  1123. {
  1124. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1125. {
  1126. display.firstPage();
  1127. do
  1128. {
  1129. display.fillScreen(GxEPD_WHITE);
  1130. display.drawBitmap(0, 0, bitmaps[i], 648, 480, GxEPD_BLACK);
  1131. }
  1132. while (display.nextPage());
  1133. delay(2000);
  1134. }
  1135. }
  1136. }
  1137. #endif
  1138. #ifdef _GxBitmaps800x480_H_
  1139. void drawBitmaps800x480()
  1140. {
  1141. #if !defined(__AVR)
  1142. const unsigned char* bitmaps[] =
  1143. {
  1144. Bitmap800x480_1, Bitmap800x480_2, Bitmap800x480_3, Bitmap800x480_4
  1145. };
  1146. #else
  1147. const unsigned char* bitmaps[] = {}; // not enough code space
  1148. #endif
  1149. if ((display.epd2.WIDTH == 800) && (display.epd2.HEIGHT == 480))
  1150. {
  1151. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1152. {
  1153. display.firstPage();
  1154. do
  1155. {
  1156. display.fillScreen(GxEPD_WHITE);
  1157. display.drawBitmap(0, 0, bitmaps[i], 800, 480, GxEPD_BLACK);
  1158. }
  1159. while (display.nextPage());
  1160. delay(2000);
  1161. }
  1162. if (display.epd2.panel == GxEPD2::GDEW075T7)
  1163. {
  1164. // avoid ghosting caused by OTP waveform
  1165. display.clearScreen();
  1166. display.refresh(false); // full update
  1167. }
  1168. }
  1169. }
  1170. #endif
  1171. #ifdef _WS_Bitmaps800x600_H_
  1172. void drawBitmaps800x600()
  1173. {
  1174. #if defined(ESP8266) || defined(ESP32)
  1175. if ((display.epd2.panel == GxEPD2::ED060SCT) || (display.epd2.panel == GxEPD2::ED060KC1) || (display.epd2.panel == GxEPD2::ED078KC2))
  1176. {
  1177. // Serial.print("sizeof(WS_zoo_800x600) is "); Serial.println(sizeof(WS_zoo_800x600));
  1178. display.drawNative(WS_zoo_800x600, 0, 0, 0, 800, 600, false, false, true);
  1179. delay(2000);
  1180. // Serial.print("sizeof(WS_pic_1200x825) is "); Serial.println(sizeof(WS_pic_1200x825));
  1181. // display.drawNative((const uint8_t*)WS_pic_1200x825, 0, 0, 0, 1200, 825, false, false, true);
  1182. // delay(2000);
  1183. // Serial.print("sizeof(WS_acaa_1024x731) is "); Serial.println(sizeof(WS_acaa_1024x731));
  1184. // display.drawNative(WS_acaa_1024x731, 0, 0, 0, 1024, 731, false, false, true);
  1185. // delay(2000);
  1186. }
  1187. #endif
  1188. }
  1189. #endif
  1190. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  1191. void drawBitmaps1304x984()
  1192. {
  1193. if (display.epd2.panel == GxEPD2::GDEW1248T3)
  1194. {
  1195. display.drawImage(Bitmap1304x984, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1196. }
  1197. }
  1198. #endif
  1199. struct bitmap_pair
  1200. {
  1201. const unsigned char* black;
  1202. const unsigned char* red;
  1203. };
  1204. #ifdef _GxBitmaps3c200x200_H_
  1205. void drawBitmaps3c200x200()
  1206. {
  1207. bitmap_pair bitmap_pairs[] =
  1208. {
  1209. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  1210. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  1211. };
  1212. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  1213. {
  1214. display.firstPage();
  1215. do
  1216. {
  1217. display.fillScreen(GxEPD_WHITE);
  1218. // Bitmap3c200x200_black has 2 bits per pixel
  1219. // taken from Adafruit_GFX.cpp, modified
  1220. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  1221. uint8_t byte = 0;
  1222. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  1223. {
  1224. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  1225. {
  1226. if (i & 3) byte <<= 2;
  1227. else
  1228. {
  1229. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  1230. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  1231. #else
  1232. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  1233. #endif
  1234. }
  1235. if (!(byte & 0x80))
  1236. {
  1237. display.drawPixel(i, j, GxEPD_BLACK);
  1238. }
  1239. }
  1240. }
  1241. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1242. }
  1243. while (display.nextPage());
  1244. delay(2000);
  1245. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1246. {
  1247. display.firstPage();
  1248. do
  1249. {
  1250. display.fillScreen(GxEPD_WHITE);
  1251. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1252. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1253. }
  1254. while (display.nextPage());
  1255. delay(2000);
  1256. }
  1257. }
  1258. if (display.epd2.hasColor)
  1259. {
  1260. display.clearScreen(); // use default for white
  1261. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1262. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1263. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1264. {
  1265. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1266. delay(2000);
  1267. }
  1268. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1269. {
  1270. int16_t x = -60;
  1271. int16_t y = -60;
  1272. for (uint16_t j = 0; j < 10; j++)
  1273. {
  1274. display.writeScreenBuffer(); // use default for white
  1275. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1276. display.refresh();
  1277. delay(1000);
  1278. x += display.epd2.WIDTH / 4;
  1279. y += display.epd2.HEIGHT / 4;
  1280. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1281. }
  1282. }
  1283. display.writeScreenBuffer(); // use default for white
  1284. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  1285. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, int16_t(display.epd2.WIDTH) - 200, int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, false, true);
  1286. display.refresh();
  1287. delay(2000);
  1288. }
  1289. }
  1290. #endif
  1291. #ifdef _GxBitmaps3c104x212_H_
  1292. void drawBitmaps3c104x212()
  1293. {
  1294. #if !defined(__AVR)
  1295. bitmap_pair bitmap_pairs[] =
  1296. {
  1297. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1298. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1299. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1300. };
  1301. #else
  1302. bitmap_pair bitmap_pairs[] =
  1303. {
  1304. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1305. //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1306. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1307. };
  1308. #endif
  1309. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  1310. {
  1311. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1312. {
  1313. display.firstPage();
  1314. do
  1315. {
  1316. display.fillScreen(GxEPD_WHITE);
  1317. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1318. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  1319. {
  1320. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1321. }
  1322. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1323. }
  1324. while (display.nextPage());
  1325. delay(2000);
  1326. }
  1327. }
  1328. }
  1329. #endif
  1330. #ifdef _GxBitmaps3c128x296_H_
  1331. void drawBitmaps3c128x296()
  1332. {
  1333. #if !defined(__AVR)
  1334. bitmap_pair bitmap_pairs[] =
  1335. {
  1336. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1337. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1338. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1339. };
  1340. #else
  1341. bitmap_pair bitmap_pairs[] =
  1342. {
  1343. //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1344. //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1345. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1346. };
  1347. #endif
  1348. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 296) && display.epd2.hasColor)
  1349. {
  1350. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1351. {
  1352. display.firstPage();
  1353. do
  1354. {
  1355. display.fillScreen(GxEPD_WHITE);
  1356. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 128, 296, GxEPD_BLACK);
  1357. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  1358. {
  1359. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 128, 296, GxEPD_RED);
  1360. }
  1361. else display.drawBitmap(0, 0, bitmap_pairs[i].red, 128, 296, GxEPD_RED);
  1362. }
  1363. while (display.nextPage());
  1364. delay(2000);
  1365. }
  1366. }
  1367. }
  1368. #endif
  1369. #ifdef _GxBitmaps3c176x264_H_
  1370. void drawBitmaps3c176x264()
  1371. {
  1372. bitmap_pair bitmap_pairs[] =
  1373. {
  1374. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  1375. };
  1376. if (display.epd2.panel == GxEPD2::GDEW027C44)
  1377. {
  1378. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1379. {
  1380. display.firstPage();
  1381. do
  1382. {
  1383. display.fillScreen(GxEPD_WHITE);
  1384. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1385. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1386. }
  1387. while (display.nextPage());
  1388. delay(2000);
  1389. }
  1390. }
  1391. }
  1392. #endif
  1393. #ifdef _GxBitmaps3c400x300_H_
  1394. void drawBitmaps3c400x300()
  1395. {
  1396. #if !defined(__AVR)
  1397. bitmap_pair bitmap_pairs[] =
  1398. {
  1399. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  1400. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  1401. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
  1402. };
  1403. #else
  1404. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1405. #endif
  1406. if (display.epd2.panel == GxEPD2::GDEW042Z15)
  1407. {
  1408. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1409. {
  1410. display.firstPage();
  1411. do
  1412. {
  1413. display.fillScreen(GxEPD_WHITE);
  1414. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1415. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1416. }
  1417. while (display.nextPage());
  1418. delay(2000);
  1419. }
  1420. }
  1421. }
  1422. #endif
  1423. #ifdef _GxBitmaps3c800x480_H_
  1424. void drawBitmaps3c800x480()
  1425. {
  1426. #if !defined(__AVR)
  1427. bitmap_pair bitmap_pairs[] =
  1428. {
  1429. {Bitmap3c800x480_1_black, Bitmap3c800x480_1_red}
  1430. };
  1431. #else
  1432. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1433. #endif
  1434. if (display.epd2.panel == GxEPD2::GDEW075Z08)
  1435. {
  1436. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1437. {
  1438. display.firstPage();
  1439. do
  1440. {
  1441. display.fillScreen(GxEPD_WHITE);
  1442. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1443. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1444. }
  1445. while (display.nextPage());
  1446. delay(2000);
  1447. }
  1448. }
  1449. }
  1450. #endif
  1451. #ifdef _GxBitmaps3c880x528_H_
  1452. void drawBitmaps3c880x528()
  1453. {
  1454. #if !defined(__AVR)
  1455. bitmap_pair bitmap_pairs[] =
  1456. {
  1457. {Bitmap3c880x528_black, Bitmap3c880x528_red}
  1458. };
  1459. #else
  1460. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1461. #endif
  1462. if (display.epd2.panel == GxEPD2::GDEH075Z90)
  1463. {
  1464. bool m = display.mirror(true);
  1465. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1466. {
  1467. display.firstPage();
  1468. do
  1469. {
  1470. display.fillScreen(GxEPD_WHITE);
  1471. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 880, 528, GxEPD_BLACK);
  1472. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 880, 528, GxEPD_RED);
  1473. }
  1474. while (display.nextPage());
  1475. delay(2000);
  1476. }
  1477. display.mirror(m);
  1478. }
  1479. }
  1480. #endif
  1481. #if defined(_WS_Bitmaps7c192x143_H_)
  1482. void drawBitmaps7c192x143()
  1483. {
  1484. if (display.epd2.panel == GxEPD2::ACeP565)
  1485. {
  1486. display.drawNative(WS_Bitmap7c192x143, 0, (display.epd2.WIDTH - 192) / 2, (display.epd2.HEIGHT - 143) / 2, 192, 143, false, false, true);
  1487. delay(5000);
  1488. }
  1489. }
  1490. #endif
  1491. void draw7colors()
  1492. {
  1493. display.setRotation(0);
  1494. uint16_t h = display.height() / 7;
  1495. display.firstPage();
  1496. do
  1497. {
  1498. display.fillRect(0, 0, display.width(), h, GxEPD_BLACK);
  1499. display.fillRect(0, h, display.width(), h, GxEPD_WHITE);
  1500. display.fillRect(0, 2 * h, display.width(), h, GxEPD_GREEN);
  1501. display.fillRect(0, 3 * h, display.width(), h, GxEPD_BLUE);
  1502. display.fillRect(0, 4 * h, display.width(), h, GxEPD_RED);
  1503. display.fillRect(0, 5 * h, display.width(), h, GxEPD_YELLOW);
  1504. display.fillRect(0, 6 * h, display.width(), h, GxEPD_ORANGE);
  1505. }
  1506. while (display.nextPage());
  1507. }
  1508. void draw7colorlines()
  1509. {
  1510. display.setRotation(0);
  1511. uint16_t h = 2;
  1512. display.firstPage();
  1513. do
  1514. {
  1515. uint16_t y = 0;
  1516. do
  1517. {
  1518. display.fillRect(0, y, display.width(), h, GxEPD_BLACK); y += h;
  1519. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1520. display.fillRect(0, y, display.width(), h, GxEPD_GREEN); y += h;
  1521. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1522. display.fillRect(0, y, display.width(), h, GxEPD_BLUE); y += h;
  1523. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1524. display.fillRect(0, y, display.width(), h, GxEPD_RED); y += h;
  1525. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1526. display.fillRect(0, y, display.width(), h, GxEPD_YELLOW); y += h;
  1527. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1528. display.fillRect(0, y, display.width(), h, GxEPD_ORANGE); y += h;
  1529. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1530. }
  1531. while ((y + 12 * h) < uint16_t(display.height()));
  1532. //display.drawPixel(0, y, GxEPD_BLACK); display.drawPixel(10, y, GxEPD_GREEN);
  1533. //display.drawPixel(20, y, GxEPD_BLUE); display.drawPixel(30, y, GxEPD_RED);
  1534. //display.drawPixel(40, y, GxEPD_YELLOW); display.drawPixel(50, y, GxEPD_ORANGE);
  1535. display.fillRect(0, y, 2, 2, GxEPD_BLACK); display.fillRect(10, y, 2, 2, GxEPD_GREEN);
  1536. display.fillRect(20, y, 2, 2, GxEPD_BLUE); display.fillRect(30, y, 2, 2, GxEPD_RED);
  1537. display.fillRect(40, y, 2, 2, GxEPD_YELLOW); display.fillRect(50, y, 2, 2, GxEPD_ORANGE);
  1538. }
  1539. while (display.nextPage());
  1540. }