GxEPD2_Example.ino 78 KB

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