GxEPD2_Example.ino 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262
  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: https://www.good-display.com/companyfile/32/
  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 (closed, read only):
  12. // Good Display ePaper for Arduino: https://forum.arduino.cc/t/good-display-epaper-for-arduino/419657
  13. // Waveshare e-paper displays with SPI: https://forum.arduino.cc/t/waveshare-e-paper-displays-with-spi/467865
  14. //
  15. // Add new topics in https://forum.arduino.cc/c/using-arduino/displays/23 for new questions and issues
  16. // see GxEPD2_wiring_examples.h for wiring suggestions and examples
  17. // NOTE for use with Waveshare ESP32 Driver Board:
  18. // **** also need to select the constructor with the parameters for this board in GxEPD2_display_selection_new_style.h ****
  19. //
  20. // The Wavehare ESP32 Driver Board uses uncommon SPI pins for the FPC connector. It uses HSPI pins, but SCK and MOSI are swapped.
  21. // To use HW SPI with the ESP32 Driver Board, HW SPI pins need be re-mapped in any case. Can be done using either HSPI or VSPI.
  22. // Other SPI clients can either be connected to the same SPI bus as the e-paper, or to the other HW SPI bus, or through SW SPI.
  23. // The logical configuration would be to use the e-paper connection on HSPI with re-mapped pins, and use VSPI for other SPI clients.
  24. // VSPI with standard VSPI pins is used by the global SPI instance of the Arduino IDE ESP32 package.
  25. // uncomment next line to use HSPI for EPD (and e.g VSPI for SD), e.g. with Waveshare ESP32 Driver Board
  26. //#define USE_HSPI_FOR_EPD
  27. // base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter, uses ~1.2k more code
  28. // enable or disable GxEPD2_GFX base class
  29. #define ENABLE_GxEPD2_GFX 0
  30. // uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX
  31. //#include <GFX.h>
  32. // Note: if you use this with ENABLE_GxEPD2_GFX 1:
  33. // uncomment it in GxEPD2_GFX.h too, or add #include <GFX.h> before any #include <GxEPD2_GFX.h>
  34. #include <GxEPD2_BW.h>
  35. #include <GxEPD2_3C.h>
  36. #include <GxEPD2_4C.h>
  37. #include <GxEPD2_7C.h>
  38. #include <Fonts/FreeMonoBold9pt7b.h>
  39. // select the display constructor line in one of the following files (old style):
  40. #include "GxEPD2_display_selection.h"
  41. #include "GxEPD2_display_selection_added.h"
  42. // or select the display class and display driver class in the following file (new style):
  43. #include "GxEPD2_display_selection_new_style.h"
  44. //#define WITHOUT_BITMAPS
  45. #ifndef WITHOUT_BITMAPS
  46. #if !defined(__AVR) && !defined(STM32F1xx)
  47. // note 16.11.2019: the compiler may exclude code based on constant if statements (display.epd2.panel == constant),
  48. // therefore bitmaps may get optimized out by the linker
  49. // comment out unused bitmaps to reduce code space used
  50. #include "bitmaps/Bitmaps80x128.h" // 1.02" b/w
  51. #include "bitmaps/Bitmaps152x152.h" // 1.54" b/w
  52. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  53. #include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  54. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  55. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  56. #include "bitmaps/Bitmaps168x384.h" // 2.9" b/w
  57. #include "bitmaps/Bitmaps152x296.h" // 2.6" b/w
  58. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  59. #include "bitmaps/Bitmaps240x360.h" // 3.1" b/w
  60. #include "bitmaps/Bitmaps240x416.h" // 3.71" b/w
  61. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  62. #include "bitmaps/Bitmaps648x480.h" // 5.38" b/w
  63. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  64. #include "bitmaps/Bitmaps800x276.h" // 5.79" b/w
  65. #include "bitmaps/Bitmaps800x480.h" // 7.5" b/w
  66. #include "bitmaps/Bitmaps960x640.h" // 10.2" b/w
  67. #include "bitmaps/Bitmaps960x680.h" // 13.3" b/w
  68. // 3-color
  69. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  70. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  71. #include "bitmaps/Bitmaps3c128x250.h" // 2.13" b/w/r
  72. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  73. #include "bitmaps/Bitmaps3c152x296.h" // 2.66" b/w/r
  74. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  75. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  76. #if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
  77. #include "bitmaps/Bitmaps3c800x276.h" // 5.79" b/w/r
  78. #include "bitmaps/Bitmaps3c648x480.h" // 5.83" b/w/r
  79. #include "bitmaps/Bitmaps3c800x480.h" // 7.5" b/w/r
  80. #include "bitmaps/Bitmaps3c880x528.h" // 7.5" b/w/r
  81. #include "bitmaps/Bitmaps3c960x640.h" // 11.6" b/w/r
  82. #include "bitmaps/Bitmaps3c960x680.h" // 13.3" b/w/r
  83. #include "bitmaps/WS_Bitmaps800x600.h" // 6.0" grey
  84. // 4-color
  85. #include "bitmaps/Bitmaps4c128x250.h" // 2.13" 4-color
  86. #include "bitmaps/Bitmaps4c184x360.h" // 2.66" 4-color
  87. #include "bitmaps/Bitmaps4c168x384.h" // 2.9" 4-color
  88. #include "bitmaps/WS_Bitmaps4c168x168.h" // 4.37" 4-color
  89. #include "bitmaps/WS_Bitmaps4c168x400.h" // 3.00" 4-color
  90. #include "bitmaps/Bitmaps4c400x300.h" // 4.2" 4-color
  91. #include "bitmaps/Bitmaps4c792x272.h" // 5.79" 4-color
  92. #include "bitmaps/Bitmaps4c960x640.h" // 11.6" 4-color
  93. // 7-color
  94. #include "bitmaps/Bitmaps7c600x448.h" // 5.65" 7-color
  95. #include "bitmaps/WS_Bitmaps7c192x143.h" // 5.65" 7-color
  96. #include "bitmaps/WS_Bitmaps7c300x180.h" // 7.3" 7-color
  97. #endif
  98. #if defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
  99. #include "bitmaps/Bitmaps1304x984.h" // 12.48" b/w
  100. #include "bitmaps/Bitmaps1360x480.h" // 10.85" b/w
  101. #include "bitmaps/Bitmaps3c1304x984.h" // 12.48" b/w/r
  102. #include "bitmaps/Bitmaps7c800x480.h" // 7.3" 7-color
  103. #endif
  104. #else
  105. // select only one to fit in code space
  106. //#include "bitmaps/Bitmaps80x128.h" // 1.02" b/w
  107. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  108. //#include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  109. //#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  110. //#include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  111. #include "bitmaps/Bitmaps168x384.h" // 2.9" b/w
  112. //#include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  113. ////#include "bitmaps/Bitmaps400x300.h" // 4.2" b/w // not enough code space
  114. ////#include "bitmaps/Bitmaps640x384.h" // 7.5" b/w // not enough code space
  115. ////#include "bitmaps/Bitmaps800x480.h" // 7.5" b/w // not enough code space
  116. // 3-color
  117. //#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  118. //#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  119. #include "bitmaps/Bitmaps3c128x250.h" // 2.13" b/w/r
  120. //#include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  121. //#include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  122. ////#include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r // not enough code space
  123. #endif
  124. #endif
  125. #if defined(ARDUINO_ARCH_RP2040) && (defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_W))
  126. #if defined(__MBED__)
  127. // SPI pins used by GoodDisplay DESPI-PICO. note: steals standard I2C pins PIN_WIRE_SDA (6), PIN_WIRE_SCL (7)
  128. // uncomment next line for use with GoodDisplay DESPI-PICO. // MbedSPI(int miso, int mosi, int sck);
  129. arduino::MbedSPI SPIn(4, 7, 6); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  130. // uncomment next line for use with my proto board. // MbedSPI(int miso, int mosi, int sck);
  131. //arduino::MbedSPI SPIn(4, 3, 2); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  132. // uncomment next line for use with Waveshare Pico-ePaper-2.9. // MbedSPI(int miso, int mosi, int sck);
  133. // note: doesn't work with Waveshare PhotoPainter, conflict on pin 12. use philhower package instead.
  134. //arduino::MbedSPI SPIn(12, 11, 10); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  135. #else // package https://github.com/earlephilhower/arduino-pico
  136. // SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_size_t sck, pin_size_t tx);
  137. // uncomment next line for use with my proto board.
  138. //SPIClassRP2040 SPIn(spi0, 4, 5, 2, 3); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  139. // uncomment next line for use with Waveshare Pico-ePaper-2.9 or Waveshare PhotoPainter module
  140. SPIClassRP2040 SPIn(spi1, 12, 13, 10, 11); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  141. #endif
  142. #endif
  143. #if defined(ESP32) && defined(USE_HSPI_FOR_EPD)
  144. SPIClass hspi(HSPI);
  145. #endif
  146. void setup()
  147. {
  148. Serial.begin(115200);
  149. Serial.println();
  150. Serial.println("setup");
  151. delay(100);
  152. #if defined(ARDUINO_ARCH_RP2040) && (defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_W))
  153. // uncomment next line for use with GoodDisplay DESPI-PICO or my proto board, or Waveshare RPi boards
  154. display.epd2.selectSPI(SPIn, SPISettings(4000000, MSBFIRST, SPI_MODE0));
  155. // uncomment next 2 lines to allow recovery from configuration failures
  156. pinMode(15, INPUT_PULLUP); // safety pin
  157. while (!digitalRead(15)) delay(100); // check safety pin for fail recovery
  158. // recovery can be done also by holding BOOTSEL during power-up.
  159. // uncomment next line for Waveshare PhotoPainter module
  160. pinMode(16, OUTPUT); digitalWrite(16, HIGH); // power to the paper
  161. #endif
  162. #if defined(ESP32) && defined(USE_HSPI_FOR_EPD)
  163. hspi.begin(13, 12, 14, 15); // remap hspi for EPD (swap pins)
  164. display.epd2.selectSPI(hspi, SPISettings(4000000, MSBFIRST, SPI_MODE0));
  165. #elif (defined(ARDUINO_ARCH_ESP32) && defined(ARDUINO_LOLIN_S2_MINI))
  166. // SPI.begin(sck, miso, mosi, ss); // preset for remapped pins
  167. SPI.begin(18, -1, 16, 33); // my LOLIN ESP32 S2 mini connection
  168. #endif
  169. //display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
  170. display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
  171. //display.init(115200, true, 10, false, SPIn, SPISettings(4000000, MSBFIRST, SPI_MODE0)); // extended init method with SPI channel and/or settings selection
  172. if (display.pages() > 1)
  173. {
  174. delay(100);
  175. Serial.print("pages = "); Serial.print(display.pages()); Serial.print(" page height = "); Serial.println(display.pageHeight());
  176. delay(1000);
  177. }
  178. //display.clearScreen(); return;
  179. // first update should be full refresh
  180. helloWorld();
  181. delay(1000);
  182. // partial refresh mode can be used to full screen,
  183. // effective if display panel hasFastPartialUpdate
  184. helloFullScreenPartialMode();
  185. delay(1000);
  186. //stripeTest(); return; // GDEH029Z13 issue
  187. helloArduino();
  188. delay(1000);
  189. helloEpaper();
  190. delay(1000);
  191. //helloValue(123.9, 1);
  192. //delay(1000);
  193. showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  194. delay(1000);
  195. if (display.epd2.WIDTH < 104)
  196. {
  197. showFont("glcdfont", 0);
  198. delay(1000);
  199. }
  200. //drawGrid(); return;
  201. //drawCornerTest(); return;
  202. display.writeScreenBuffer();
  203. drawBitmaps();
  204. //display.powerOff(); return;
  205. drawGraphics();
  206. //display.powerOff(); return;
  207. #if !defined(__AVR) // takes too long!
  208. if ((display.epd2.panel == GxEPD2::ACeP565) || (display.epd2.panel == GxEPD2::GDEY073D46) || (display.epd2.panel == GxEPD2::ACeP730) || (display.epd2.panel == GxEPD2::GDEP0565D90))
  209. {
  210. //draw7colorlines();
  211. //delay(2000);
  212. draw7colors();
  213. delay(4000);
  214. //return;
  215. }
  216. #endif
  217. if (display.epd2.hasPartialUpdate)
  218. {
  219. showPartialUpdate();
  220. delay(1000);
  221. } // else // on GDEW0154Z04 only full update available, doesn't look nice
  222. //drawCornerTest();
  223. //showBox(16, 16, 48, 32, false);
  224. //showBox(16, 56, 48, 32, true);
  225. display.powerOff();
  226. deepSleepTest();
  227. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  228. drawBitmaps1304x984();
  229. display.powerOff();
  230. #endif
  231. Serial.println("setup done");
  232. display.end();
  233. }
  234. void loop()
  235. {
  236. }
  237. // note for partial update window and setPartialWindow() method:
  238. // partial update window size and position is on byte boundary in physical x direction
  239. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  240. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  241. const char HelloWorld[] = "Hello World!";
  242. const char HelloArduino[] = "Hello Arduino!";
  243. const char HelloEpaper[] = "Hello E-Paper!";
  244. void helloWorld()
  245. {
  246. //Serial.println("helloWorld");
  247. display.setRotation(1);
  248. display.setFont(&FreeMonoBold9pt7b);
  249. if (display.epd2.WIDTH < 104) display.setFont(0);
  250. display.setTextColor(GxEPD_BLACK);
  251. int16_t tbx, tby; uint16_t tbw, tbh;
  252. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  253. // center bounding box by transposition of origin:
  254. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  255. uint16_t y = ((display.height() - tbh) / 2) - tby;
  256. display.setFullWindow();
  257. display.firstPage();
  258. do
  259. {
  260. display.fillScreen(GxEPD_WHITE);
  261. display.setCursor(x, y);
  262. display.print(HelloWorld);
  263. }
  264. while (display.nextPage());
  265. //Serial.println("helloWorld done");
  266. }
  267. void helloWorldForDummies()
  268. {
  269. //Serial.println("helloWorld");
  270. const char text[] = "Hello World!";
  271. // most e-papers have width < height (portrait) as native orientation, especially the small ones
  272. // in GxEPD2 rotation 0 is used for native orientation (most TFT libraries use 0 fix for portrait orientation)
  273. // set rotation to 1 (rotate right 90 degrees) to have enough space on small displays (landscape)
  274. display.setRotation(1);
  275. // select a suitable font in Adafruit_GFX
  276. display.setFont(&FreeMonoBold9pt7b);
  277. // on e-papers black on white is more pleasant to read
  278. display.setTextColor(GxEPD_BLACK);
  279. // Adafruit_GFX has a handy method getTextBounds() to determine the boundary box for a text for the actual font
  280. int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
  281. display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
  282. // center bounding box by transposition of origin:
  283. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  284. uint16_t y = ((display.height() - tbh) / 2) - tby;
  285. // full window mode is the initial mode, set it anyway
  286. display.setFullWindow();
  287. // here we use paged drawing, even if the processor has enough RAM for full buffer
  288. // so this can be used with any supported processor board.
  289. // the cost in code overhead and execution time penalty is marginal
  290. // tell the graphics class to use paged drawing mode
  291. display.firstPage();
  292. do
  293. {
  294. // this part of code is executed multiple times, as many as needed,
  295. // in case of full buffer it is executed once
  296. // IMPORTANT: each iteration needs to draw the same, to avoid strange effects
  297. // use a copy of values that might change, don't read e.g. from analog or pins in the loop!
  298. display.fillScreen(GxEPD_WHITE); // set the background to white (fill the buffer with value for white)
  299. display.setCursor(x, y); // set the postition to start printing text
  300. display.print(text); // print some text
  301. // end of part executed multiple times
  302. }
  303. // tell the graphics class to transfer the buffer content (page) to the controller buffer
  304. // the graphics class will command the controller to refresh to the screen when the last page has been transferred
  305. // returns true if more pages need be drawn and transferred
  306. // returns false if the last page has been transferred and the screen refreshed for panels without fast partial update
  307. // returns false for panels with fast partial update when the controller buffer has been written once more, to make the differential buffers equal
  308. // (for full buffered with fast partial update the (full) buffer is just transferred again, and false returned)
  309. while (display.nextPage());
  310. //Serial.println("helloWorld done");
  311. }
  312. void helloFullScreenPartialMode()
  313. {
  314. //Serial.println("helloFullScreenPartialMode");
  315. const char fullscreen[] = "full screen update";
  316. const char fpm[] = "fast partial mode";
  317. const char spm[] = "slow partial mode";
  318. const char npm[] = "no partial mode";
  319. display.setPartialWindow(0, 0, display.width(), display.height());
  320. display.setRotation(1);
  321. display.setFont(&FreeMonoBold9pt7b);
  322. if (display.epd2.WIDTH < 104) display.setFont(0);
  323. display.setTextColor(GxEPD_BLACK);
  324. const char* updatemode;
  325. if (display.epd2.hasFastPartialUpdate)
  326. {
  327. updatemode = fpm;
  328. }
  329. else if (display.epd2.hasPartialUpdate)
  330. {
  331. updatemode = spm;
  332. }
  333. else
  334. {
  335. updatemode = npm;
  336. }
  337. // do this outside of the loop
  338. int16_t tbx, tby; uint16_t tbw, tbh;
  339. // center update text
  340. display.getTextBounds(fullscreen, 0, 0, &tbx, &tby, &tbw, &tbh);
  341. uint16_t utx = ((display.width() - tbw) / 2) - tbx;
  342. uint16_t uty = ((display.height() / 4) - tbh / 2) - tby;
  343. // center update mode
  344. display.getTextBounds(updatemode, 0, 0, &tbx, &tby, &tbw, &tbh);
  345. uint16_t umx = ((display.width() - tbw) / 2) - tbx;
  346. uint16_t umy = ((display.height() * 3 / 4) - tbh / 2) - tby;
  347. // center HelloWorld
  348. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  349. uint16_t hwx = ((display.width() - tbw) / 2) - tbx;
  350. uint16_t hwy = ((display.height() - tbh) / 2) - tby;
  351. display.firstPage();
  352. do
  353. {
  354. display.fillScreen(GxEPD_WHITE);
  355. display.setCursor(hwx, hwy);
  356. display.print(HelloWorld);
  357. display.setCursor(utx, uty);
  358. display.print(fullscreen);
  359. display.setCursor(umx, umy);
  360. display.print(updatemode);
  361. }
  362. while (display.nextPage());
  363. //Serial.println("helloFullScreenPartialMode done");
  364. }
  365. void helloArduino()
  366. {
  367. //Serial.println("helloArduino");
  368. display.setRotation(1);
  369. display.setFont(&FreeMonoBold9pt7b);
  370. if (display.epd2.WIDTH < 104) display.setFont(0);
  371. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  372. int16_t tbx, tby; uint16_t tbw, tbh;
  373. // align with centered HelloWorld
  374. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  375. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  376. // height might be different
  377. display.getTextBounds(HelloArduino, 0, 0, &tbx, &tby, &tbw, &tbh);
  378. uint16_t y = ((display.height() / 4) - tbh / 2) - tby; // y is base line!
  379. // make the window big enough to cover (overwrite) descenders of previous text
  380. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  381. uint16_t wy = (display.height() / 4) - wh / 2;
  382. display.setPartialWindow(0, wy, display.width(), wh);
  383. display.firstPage();
  384. do
  385. {
  386. display.fillScreen(GxEPD_WHITE);
  387. //display.drawRect(x, y - tbh, tbw, tbh, GxEPD_BLACK);
  388. display.setCursor(x, y);
  389. display.print(HelloArduino);
  390. }
  391. while (display.nextPage());
  392. delay(1000);
  393. //Serial.println("helloArduino done");
  394. }
  395. void helloEpaper()
  396. {
  397. //Serial.println("helloEpaper");
  398. display.setRotation(1);
  399. display.setFont(&FreeMonoBold9pt7b);
  400. if (display.epd2.WIDTH < 104) display.setFont(0);
  401. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  402. int16_t tbx, tby; uint16_t tbw, tbh;
  403. // align with centered HelloWorld
  404. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  405. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  406. // height might be different
  407. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  408. uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
  409. // make the window big enough to cover (overwrite) descenders of previous text
  410. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  411. uint16_t wy = (display.height() * 3 / 4) - wh / 2;
  412. display.setPartialWindow(0, wy, display.width(), wh);
  413. display.firstPage();
  414. do
  415. {
  416. display.fillScreen(GxEPD_WHITE);
  417. display.setCursor(x, y);
  418. display.print(HelloEpaper);
  419. }
  420. while (display.nextPage());
  421. //Serial.println("helloEpaper done");
  422. }
  423. // test partial window issue on GDEW0213Z19 and GDEH029Z13
  424. void stripeTest()
  425. {
  426. helloStripe(104);
  427. delay(2000);
  428. helloStripe(96);
  429. }
  430. const char HelloStripe[] = "Hello Stripe!";
  431. void helloStripe(uint16_t pw_xe) // end of partial window in physcal x direction
  432. {
  433. //Serial.print("HelloStripe("); Serial.print(pw_xe); Serial.println(")");
  434. display.setRotation(3);
  435. display.setFont(&FreeMonoBold9pt7b);
  436. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  437. int16_t tbx, tby; uint16_t tbw, tbh;
  438. display.getTextBounds(HelloStripe, 0, 0, &tbx, &tby, &tbw, &tbh);
  439. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  440. uint16_t wy = pw_xe - wh;
  441. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  442. uint16_t y = wy - tby;
  443. display.setPartialWindow(0, wy, display.width(), wh);
  444. display.firstPage();
  445. do
  446. {
  447. display.fillScreen(GxEPD_WHITE);
  448. display.setCursor(x, y);
  449. display.print(HelloStripe);
  450. }
  451. while (display.nextPage());
  452. //Serial.println("HelloStripe done");
  453. }
  454. #if defined(ESP8266) || defined(ESP32)
  455. #include <StreamString.h>
  456. #define PrintString StreamString
  457. #else
  458. class PrintString : public Print, public String
  459. {
  460. public:
  461. size_t write(uint8_t data) override
  462. {
  463. return concat(char(data));
  464. };
  465. };
  466. #endif
  467. void helloValue(double v, int digits)
  468. {
  469. //Serial.println("helloValue");
  470. display.setRotation(1);
  471. display.setFont(&FreeMonoBold9pt7b);
  472. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  473. PrintString valueString;
  474. valueString.print(v, digits);
  475. int16_t tbx, tby; uint16_t tbw, tbh;
  476. display.getTextBounds(valueString, 0, 0, &tbx, &tby, &tbw, &tbh);
  477. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  478. uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
  479. // show what happens, if we use the bounding box for partial window
  480. uint16_t wx = (display.width() - tbw) / 2;
  481. uint16_t wy = ((display.height() * 3 / 4) - tbh / 2);
  482. display.setPartialWindow(wx, wy, tbw, tbh);
  483. display.firstPage();
  484. do
  485. {
  486. display.fillScreen(GxEPD_WHITE);
  487. display.setCursor(x, y);
  488. display.print(valueString);
  489. }
  490. while (display.nextPage());
  491. delay(2000);
  492. // make the partial window big enough to cover the previous text
  493. uint16_t ww = tbw; // remember window width
  494. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  495. // adjust, because HelloEpaper was aligned, not centered (could calculate this to be precise)
  496. ww = max(ww, uint16_t(tbw + 12)); // 12 seems ok
  497. wx = (display.width() - tbw) / 2;
  498. // make the window big enough to cover (overwrite) descenders of previous text
  499. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  500. wy = (display.height() * 3 / 4) - wh / 2;
  501. display.setPartialWindow(wx, wy, ww, wh);
  502. // alternately use the whole width for partial window
  503. //display.setPartialWindow(0, wy, display.width(), wh);
  504. display.firstPage();
  505. do
  506. {
  507. display.fillScreen(GxEPD_WHITE);
  508. display.setCursor(x, y);
  509. display.print(valueString);
  510. }
  511. while (display.nextPage());
  512. //Serial.println("helloValue done");
  513. }
  514. void deepSleepTest()
  515. {
  516. //Serial.println("deepSleepTest");
  517. const char hibernating[] = "hibernating ...";
  518. const char wokeup[] = "woke up";
  519. const char from[] = "from deep sleep";
  520. const char again[] = "again";
  521. display.setRotation(1);
  522. display.setFont(&FreeMonoBold9pt7b);
  523. if (display.epd2.WIDTH < 104) display.setFont(0);
  524. display.setTextColor(GxEPD_BLACK);
  525. int16_t tbx, tby; uint16_t tbw, tbh;
  526. // center text
  527. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  528. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  529. uint16_t y = ((display.height() - tbh) / 2) - tby;
  530. display.setFullWindow();
  531. display.firstPage();
  532. do
  533. {
  534. display.fillScreen(GxEPD_WHITE);
  535. display.setCursor(x, y);
  536. display.print(hibernating);
  537. }
  538. while (display.nextPage());
  539. display.hibernate();
  540. delay(5000);
  541. display.getTextBounds(wokeup, 0, 0, &tbx, &tby, &tbw, &tbh);
  542. uint16_t wx = (display.width() - tbw) / 2;
  543. uint16_t wy = ((display.height() / 3) - tbh / 2) - tby; // y is base line!
  544. display.getTextBounds(from, 0, 0, &tbx, &tby, &tbw, &tbh);
  545. uint16_t fx = (display.width() - tbw) / 2;
  546. uint16_t fy = ((display.height() * 2 / 3) - tbh / 2) - tby; // y is base line!
  547. display.firstPage();
  548. do
  549. {
  550. display.fillScreen(GxEPD_WHITE);
  551. display.setCursor(wx, wy);
  552. display.print(wokeup);
  553. display.setCursor(fx, fy);
  554. display.print(from);
  555. }
  556. while (display.nextPage());
  557. delay(5000);
  558. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  559. uint16_t hx = (display.width() - tbw) / 2;
  560. uint16_t hy = ((display.height() / 3) - tbh / 2) - tby; // y is base line!
  561. display.getTextBounds(again, 0, 0, &tbx, &tby, &tbw, &tbh);
  562. uint16_t ax = (display.width() - tbw) / 2;
  563. uint16_t ay = ((display.height() * 2 / 3) - tbh / 2) - tby; // y is base line!
  564. display.firstPage();
  565. do
  566. {
  567. display.fillScreen(GxEPD_WHITE);
  568. display.setCursor(hx, hy);
  569. display.print(hibernating);
  570. display.setCursor(ax, ay);
  571. display.print(again);
  572. }
  573. while (display.nextPage());
  574. display.hibernate();
  575. //Serial.println("deepSleepTest done");
  576. }
  577. void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  578. {
  579. //Serial.println("showBox");
  580. display.setRotation(1);
  581. if (partial)
  582. {
  583. display.setPartialWindow(x, y, w, h);
  584. }
  585. else
  586. {
  587. display.setFullWindow();
  588. }
  589. display.firstPage();
  590. do
  591. {
  592. display.fillScreen(GxEPD_WHITE);
  593. display.fillRect(x, y, w, h, GxEPD_BLACK);
  594. }
  595. while (display.nextPage());
  596. //Serial.println("showBox done");
  597. }
  598. void drawCornerTest()
  599. {
  600. display.setFullWindow();
  601. display.setFont(&FreeMonoBold9pt7b);
  602. display.setTextColor(GxEPD_BLACK);
  603. for (uint16_t r = 0; r <= 4; r++)
  604. {
  605. display.setRotation(r);
  606. display.firstPage();
  607. do
  608. {
  609. display.fillScreen(GxEPD_WHITE);
  610. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  611. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  612. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  613. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  614. display.setCursor(display.width() / 2, display.height() / 2);
  615. display.print(display.getRotation());
  616. }
  617. while (display.nextPage());
  618. delay(2000);
  619. }
  620. }
  621. void showFont(const char name[], const GFXfont* f)
  622. {
  623. display.setFullWindow();
  624. display.setRotation(0);
  625. display.setTextColor(GxEPD_BLACK);
  626. display.firstPage();
  627. do
  628. {
  629. drawFont(name, f);
  630. }
  631. while (display.nextPage());
  632. }
  633. void drawFont(const char name[], const GFXfont* f)
  634. {
  635. //display.setRotation(0);
  636. display.fillScreen(GxEPD_WHITE);
  637. display.setTextColor(GxEPD_BLACK);
  638. display.setFont(f);
  639. display.setCursor(0, 0);
  640. display.println();
  641. display.println(name);
  642. display.println(" !\"#$%&'()*+,-./");
  643. display.println("0123456789:;<=>?");
  644. display.println("@ABCDEFGHIJKLMNO");
  645. display.println("PQRSTUVWXYZ[\\]^_");
  646. if (display.epd2.hasColor)
  647. {
  648. display.setTextColor(GxEPD_RED);
  649. }
  650. display.println("`abcdefghijklmno");
  651. display.println("pqrstuvwxyz{|}~ ");
  652. }
  653. // note for partial update window and setPartialWindow() method:
  654. // partial update window size and position is on byte boundary in physical x direction
  655. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  656. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  657. // showPartialUpdate() purposely uses values that are not multiples of 8 to test this
  658. void showPartialUpdate()
  659. {
  660. // some useful background
  661. helloWorld();
  662. // use asymmetric values for test
  663. uint16_t box_x = 10;
  664. uint16_t box_y = 15;
  665. uint16_t box_w = 70;
  666. uint16_t box_h = 20;
  667. uint16_t cursor_y = box_y + box_h - 6;
  668. if (display.epd2.WIDTH < 104) cursor_y = box_y + 6;
  669. float value = 13.95;
  670. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  671. display.setFont(&FreeMonoBold9pt7b);
  672. if (display.epd2.WIDTH < 104) display.setFont(0);
  673. display.setTextColor(GxEPD_BLACK);
  674. // show where the update box is
  675. for (uint16_t r = 0; r < 4; r++)
  676. {
  677. display.setRotation(r);
  678. display.setPartialWindow(box_x, box_y, box_w, box_h);
  679. display.firstPage();
  680. do
  681. {
  682. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  683. //display.fillScreen(GxEPD_BLACK);
  684. }
  685. while (display.nextPage());
  686. delay(2000);
  687. display.firstPage();
  688. do
  689. {
  690. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  691. }
  692. while (display.nextPage());
  693. delay(1000);
  694. }
  695. //return;
  696. // show updates in the update box
  697. for (uint16_t r = 0; r < 4; r++)
  698. {
  699. display.setRotation(r);
  700. display.setPartialWindow(box_x, box_y, box_w, box_h);
  701. for (uint16_t i = 1; i <= 10; i += incr)
  702. {
  703. display.firstPage();
  704. do
  705. {
  706. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  707. display.setCursor(box_x, cursor_y);
  708. display.print(value * i, 2);
  709. }
  710. while (display.nextPage());
  711. delay(500);
  712. }
  713. delay(1000);
  714. display.firstPage();
  715. do
  716. {
  717. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  718. }
  719. while (display.nextPage());
  720. delay(1000);
  721. }
  722. }
  723. void drawGrid()
  724. {
  725. uint16_t x, y;
  726. display.firstPage();
  727. do
  728. {
  729. x = 0;
  730. do
  731. {
  732. display.drawLine(x, 0, x, display.height() - 1, GxEPD_BLACK);
  733. x += 10;
  734. }
  735. while (x < display.width());
  736. y = 0;
  737. do
  738. {
  739. display.drawLine(0, y, display.width() - 1, y, GxEPD_BLACK);
  740. y += 10;
  741. }
  742. while (y < display.height());
  743. x = 0;
  744. do
  745. {
  746. display.fillCircle(x, display.height() / 2, 3, GxEPD_BLACK);
  747. x += 50;
  748. }
  749. while (x <= display.width());
  750. y = 0;
  751. do
  752. {
  753. display.fillCircle(display.width() / 2, y, 3, GxEPD_BLACK);
  754. y += 50;
  755. }
  756. while (y <= display.height());
  757. }
  758. while (display.nextPage());
  759. }
  760. void drawBitmaps()
  761. {
  762. display.setRotation(0);
  763. display.setFullWindow();
  764. #ifdef _GxBitmaps80x128_H_
  765. drawBitmaps80x128();
  766. #endif
  767. #ifdef _GxBitmaps152x152_H_
  768. drawBitmaps152x152();
  769. #endif
  770. #ifdef _GxBitmaps104x212_H_
  771. drawBitmaps104x212();
  772. #endif
  773. #ifdef _GxBitmaps128x250_H_
  774. drawBitmaps128x250();
  775. #endif
  776. #ifdef _GxBitmaps128x296_H_
  777. drawBitmaps128x296();
  778. #endif
  779. #ifdef _GxBitmaps168x384_H_
  780. drawBitmaps168x384();
  781. #endif
  782. #ifdef _GxBitmaps152x296_H_
  783. drawBitmaps152x296();
  784. #endif
  785. #ifdef _GxBitmaps240x320_H_
  786. drawBitmaps240x320();
  787. #endif
  788. #ifdef _GxBitmaps176x264_H_
  789. drawBitmaps176x264();
  790. #endif
  791. #ifdef _GxBitmaps240x416_H_
  792. drawBitmaps240x416();
  793. #endif
  794. #ifdef _GxBitmaps400x300_H_
  795. drawBitmaps400x300();
  796. #endif
  797. #ifdef _GxBitmaps640x384_H_
  798. drawBitmaps640x384();
  799. #endif
  800. #ifdef _GxBitmaps648x480_H_
  801. drawBitmaps648x480();
  802. #endif
  803. #if defined(ESP32) && defined(_GxBitmaps800x276_H_)
  804. drawBitmaps800x276();
  805. #endif
  806. #ifdef _GxBitmaps800x480_H_
  807. drawBitmaps800x480();
  808. #endif
  809. #ifdef _WS_Bitmaps800x600_H_
  810. drawBitmaps800x600();
  811. #endif
  812. #if defined(ESP32) && defined(_GxBitmaps960x640_H_)
  813. drawBitmaps960x640();
  814. #endif
  815. #if defined(ESP32) && defined(_GxBitmaps960x680_H_)
  816. drawBitmaps960x680();
  817. #endif
  818. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  819. drawBitmaps1304x984();
  820. #endif
  821. // 3-color
  822. #ifdef _GxBitmaps3c104x212_H_
  823. drawBitmaps3c104x212();
  824. #endif
  825. #ifdef _GxBitmaps3c128x250_H_
  826. drawBitmaps3c128x250();
  827. #endif
  828. #ifdef _GxBitmaps3c128x296_H_
  829. drawBitmaps3c128x296();
  830. #endif
  831. #ifdef _GxBitmaps3c152x296_H_
  832. drawBitmaps3c152x296();
  833. #endif
  834. #ifdef _GxBitmaps3c176x264_H_
  835. drawBitmaps3c176x264();
  836. #endif
  837. #ifdef _GxBitmaps3c400x300_H_
  838. drawBitmaps3c400x300();
  839. #endif
  840. #ifdef _GxBitmaps3c648x480_H_
  841. drawBitmaps3c648x480();
  842. #endif
  843. #ifdef _GxBitmaps3c800x480_H_
  844. drawBitmaps3c800x480();
  845. #endif
  846. #ifdef _GxBitmaps3c880x528_H_
  847. drawBitmaps3c880x528();
  848. #endif
  849. #if defined(ESP32) && defined(_GxBitmaps3c960x640_H_)
  850. drawBitmaps3c960x640();
  851. #endif
  852. #if defined(ESP32) && defined(_GxBitmaps3c960x680_H_)
  853. drawBitmaps3c960x680();
  854. #endif
  855. if ((display.epd2.WIDTH >= 200) && (display.epd2.HEIGHT >= 200))
  856. {
  857. // show these after the specific bitmaps
  858. #ifdef _GxBitmaps200x200_H_
  859. drawBitmaps200x200();
  860. #endif
  861. #if defined(ESP32) && defined(_GxBitmaps1360x480_H_)
  862. drawBitmaps1360x480();
  863. #endif
  864. // 3-color
  865. #ifdef _GxBitmaps3c200x200_H_
  866. drawBitmaps3c200x200();
  867. #endif
  868. #if defined(ESP32) && defined(_GxBitmaps3c800x276_H_)
  869. drawBitmaps3c800x276();
  870. #endif
  871. }
  872. // 4-color
  873. #if defined(_GxBitmaps4c128x250_H_)
  874. drawBitmaps4c128x250();
  875. #endif
  876. #if defined(_WS_Bitmaps4c168x168_H_)
  877. drawBitmaps4c168x168();
  878. #endif
  879. #if defined(_GxBitmaps4c168x384_H_)
  880. drawBitmaps4c168x384();
  881. #endif
  882. #if defined(_GxBitmaps4c184x360_H_)
  883. drawBitmaps4c184x360();
  884. #endif
  885. #if defined(_GxBitmaps4c400x300_H_)
  886. drawBitmaps4c400x300();
  887. #endif
  888. #if defined(_GxBitmaps4c960x640_H_)
  889. drawBitmaps4c960x640();
  890. #endif
  891. #if defined(ESP32) && defined(_GxBitmaps4c792x272_H_)
  892. drawBitmaps4c792x272();
  893. #endif
  894. // 7-color
  895. #if defined(_GxBitmaps7c600x448_H_)
  896. drawBitmaps7c600x448();
  897. #endif
  898. #if defined(_WS_Bitmaps7c192x143_H_)
  899. drawBitmaps7c192x143();
  900. #endif
  901. #if defined(_GxBitmaps7c800x480_H_)
  902. drawBitmaps7c800x480();
  903. #endif
  904. #if defined(_WS_Bitmaps7c300x180_H_)
  905. drawBitmaps7c300x180();
  906. #endif
  907. #if defined(ESP32) && defined(_GxBitmaps3c1304x984_H_)
  908. drawBitmaps3c1304x984();
  909. #endif
  910. }
  911. #ifdef _GxBitmaps80x128_H_
  912. void drawBitmaps80x128()
  913. {
  914. #if !defined(__AVR)
  915. const unsigned char* bitmaps[] =
  916. {
  917. Bitmap80x128_1, Bitmap80x128_2, Bitmap80x128_3, Bitmap80x128_4, Bitmap80x128_5
  918. };
  919. #else
  920. const unsigned char* bitmaps[] =
  921. {
  922. Bitmap80x128_1, Bitmap80x128_2, Bitmap80x128_3, Bitmap80x128_4, Bitmap80x128_5
  923. };
  924. #endif
  925. if ((display.epd2.WIDTH == 80) && (display.epd2.HEIGHT == 128))
  926. {
  927. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  928. {
  929. display.firstPage();
  930. do
  931. {
  932. display.fillScreen(GxEPD_WHITE);
  933. display.drawInvertedBitmap(0, 0, bitmaps[i], 80, 128, GxEPD_BLACK);
  934. }
  935. while (display.nextPage());
  936. delay(2000);
  937. }
  938. display.firstPage();
  939. do
  940. {
  941. display.fillScreen(GxEPD_WHITE);
  942. display.drawBitmap(0, 0, WS_Bitmap80x128, 80, 128, GxEPD_BLACK);
  943. }
  944. while (display.nextPage());
  945. delay(2000);
  946. }
  947. }
  948. #endif
  949. #ifdef _GxBitmaps152x152_H_
  950. void drawBitmaps152x152()
  951. {
  952. #if !defined(__AVR)
  953. const unsigned char* bitmaps[] =
  954. {
  955. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  956. };
  957. #else
  958. const unsigned char* bitmaps[] =
  959. {
  960. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  961. };
  962. #endif
  963. if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 152))
  964. {
  965. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  966. {
  967. display.firstPage();
  968. do
  969. {
  970. display.fillScreen(GxEPD_WHITE);
  971. display.drawInvertedBitmap(0, 0, bitmaps[i], 152, 152, GxEPD_BLACK);
  972. }
  973. while (display.nextPage());
  974. delay(2000);
  975. }
  976. }
  977. }
  978. #endif
  979. #ifdef _GxBitmaps200x200_H_
  980. void drawBitmaps200x200()
  981. {
  982. #if defined(ARDUINO_AVR_PRO)
  983. const unsigned char* bitmaps[] =
  984. {
  985. logo200x200
  986. };
  987. #elif defined(__AVR)
  988. const unsigned char* bitmaps[] =
  989. {
  990. logo200x200, //first200x200
  991. };
  992. #elif defined(_BOARD_GENERIC_STM32F103C_H_) || defined(STM32F1xx)
  993. const unsigned char* bitmaps[] =
  994. {
  995. logo200x200, first200x200, second200x200, third200x200, //fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  996. };
  997. #else
  998. const unsigned char* bitmaps[] =
  999. {
  1000. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  1001. //logo200x200, first200x200, second200x200, fourth200x200, third200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200 // ED037TC1 test
  1002. };
  1003. #endif
  1004. if (display.epd2.hasColor) return; // to avoid many long refreshes
  1005. if ((display.epd2.WIDTH == 200) && (display.epd2.HEIGHT == 200) && !display.epd2.hasColor)
  1006. {
  1007. bool m = display.mirror(true);
  1008. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1009. {
  1010. display.firstPage();
  1011. do
  1012. {
  1013. display.fillScreen(GxEPD_WHITE);
  1014. display.drawInvertedBitmap(0, 0, bitmaps[i], 200, 200, GxEPD_BLACK);
  1015. }
  1016. while (display.nextPage());
  1017. delay(2000);
  1018. }
  1019. display.mirror(m);
  1020. }
  1021. //else
  1022. {
  1023. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  1024. display.clearScreen(); // use default for white
  1025. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1026. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1027. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1028. {
  1029. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1030. delay(2000);
  1031. }
  1032. }
  1033. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  1034. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1035. {
  1036. int16_t x = -60;
  1037. int16_t y = -60;
  1038. for (uint16_t j = 0; j < 10; j++)
  1039. {
  1040. display.writeScreenBuffer(); // use default for white
  1041. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1042. display.refresh(true);
  1043. if (display.epd2.hasFastPartialUpdate)
  1044. {
  1045. // for differential update: set previous buffer equal to current buffer in controller
  1046. display.epd2.writeScreenBufferAgain(); // use default for white
  1047. display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1048. }
  1049. delay(2000);
  1050. x += display.epd2.WIDTH / 4;
  1051. y += display.epd2.HEIGHT / 4;
  1052. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1053. }
  1054. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  1055. break; // comment out for full show
  1056. }
  1057. display.writeScreenBuffer(); // use default for white
  1058. display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  1059. display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  1060. display.refresh(true);
  1061. // for differential update: set previous buffer equal to current buffer in controller
  1062. display.epd2.writeScreenBufferAgain(); // use default for white
  1063. display.epd2.writeImageAgain(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  1064. 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);
  1065. delay(2000);
  1066. }
  1067. #endif
  1068. #ifdef _GxBitmaps104x212_H_
  1069. void drawBitmaps104x212()
  1070. {
  1071. #if !defined(__AVR)
  1072. const unsigned char* bitmaps[] =
  1073. {
  1074. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  1075. };
  1076. #else
  1077. const unsigned char* bitmaps[] =
  1078. {
  1079. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  1080. };
  1081. #endif
  1082. if ((display.epd2.WIDTH == 104) && (display.epd2.HEIGHT == 212) && !display.epd2.hasColor)
  1083. {
  1084. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1085. {
  1086. display.firstPage();
  1087. do
  1088. {
  1089. display.fillScreen(GxEPD_WHITE);
  1090. display.drawBitmap(0, 0, bitmaps[i], 104, 212, GxEPD_BLACK);
  1091. }
  1092. while (display.nextPage());
  1093. delay(2000);
  1094. }
  1095. }
  1096. }
  1097. #endif
  1098. #ifdef _GxBitmaps128x250_H_
  1099. void drawBitmaps128x250()
  1100. {
  1101. #if !defined(__AVR)
  1102. const unsigned char* bitmaps[] =
  1103. {
  1104. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  1105. };
  1106. #else
  1107. const unsigned char* bitmaps[] =
  1108. {
  1109. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  1110. };
  1111. #endif
  1112. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 250) && !display.epd2.hasColor)
  1113. {
  1114. bool m = display.mirror(true);
  1115. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1116. {
  1117. display.firstPage();
  1118. do
  1119. {
  1120. display.fillScreen(GxEPD_WHITE);
  1121. display.drawInvertedBitmap(0, 0, bitmaps[i], 128, 250, GxEPD_BLACK);
  1122. }
  1123. while (display.nextPage());
  1124. delay(2000);
  1125. }
  1126. display.mirror(m);
  1127. }
  1128. }
  1129. #endif
  1130. #ifdef _GxBitmaps128x296_H_
  1131. void drawBitmaps128x296()
  1132. {
  1133. #if !defined(__AVR)
  1134. const unsigned char* bitmaps[] =
  1135. {
  1136. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  1137. };
  1138. #else
  1139. const unsigned char* bitmaps[] =
  1140. {
  1141. Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
  1142. };
  1143. #endif
  1144. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 296) && !display.epd2.hasColor)
  1145. {
  1146. bool m = display.mirror(true);
  1147. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1148. {
  1149. display.firstPage();
  1150. do
  1151. {
  1152. display.fillScreen(GxEPD_WHITE);
  1153. display.drawInvertedBitmap(0, 0, bitmaps[i], 128, 296, GxEPD_BLACK);
  1154. }
  1155. while (display.nextPage());
  1156. delay(2000);
  1157. }
  1158. display.mirror(m);
  1159. }
  1160. }
  1161. #endif
  1162. #ifdef _GxBitmaps168x384_H_
  1163. void drawBitmaps168x384()
  1164. {
  1165. #if !defined(__AVR)
  1166. const unsigned char* bitmaps[] =
  1167. {
  1168. Bitmap168x384_1, Bitmap168x384_2, Bitmap168x384_3, Bitmap168x384_4, Bitmap168x384_5
  1169. };
  1170. #else
  1171. const unsigned char* bitmaps[] =
  1172. {
  1173. Bitmap168x384_1
  1174. };
  1175. #endif
  1176. if ((display.epd2.WIDTH == 168) && (display.epd2.HEIGHT == 384) && !display.epd2.hasColor)
  1177. {
  1178. bool mirrored = display.mirror(true);
  1179. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1180. {
  1181. display.firstPage();
  1182. do
  1183. {
  1184. display.fillScreen(GxEPD_WHITE);
  1185. display.drawInvertedBitmap(0, 0, bitmaps[i], 168, 384, GxEPD_BLACK);
  1186. }
  1187. while (display.nextPage());
  1188. delay(2000);
  1189. }
  1190. display.mirror(mirrored);
  1191. }
  1192. }
  1193. #endif
  1194. #ifdef _GxBitmaps152x296_H_
  1195. void drawBitmaps152x296()
  1196. {
  1197. #if !defined(__AVR)
  1198. const unsigned char* bitmaps[] =
  1199. {
  1200. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  1201. };
  1202. #else
  1203. const unsigned char* bitmaps[] =
  1204. {
  1205. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  1206. };
  1207. #endif
  1208. if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 296) && !display.epd2.hasColor)
  1209. {
  1210. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1211. {
  1212. display.firstPage();
  1213. do
  1214. {
  1215. display.fillScreen(GxEPD_WHITE);
  1216. display.drawInvertedBitmap(0, 0, bitmaps[i], 152, 296, GxEPD_BLACK);
  1217. }
  1218. while (display.nextPage());
  1219. delay(2000);
  1220. }
  1221. }
  1222. }
  1223. #endif
  1224. #ifdef _GxBitmaps240x320_H_
  1225. void drawBitmaps240x320()
  1226. {
  1227. #if !defined(__AVR)
  1228. const unsigned char* bitmaps[] =
  1229. {
  1230. Bitmap240x320_1, Bitmap240x320_2, Bitmap240x320_3, Bitmap240x320_4, Bitmap240x320_5
  1231. };
  1232. #else
  1233. const unsigned char* bitmaps[] =
  1234. {
  1235. Bitmap240x320_1, Bitmap240x320_2
  1236. };
  1237. #endif
  1238. if ((display.epd2.WIDTH == 240) && (display.epd2.HEIGHT == 320) && !display.epd2.hasColor)
  1239. {
  1240. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1241. {
  1242. display.firstPage();
  1243. do
  1244. {
  1245. display.fillScreen(GxEPD_WHITE);
  1246. display.drawInvertedBitmap(0, 0, bitmaps[i], 240, 320, GxEPD_BLACK);
  1247. }
  1248. while (display.nextPage());
  1249. delay(2000);
  1250. }
  1251. }
  1252. }
  1253. #endif
  1254. #ifdef _GxBitmaps176x264_H_
  1255. void drawBitmaps176x264()
  1256. {
  1257. #if !defined(__AVR)
  1258. const unsigned char* bitmaps[] =
  1259. {
  1260. Bitmap176x264_1, Bitmap176x264_2, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1261. };
  1262. #else
  1263. const unsigned char* bitmaps[] =
  1264. {
  1265. Bitmap176x264_1, Bitmap176x264_2 //, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1266. };
  1267. #endif
  1268. if ((display.epd2.WIDTH == 176) && (display.epd2.HEIGHT == 264) && !display.epd2.hasColor)
  1269. {
  1270. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1271. {
  1272. display.firstPage();
  1273. do
  1274. {
  1275. display.fillScreen(GxEPD_WHITE);
  1276. display.drawInvertedBitmap(0, 0, bitmaps[i], 176, 264, GxEPD_BLACK);
  1277. }
  1278. while (display.nextPage());
  1279. delay(2000);
  1280. }
  1281. }
  1282. }
  1283. #endif
  1284. #ifdef _GxBitmaps240x416_H_
  1285. void drawBitmaps240x416()
  1286. {
  1287. #if !defined(__AVR)
  1288. const unsigned char* bitmaps[] =
  1289. {
  1290. Bitmap240x416_1, Bitmap240x416_2, Bitmap240x416_3
  1291. };
  1292. #else
  1293. const unsigned char* bitmaps[] =
  1294. {
  1295. Bitmap240x460_1, Bitmap240x460_2, Bitmap240x460_3
  1296. };
  1297. #endif
  1298. if ((display.epd2.WIDTH == 240) && (display.epd2.HEIGHT == 416) && !display.epd2.hasColor)
  1299. {
  1300. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1301. {
  1302. display.firstPage();
  1303. do
  1304. {
  1305. display.fillScreen(GxEPD_WHITE);
  1306. display.drawInvertedBitmap(0, 0, bitmaps[i], 240, 416, GxEPD_BLACK);
  1307. }
  1308. while (display.nextPage());
  1309. delay(2000);
  1310. }
  1311. }
  1312. }
  1313. #endif
  1314. #ifdef _GxBitmaps400x300_H_
  1315. void drawBitmaps400x300()
  1316. {
  1317. #if !defined(__AVR)
  1318. const unsigned char* bitmaps[] =
  1319. {
  1320. Bitmap400x300_1, Bitmap400x300_2
  1321. };
  1322. #else
  1323. const unsigned char* bitmaps[] = {}; // not enough code space
  1324. #endif
  1325. if ((display.epd2.WIDTH == 400) && (display.epd2.HEIGHT == 300) && !display.epd2.hasColor)
  1326. {
  1327. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1328. {
  1329. display.firstPage();
  1330. do
  1331. {
  1332. display.fillScreen(GxEPD_WHITE);
  1333. display.drawInvertedBitmap(0, 0, bitmaps[i], 400, 300, GxEPD_BLACK);
  1334. }
  1335. while (display.nextPage());
  1336. delay(2000);
  1337. }
  1338. }
  1339. }
  1340. #endif
  1341. #ifdef _GxBitmaps640x384_H_
  1342. void drawBitmaps640x384()
  1343. {
  1344. #if !defined(__AVR)
  1345. const unsigned char* bitmaps[] =
  1346. {
  1347. Bitmap640x384_1, Bitmap640x384_2
  1348. };
  1349. #else
  1350. const unsigned char* bitmaps[] = {}; // not enough code space
  1351. #endif
  1352. if ((display.epd2.WIDTH == 640) && (display.epd2.HEIGHT == 384))
  1353. {
  1354. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1355. {
  1356. display.firstPage();
  1357. do
  1358. {
  1359. display.fillScreen(GxEPD_WHITE);
  1360. display.drawInvertedBitmap(0, 0, bitmaps[i], 640, 384, GxEPD_BLACK);
  1361. }
  1362. while (display.nextPage());
  1363. delay(2000);
  1364. }
  1365. }
  1366. }
  1367. #endif
  1368. #ifdef _GxBitmaps648x480_H_
  1369. void drawBitmaps648x480()
  1370. {
  1371. #if !defined(__AVR)
  1372. const unsigned char* bitmaps[] =
  1373. {
  1374. Bitmap648x480_1, Bitmap648x480_2, Bitmap648x480_3
  1375. };
  1376. #else
  1377. const unsigned char* bitmaps[] = {}; // not enough code space
  1378. #endif
  1379. if ((display.epd2.WIDTH == 648) && (display.epd2.HEIGHT == 480) && !display.epd2.hasColor)
  1380. {
  1381. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1382. {
  1383. display.firstPage();
  1384. do
  1385. {
  1386. display.fillScreen(GxEPD_WHITE);
  1387. display.drawBitmap(0, 0, bitmaps[i], 648, 480, GxEPD_BLACK);
  1388. }
  1389. while (display.nextPage());
  1390. delay(2000);
  1391. }
  1392. }
  1393. }
  1394. #endif
  1395. #if defined(ESP32) && defined(_GxBitmaps800x276_H_)
  1396. void drawBitmaps800x276()
  1397. {
  1398. if ((display.epd2.WIDTH == 792) && (display.epd2.HEIGHT == 272) && !display.epd2.hasColor)
  1399. {
  1400. display.drawImage(Bitmap800x276_1, 0, 0, 800, 272, true, false, true); delay(2000);
  1401. display.drawImage(Bitmap800x276_2, 0, 0, 800, 272, true, false, true); delay(2000);
  1402. display.drawImage(Bitmap800x276_3, 0, 0, 800, 272, true, false, true); delay(2000);
  1403. display.clearScreen();
  1404. int16_t wp = display.epd2.WIDTH / 5;
  1405. int16_t hp = display.epd2.HEIGHT / 5;
  1406. for (int16_t i = 0; i < 5; i++)
  1407. {
  1408. for (int16_t j = 0; j < 5; j++)
  1409. {
  1410. display.writeImagePart(Bitmap800x276_1, i * wp, j * hp, 800, 272, i * wp, j * hp, wp, hp, true, false, true);
  1411. display.refresh(true);
  1412. display.epd2.writeImagePartAgain(Bitmap800x276_1, i * wp, j * hp, 800, 272, i * wp, j * hp, wp, hp, true, false, true);
  1413. delay(500);
  1414. }
  1415. }
  1416. }
  1417. }
  1418. #endif
  1419. #ifdef _GxBitmaps800x480_H_
  1420. void drawBitmaps800x480()
  1421. {
  1422. #if defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_UNOR4_WIFI)
  1423. const unsigned char* bitmaps[] =
  1424. {
  1425. Bitmap800x480_3, Bitmap800x480_4
  1426. };
  1427. #elif !defined(__AVR)
  1428. const unsigned char* bitmaps[] =
  1429. {
  1430. Bitmap800x480_1, Bitmap800x480_2, Bitmap800x480_3, Bitmap800x480_4
  1431. };
  1432. #else
  1433. const unsigned char* bitmaps[] = {}; // not enough code space
  1434. #endif
  1435. if ((display.epd2.WIDTH == 800) && (display.epd2.HEIGHT == 480))
  1436. {
  1437. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1438. {
  1439. display.firstPage();
  1440. do
  1441. {
  1442. display.fillScreen(GxEPD_WHITE);
  1443. display.drawBitmap(0, 0, bitmaps[i], 800, 480, GxEPD_BLACK);
  1444. }
  1445. while (display.nextPage());
  1446. delay(2000);
  1447. }
  1448. if ((display.epd2.panel == GxEPD2::GDEW075T7) || (display.epd2.panel == GxEPD2::GDEY075T7))
  1449. {
  1450. // avoid ghosting caused by OTP waveform
  1451. display.clearScreen();
  1452. display.refresh(false); // full update
  1453. }
  1454. }
  1455. }
  1456. #endif
  1457. #if defined(ESP32) && defined(_GxBitmaps960x640_H_)
  1458. void drawBitmaps960x640()
  1459. {
  1460. if ((display.epd2.WIDTH == 960) && (display.epd2.HEIGHT == 640) && !display.epd2.hasColor)
  1461. {
  1462. display.drawImage(Bitmap960x640_1, 0, 0, 960, 640, false, true, true); delay(5000);
  1463. display.drawImage(Bitmap960x640_2, 0, 0, 960, 640, false, true, true); delay(5000);
  1464. display.drawImage(Bitmap960x640_3, 0, 0, 960, 640, false, true, true); delay(5000);
  1465. }
  1466. }
  1467. #endif
  1468. #if defined(ESP32) && defined(_GxBitmaps960x680_H_)
  1469. void drawBitmaps960x680()
  1470. {
  1471. if ((display.epd2.WIDTH == 960) && (display.epd2.HEIGHT == 680) && !display.epd2.hasColor)
  1472. {
  1473. display.drawImage(Bitmap960x680_1, 0, 0, 960, 680, false, true, true); delay(5000);
  1474. display.drawImage(Bitmap960x680_2, 0, 0, 960, 680, false, true, true); delay(5000);
  1475. }
  1476. }
  1477. #endif
  1478. #ifdef _WS_Bitmaps800x600_H_
  1479. void drawBitmaps800x600()
  1480. {
  1481. #if defined(ESP8266) || defined(ESP32)
  1482. if ((display.epd2.panel == GxEPD2::ED060SCT) || (display.epd2.panel == GxEPD2::ED060KC1) || (display.epd2.panel == GxEPD2::ED078KC2))
  1483. {
  1484. // Serial.print("sizeof(WS_zoo_800x600) is "); Serial.println(sizeof(WS_zoo_800x600));
  1485. display.drawNative(WS_zoo_800x600, 0, 0, 0, 800, 600, false, false, true);
  1486. delay(2000);
  1487. // Serial.print("sizeof(WS_pic_1200x825) is "); Serial.println(sizeof(WS_pic_1200x825));
  1488. // display.drawNative((const uint8_t*)WS_pic_1200x825, 0, 0, 0, 1200, 825, false, false, true);
  1489. // delay(2000);
  1490. // Serial.print("sizeof(WS_acaa_1024x731) is "); Serial.println(sizeof(WS_acaa_1024x731));
  1491. // display.drawNative(WS_acaa_1024x731, 0, 0, 0, 1024, 731, false, false, true);
  1492. // delay(2000);
  1493. }
  1494. #endif
  1495. }
  1496. #endif
  1497. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  1498. void drawBitmaps1304x984()
  1499. {
  1500. if (display.epd2.panel == GxEPD2::GDEW1248T3)
  1501. {
  1502. display.drawImage(Bitmap1304x984, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1503. }
  1504. }
  1505. #endif
  1506. #if defined(ESP32) && defined(_GxBitmaps1360x480_H_)
  1507. void drawBitmaps1360x480()
  1508. {
  1509. if (display.epd2.panel == GxEPD2::GDEM1085T51)
  1510. {
  1511. display.drawImage(Bitmap1360x480_1, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1512. delay(2000);
  1513. display.drawImage(Bitmap1360x480_p1, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1514. delay(1000);
  1515. display.drawImage(Bitmap1360x480_p2, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1516. delay(1000);
  1517. display.drawImage(Bitmap1360x480_p3, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1518. delay(1000);
  1519. display.clearScreen();
  1520. int16_t wp = display.epd2.WIDTH / 5;
  1521. int16_t hp = display.epd2.HEIGHT / 5;
  1522. for (int16_t i = 0; i < 5; i++)
  1523. {
  1524. for (int16_t j = 0; j < 5; j++)
  1525. {
  1526. display.writeImagePart(Bitmap1360x480_1, i * wp, j * hp, 1360, 480, i * wp, j * hp, wp, hp, false, false, true);
  1527. display.refresh(true);
  1528. delay(500);
  1529. }
  1530. }
  1531. }
  1532. }
  1533. #endif
  1534. struct bitmap_pair
  1535. {
  1536. const unsigned char* black;
  1537. const unsigned char* red;
  1538. };
  1539. #ifdef _GxBitmaps3c200x200_H_
  1540. void drawBitmaps3c200x200()
  1541. {
  1542. bitmap_pair bitmap_pairs[] =
  1543. {
  1544. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  1545. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  1546. };
  1547. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  1548. {
  1549. display.firstPage();
  1550. do
  1551. {
  1552. display.fillScreen(GxEPD_WHITE);
  1553. // Bitmap3c200x200_black has 2 bits per pixel
  1554. // taken from Adafruit_GFX.cpp, modified
  1555. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  1556. uint8_t byte = 0;
  1557. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  1558. {
  1559. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  1560. {
  1561. if (i & 3) byte <<= 2;
  1562. else
  1563. {
  1564. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  1565. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  1566. #else
  1567. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  1568. #endif
  1569. }
  1570. if (!(byte & 0x80))
  1571. {
  1572. display.drawPixel(i, j, GxEPD_BLACK);
  1573. }
  1574. }
  1575. }
  1576. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1577. }
  1578. while (display.nextPage());
  1579. delay(2000);
  1580. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1581. {
  1582. display.firstPage();
  1583. do
  1584. {
  1585. display.fillScreen(GxEPD_WHITE);
  1586. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1587. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1588. }
  1589. while (display.nextPage());
  1590. delay(2000);
  1591. }
  1592. }
  1593. if (display.epd2.hasColor)
  1594. {
  1595. display.clearScreen(); // use default for white
  1596. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1597. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1598. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1599. {
  1600. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1601. delay(2000);
  1602. }
  1603. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1604. {
  1605. int16_t x = -60;
  1606. int16_t y = -60;
  1607. for (uint16_t j = 0; j < 10; j++)
  1608. {
  1609. display.writeScreenBuffer(); // use default for white
  1610. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1611. display.refresh();
  1612. delay(1000);
  1613. x += display.epd2.WIDTH / 4;
  1614. y += display.epd2.HEIGHT / 4;
  1615. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1616. }
  1617. }
  1618. display.writeScreenBuffer(); // use default for white
  1619. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  1620. 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);
  1621. display.refresh();
  1622. delay(2000);
  1623. }
  1624. }
  1625. #endif
  1626. #ifdef _GxBitmaps3c104x212_H_
  1627. void drawBitmaps3c104x212()
  1628. {
  1629. #if !defined(__AVR)
  1630. bitmap_pair bitmap_pairs[] =
  1631. {
  1632. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1633. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1634. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1635. };
  1636. #else
  1637. bitmap_pair bitmap_pairs[] =
  1638. {
  1639. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1640. //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1641. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1642. };
  1643. #endif
  1644. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  1645. {
  1646. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1647. {
  1648. display.firstPage();
  1649. do
  1650. {
  1651. display.fillScreen(GxEPD_WHITE);
  1652. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1653. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  1654. {
  1655. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1656. }
  1657. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1658. }
  1659. while (display.nextPage());
  1660. delay(2000);
  1661. }
  1662. }
  1663. }
  1664. #endif
  1665. #ifdef _GxBitmaps3c128x250_H_
  1666. void drawBitmaps3c128x250()
  1667. {
  1668. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 250) && display.epd2.hasColor)
  1669. {
  1670. bool mirrored = display.mirror(true);
  1671. display.firstPage();
  1672. do
  1673. {
  1674. display.fillScreen(GxEPD_WHITE);
  1675. display.drawInvertedBitmap(0, 0, Bitmap3c128x250_1_black, 128, 250, GxEPD_BLACK);
  1676. display.drawInvertedBitmap(0, 0, Bitmap3c128x250_1_red, 128, 250, GxEPD_RED);
  1677. }
  1678. while (display.nextPage());
  1679. delay(2000);
  1680. #if !defined(__AVR)
  1681. display.firstPage();
  1682. do
  1683. {
  1684. display.fillScreen(GxEPD_WHITE);
  1685. display.drawInvertedBitmap(0, 0, Bitmap3c128x250_2_black, 128, 250, GxEPD_BLACK);
  1686. display.drawBitmap(0, 0, Bitmap3c128x250_2_red, 128, 250, GxEPD_RED);
  1687. }
  1688. while (display.nextPage());
  1689. delay(2000);
  1690. #endif
  1691. display.mirror(mirrored);
  1692. }
  1693. }
  1694. #endif
  1695. #ifdef _GxBitmaps3c128x296_H_
  1696. void drawBitmaps3c128x296()
  1697. {
  1698. #if !defined(__AVR)
  1699. bitmap_pair bitmap_pairs[] =
  1700. {
  1701. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1702. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1703. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1704. };
  1705. #else
  1706. bitmap_pair bitmap_pairs[] =
  1707. {
  1708. //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1709. //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1710. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1711. };
  1712. #endif
  1713. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 296) && display.epd2.hasColor)
  1714. {
  1715. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1716. {
  1717. display.firstPage();
  1718. do
  1719. {
  1720. display.fillScreen(GxEPD_WHITE);
  1721. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 128, 296, GxEPD_BLACK);
  1722. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  1723. {
  1724. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 128, 296, GxEPD_RED);
  1725. }
  1726. else display.drawBitmap(0, 0, bitmap_pairs[i].red, 128, 296, GxEPD_RED);
  1727. }
  1728. while (display.nextPage());
  1729. delay(2000);
  1730. }
  1731. }
  1732. }
  1733. #endif
  1734. #ifdef _GxBitmaps3c152x296_H_
  1735. void drawBitmaps3c152x296()
  1736. {
  1737. bitmap_pair bitmap_pairs[] =
  1738. {
  1739. {Bitmap3c152x296_black, Bitmap3c152x296_red}
  1740. };
  1741. if (display.epd2.panel == GxEPD2::GDEY0266Z90)
  1742. {
  1743. bool mirrored = display.mirror(true);
  1744. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1745. {
  1746. display.firstPage();
  1747. do
  1748. {
  1749. display.fillScreen(GxEPD_WHITE);
  1750. display.drawBitmap(0, 0, bitmap_pairs[i].black, 152, 296, GxEPD_BLACK);
  1751. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 152, 296, GxEPD_RED);
  1752. }
  1753. while (display.nextPage());
  1754. delay(2000);
  1755. }
  1756. display.mirror(mirrored);
  1757. }
  1758. }
  1759. #endif
  1760. #ifdef _GxBitmaps3c176x264_H_
  1761. void drawBitmaps3c176x264()
  1762. {
  1763. bitmap_pair bitmap_pairs[] =
  1764. {
  1765. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  1766. };
  1767. if (display.epd2.panel == GxEPD2::GDEW027C44)
  1768. {
  1769. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1770. {
  1771. display.firstPage();
  1772. do
  1773. {
  1774. display.fillScreen(GxEPD_WHITE);
  1775. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1776. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1777. }
  1778. while (display.nextPage());
  1779. delay(2000);
  1780. }
  1781. }
  1782. }
  1783. #endif
  1784. #ifdef _GxBitmaps3c400x300_H_
  1785. void drawBitmaps3c400x300()
  1786. {
  1787. #if !defined(__AVR)
  1788. bitmap_pair bitmap_pairs[] =
  1789. {
  1790. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  1791. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  1792. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
  1793. };
  1794. #else
  1795. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1796. #endif
  1797. if (display.epd2.panel == GxEPD2::GDEW042Z15)
  1798. {
  1799. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1800. {
  1801. display.firstPage();
  1802. do
  1803. {
  1804. display.fillScreen(GxEPD_WHITE);
  1805. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1806. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1807. }
  1808. while (display.nextPage());
  1809. delay(2000);
  1810. }
  1811. }
  1812. }
  1813. #endif
  1814. #ifdef _GxBitmaps3c648x480_H_
  1815. void drawBitmaps3c648x480()
  1816. {
  1817. #if !defined(__AVR)
  1818. bitmap_pair bitmap_pairs[] =
  1819. {
  1820. {Bitmap3c648x480_black, Bitmap3c648x480_red},
  1821. {Bitmap3c648x480_black_2, Bitmap3c648x480_red_2}
  1822. };
  1823. #else
  1824. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1825. #endif
  1826. if ((display.epd2.panel == GxEPD2::GDEW0583Z83) || (display.epd2.panel == GxEPD2::GDEQ0583Z31))
  1827. {
  1828. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1829. {
  1830. display.firstPage();
  1831. do
  1832. {
  1833. display.fillScreen(GxEPD_WHITE);
  1834. display.drawBitmap(0, 0, bitmap_pairs[i].black, 648, 480, GxEPD_BLACK);
  1835. display.drawBitmap(0, 0, bitmap_pairs[i].red, 648, 480, GxEPD_RED);
  1836. }
  1837. while (display.nextPage());
  1838. delay(2000);
  1839. }
  1840. }
  1841. }
  1842. #endif
  1843. #if defined(ESP32) && defined(_GxBitmaps3c800x276_H_)
  1844. void drawBitmaps3c800x276()
  1845. {
  1846. if ((display.epd2.WIDTH == 792) && (display.epd2.HEIGHT == 272) && display.epd2.hasColor)
  1847. {
  1848. display.drawImage(Bitmap3c800x276_black_1, Bitmap3c800x276_red_1, 0, 0, 800, 272, true, false, true); delay(2000);
  1849. display.drawImage(Bitmap3c800x276_black_2, Bitmap3c800x276_red_2, 0, 0, 800, 272, true, false, true); delay(2000);
  1850. int16_t wp = display.epd2.WIDTH / 5;
  1851. int16_t hp = display.epd2.HEIGHT / 5;
  1852. int16_t n = 0;
  1853. for (int16_t k = 0; k < 3; k++)
  1854. {
  1855. display.writeScreenBuffer();
  1856. for (int16_t i = 0; i < 5; i++)
  1857. {
  1858. for (int16_t j = 0; j < 5; j++)
  1859. {
  1860. if ((n++ % 2) || (k == 2))
  1861. {
  1862. display.writeImagePart(Bitmap3c800x276_black_1, Bitmap3c800x276_red_1, i * wp, j * hp, 800, 272, i * wp, j * hp, wp, hp, true, false, true);
  1863. }
  1864. }
  1865. }
  1866. display.refresh(false);
  1867. delay(2000);
  1868. }
  1869. }
  1870. }
  1871. #endif
  1872. #ifdef _GxBitmaps3c800x480_H_
  1873. void drawBitmaps3c800x480()
  1874. {
  1875. #if !defined(__AVR)
  1876. bitmap_pair bitmap_pairs[] =
  1877. {
  1878. {Bitmap3c800x480_1_black, Bitmap3c800x480_1_red}
  1879. };
  1880. #else
  1881. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1882. #endif
  1883. if (display.epd2.panel == GxEPD2::GDEW075Z08)
  1884. {
  1885. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1886. {
  1887. display.firstPage();
  1888. do
  1889. {
  1890. display.fillScreen(GxEPD_WHITE);
  1891. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1892. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1893. }
  1894. while (display.nextPage());
  1895. delay(2000);
  1896. }
  1897. }
  1898. }
  1899. #endif
  1900. #ifdef _GxBitmaps3c880x528_H_
  1901. void drawBitmaps3c880x528()
  1902. {
  1903. #if !defined(__AVR)
  1904. bitmap_pair bitmap_pairs[] =
  1905. {
  1906. {Bitmap3c880x528_black, Bitmap3c880x528_red}
  1907. };
  1908. #else
  1909. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1910. #endif
  1911. if (display.epd2.panel == GxEPD2::GDEH075Z90)
  1912. {
  1913. bool m = display.mirror(true);
  1914. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1915. {
  1916. display.firstPage();
  1917. do
  1918. {
  1919. display.fillScreen(GxEPD_WHITE);
  1920. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 880, 528, GxEPD_BLACK);
  1921. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 880, 528, GxEPD_RED);
  1922. }
  1923. while (display.nextPage());
  1924. delay(2000);
  1925. }
  1926. display.mirror(m);
  1927. }
  1928. }
  1929. #endif
  1930. #if defined(ESP32) && defined(_GxBitmaps3c960x640_H_)
  1931. void drawBitmaps3c960x640()
  1932. {
  1933. if ((display.epd2.WIDTH == 960) && (display.epd2.HEIGHT == 640) && display.epd2.hasColor)
  1934. {
  1935. display.drawImage(Bitmap3c960x640_black, Bitmap3c960x640_red, 0, 0, 960, 640, false, false, true);
  1936. delay(2000);
  1937. }
  1938. }
  1939. #endif
  1940. #if defined(ESP32) && defined(_GxBitmaps3c960x680_H_)
  1941. void drawBitmaps3c960x680()
  1942. {
  1943. if ((display.epd2.WIDTH == 960) && (display.epd2.HEIGHT == 680) && display.epd2.hasColor)
  1944. {
  1945. display.drawImage(Bitmap3c960x680_black, Bitmap3c960x680_red, 0, 0, 960, 680, false, true, true);
  1946. }
  1947. delay(2000);
  1948. }
  1949. #endif
  1950. #if defined(ESP32) && defined(_GxBitmaps3c1304x984_H_)
  1951. void drawBitmaps3c1304x984()
  1952. {
  1953. if (display.epd2.panel == GxEPD2::GDEY1248Z51)
  1954. {
  1955. //display.drawImage(Bitmap3c1304x984_black, Bitmap3c1304x984_red, 0, 0, 1304, 984, false, false, true);
  1956. display.writeImage(0, Bitmap3c1304x984_red, 0, 0, 1304, 984, true, false, true); // red bitmap is inverted
  1957. display.drawImage(Bitmap3c1304x984_black, 0, 0, 0, 1304, 984, true, false, true); // black bitmap is normal
  1958. }
  1959. }
  1960. #endif
  1961. #if defined(_GxBitmaps4c128x250_H_)
  1962. void drawBitmaps4c128x250()
  1963. {
  1964. if (display.epd2.panel == GxEPD2::GDEY0213F51)
  1965. {
  1966. display.drawNative(Bitmap4c128x250, 0, 0, 0, 128, 250, false, false, true);
  1967. delay(5000);
  1968. }
  1969. }
  1970. #endif
  1971. #if defined(_WS_Bitmaps4c168x168_H_)
  1972. void drawBitmaps4c168x168()
  1973. {
  1974. if ((display.epd2.panel == GxEPD2::Waveshare437inch4color) || (display.epd2.panel == GxEPD2::Waveshare3inch4color) ||
  1975. (display.epd2.panel == GxEPD2::GDEY0579F51) || (display.epd2.panel == GxEPD2::GDEY116F51))
  1976. {
  1977. display.drawNative(WS_Bitmap4c168x168, 0, (display.epd2.WIDTH - 168) / 2, (display.epd2.HEIGHT - 168) / 2, 168, 168, false, false, true);
  1978. delay(5000);
  1979. }
  1980. }
  1981. #endif
  1982. #if defined(_WS_Bitmaps4c168x400_H_)
  1983. void drawBitmaps4c168x400()
  1984. {
  1985. if (display.epd2.panel == GxEPD2::Waveshare3inch4color)
  1986. {
  1987. display.drawNative(WS_Bitmap4c168x400, 0, (display.epd2.WIDTH - 168) / 2, (display.epd2.HEIGHT - 400) / 2, 168, 400, false, false, true);
  1988. delay(5000);
  1989. }
  1990. }
  1991. #endif
  1992. #if defined(_GxBitmaps4c168x384_H_)
  1993. void drawBitmaps4c168x384()
  1994. {
  1995. if (display.epd2.panel == GxEPD2::GDEY029F51H)
  1996. {
  1997. display.drawNative(Bitmap4c168x384, 0, (display.epd2.WIDTH - 168) / 2, (display.epd2.HEIGHT - 384) / 2, 168, 384, false, false, true);
  1998. delay(5000);
  1999. }
  2000. }
  2001. #endif
  2002. #if defined(_GxBitmaps4c184x360_H_)
  2003. void drawBitmaps4c184x360()
  2004. {
  2005. if (display.epd2.panel == GxEPD2::GDEY0266F51H)
  2006. {
  2007. display.drawNative(Bitmap4c184x360, 0, (display.epd2.WIDTH - 184) / 2, (display.epd2.HEIGHT - 360) / 2, 184, 360, false, false, true);
  2008. delay(5000);
  2009. }
  2010. }
  2011. #endif
  2012. #if defined(_GxBitmaps4c400x300_H_)
  2013. void drawBitmaps4c400x300()
  2014. {
  2015. if (display.epd2.panel == GxEPD2::GDEY0420F51)
  2016. {
  2017. display.drawNative(Bitmap4c400x300, 0, (display.epd2.WIDTH - 400) / 2, (display.epd2.HEIGHT - 300) / 2, 400, 300, false, false, true);
  2018. delay(5000);
  2019. }
  2020. }
  2021. #endif
  2022. #if defined(_GxBitmaps4c960x640_H_)
  2023. void drawBitmaps4c960x640()
  2024. {
  2025. if (display.epd2.panel == GxEPD2::GDEY116F51)
  2026. {
  2027. display.drawNative(Bitmap4c960x640, 0, (display.epd2.WIDTH - 960) / 2, (display.epd2.HEIGHT - 640) / 2, 960, 640, true, false, true);
  2028. delay(5000);
  2029. }
  2030. }
  2031. #endif
  2032. #if defined(ESP32) && defined(_GxBitmaps4c792x272_H_)
  2033. void drawBitmaps4c792x272()
  2034. {
  2035. if (display.epd2.panel == GxEPD2::GDEY0579F51)
  2036. {
  2037. display.drawNative(Bitmap4c792x272, 0, (display.epd2.WIDTH - 792) / 2, (display.epd2.HEIGHT - 272) / 2, 792, 272, true, false, true);
  2038. delay(5000);
  2039. int16_t wp = display.epd2.WIDTH / 5;
  2040. int16_t hp = display.epd2.HEIGHT / 5;
  2041. int16_t n = 0;
  2042. #if defined(GxEPD2_DRIVER_CLASS) && defined(IS_GxEPD2_DRIVER_4C)
  2043. #if IS_GxEPD2_DRIVER_4C(GxEPD2_DRIVER_CLASS)
  2044. for (int16_t k = 0; k < 3; k++)
  2045. {
  2046. display.writeScreenBuffer();
  2047. for (int16_t i = 0; i < 5; i++)
  2048. {
  2049. for (int16_t j = 0; j < 5; j++)
  2050. {
  2051. if ((n++ % 2) || (k == 2))
  2052. {
  2053. display.epd2.writeNativePart(Bitmap4c792x272, 0, i * wp, j * hp, 792, 272, i * wp, j * hp, wp, hp, true, false, true);
  2054. }
  2055. }
  2056. }
  2057. display.refresh(false);
  2058. delay(2000);
  2059. }
  2060. #endif
  2061. #endif
  2062. }
  2063. }
  2064. #endif
  2065. #if defined(_GxBitmaps7c600x448_H_)
  2066. void drawBitmaps7c600x448()
  2067. {
  2068. if (display.epd2.panel == GxEPD2::GDEP0565D90)
  2069. {
  2070. display.epd2.drawDemoBitmap(Bitmap7c600x448, 0, 0, 0, 600, 448, 1, false, true);
  2071. delay(5000);
  2072. }
  2073. }
  2074. #endif
  2075. #if defined(_WS_Bitmaps7c192x143_H_)
  2076. void drawBitmaps7c192x143()
  2077. {
  2078. if (display.epd2.panel == GxEPD2::ACeP565)
  2079. {
  2080. display.drawNative(WS_Bitmap7c192x143, 0, (display.epd2.WIDTH - 192) / 2, (display.epd2.HEIGHT - 143) / 2, 192, 143, false, false, true);
  2081. delay(5000);
  2082. }
  2083. }
  2084. #endif
  2085. #if defined(_GxBitmaps7c800x480_H_)
  2086. void drawBitmaps7c800x480()
  2087. {
  2088. if ((display.epd2.panel == GxEPD2::GDEY073D46) || (display.epd2.panel == GxEPD2::ACeP730) || (display.epd2.panel == GxEPD2::GDEP0565D90))
  2089. {
  2090. display.epd2.drawDemoBitmap(Bitmap7c800x480, 0, 0, 0, 800, 480, 0, false, true); // special format
  2091. delay(5000);
  2092. }
  2093. }
  2094. #endif
  2095. #if defined(_WS_Bitmaps7c300x180_H_)
  2096. void drawBitmaps7c300x180()
  2097. {
  2098. if ((display.epd2.panel == GxEPD2::GDEY073D46) || (display.epd2.panel == GxEPD2::ACeP730) || (display.epd2.panel == GxEPD2::GDEP0565D90))
  2099. {
  2100. display.drawNative(WS_Bitmap7c300x180, 0, (display.epd2.WIDTH - 300) / 2, (display.epd2.HEIGHT - 180) / 2, 300, 180, false, false, true);
  2101. delay(5000);
  2102. }
  2103. }
  2104. #endif
  2105. void draw7colors()
  2106. {
  2107. display.setRotation(0);
  2108. uint16_t h = display.height() / 7;
  2109. display.firstPage();
  2110. do
  2111. {
  2112. display.fillRect(0, 0, display.width(), h, GxEPD_BLACK);
  2113. display.fillRect(0, h, display.width(), h, GxEPD_WHITE);
  2114. display.fillRect(0, 2 * h, display.width(), h, GxEPD_GREEN);
  2115. display.fillRect(0, 3 * h, display.width(), h, GxEPD_BLUE);
  2116. display.fillRect(0, 4 * h, display.width(), h, GxEPD_RED);
  2117. display.fillRect(0, 5 * h, display.width(), h, GxEPD_YELLOW);
  2118. display.fillRect(0, 6 * h, display.width(), h, GxEPD_ORANGE);
  2119. }
  2120. while (display.nextPage());
  2121. }
  2122. void draw7colorlines()
  2123. {
  2124. display.setRotation(0);
  2125. uint16_t h = 2;
  2126. display.firstPage();
  2127. do
  2128. {
  2129. uint16_t y = 0;
  2130. do
  2131. {
  2132. display.fillRect(0, y, display.width(), h, GxEPD_BLACK); y += h;
  2133. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2134. display.fillRect(0, y, display.width(), h, GxEPD_GREEN); y += h;
  2135. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2136. display.fillRect(0, y, display.width(), h, GxEPD_BLUE); y += h;
  2137. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2138. display.fillRect(0, y, display.width(), h, GxEPD_RED); y += h;
  2139. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2140. display.fillRect(0, y, display.width(), h, GxEPD_YELLOW); y += h;
  2141. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2142. display.fillRect(0, y, display.width(), h, GxEPD_ORANGE); y += h;
  2143. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2144. }
  2145. while ((y + 12 * h) < uint16_t(display.height()));
  2146. //display.drawPixel(0, y, GxEPD_BLACK); display.drawPixel(10, y, GxEPD_GREEN);
  2147. //display.drawPixel(20, y, GxEPD_BLUE); display.drawPixel(30, y, GxEPD_RED);
  2148. //display.drawPixel(40, y, GxEPD_YELLOW); display.drawPixel(50, y, GxEPD_ORANGE);
  2149. display.fillRect(0, y, 2, 2, GxEPD_BLACK); display.fillRect(10, y, 2, 2, GxEPD_GREEN);
  2150. display.fillRect(20, y, 2, 2, GxEPD_BLUE); display.fillRect(30, y, 2, 2, GxEPD_RED);
  2151. display.fillRect(40, y, 2, 2, GxEPD_YELLOW); display.fillRect(50, y, 2, 2, GxEPD_ORANGE);
  2152. }
  2153. while (display.nextPage());
  2154. }
  2155. void drawGraphics()
  2156. {
  2157. display.setRotation(0);
  2158. display.firstPage();
  2159. do
  2160. {
  2161. display.drawRect(display.width() / 8, display.height() / 8, display.width() * 3 / 4, display.height() * 3 / 4, GxEPD_BLACK);
  2162. display.drawLine(display.width() / 8, display.height() / 8, display.width() * 7 / 8, display.height() * 7 / 8, GxEPD_BLACK);
  2163. display.drawLine(display.width() / 8, display.height() * 7 / 8, display.width() * 7 / 8, display.height() / 8, GxEPD_BLACK);
  2164. display.drawCircle(display.width() / 2, display.height() / 2, display.height() / 4, GxEPD_BLACK);
  2165. display.drawPixel(display.width() / 4, display.height() / 2 , GxEPD_BLACK);
  2166. display.drawPixel(display.width() * 3 / 4, display.height() / 2 , GxEPD_BLACK);
  2167. }
  2168. while (display.nextPage());
  2169. delay(1000);
  2170. }