@@ -6,22 +6,33 @@ bool GxEPDDisplay::begin() {
66 SPI1.begin ();
77 display.init (115200 , true , 2 , false );
88 display.setRotation (3 );
9- display.setFont (&FreeMono9pt7b);
10-
9+ #ifdef TECHO_ZOOM
10+ display.setFont (&FreeMono9pt7b);
11+ #endif
1112 display.setPartialWindow (0 , 0 , display.width (), display.height ());
1213
1314 display.fillScreen (GxEPD_WHITE);
1415 display.display (true );
16+ #if DISP_BACKLIGHT
17+ pinMode (DISP_BACKLIGHT, OUTPUT);
18+ #endif
1519 _init = true ;
1620 return true ;
1721}
1822
1923void GxEPDDisplay::turnOn () {
2024 if (!_init) begin ();
25+ #if DISP_BACKLIGHT
26+ digitalWrite (DISP_BACKLIGHT, HIGH);
27+ _isOn = true ;
28+ #endif
2129}
2230
2331void GxEPDDisplay::turnOff () {
24-
32+ #if DISP_BACKLIGHT
33+ digitalWrite (DISP_BACKLIGHT, LOW);
34+ #endif
35+ _isOn = false ;
2536}
2637
2738void GxEPDDisplay::clear () {
@@ -34,27 +45,52 @@ void GxEPDDisplay::startFrame(Color bkg) {
3445}
3546
3647void GxEPDDisplay::setTextSize (int sz) {
48+ display.setTextSize (sz);
3749}
3850
3951void GxEPDDisplay::setColor (Color c) {
4052 display.setTextColor (GxEPD_BLACK);
4153}
4254
4355void GxEPDDisplay::setCursor (int x, int y) {
44- display.setCursor (x*1.5 , (y*1.5 )+10 );
56+ #ifdef TECHO_ZOOM
57+ x = x + (x >> 1 );
58+ y = y + (y >> 1 );
59+ #endif
60+ display.setCursor (x, (y+10 ));
4561}
4662
4763void GxEPDDisplay::print (const char * str) {
4864 display.print (str);
4965}
5066
5167void GxEPDDisplay::fillRect (int x, int y, int w, int h) {
68+ #ifdef TECHO_ZOOM
69+ x = x + (x >> 1 );
70+ y = y + (y >> 1 );
71+ w = w + (w >> 1 );
72+ h = h + (h >> 1 );
73+ #endif
74+ display.fillRect (x, y, w, h, GxEPD_BLACK);
5275}
5376
5477void GxEPDDisplay::drawRect (int x, int y, int w, int h) {
78+ #ifdef TECHO_ZOOM
79+ x = x + (x >> 1 );
80+ y = y + (y >> 1 );
81+ w = w + (w >> 1 );
82+ h = h + (h >> 1 );
83+ #endif
84+ display.drawRect (x, y, w, h, GxEPD_BLACK);
5585}
5686
5787void GxEPDDisplay::drawXbm (int x, int y, const uint8_t * bits, int w, int h) {
88+ #ifdef TECHO_ZOOM
89+ x = x + (x >> 1 );
90+ y = y + (y >> 1 );
91+ w = w + (w >> 1 );
92+ h = h + (h >> 1 );
93+ #endif
5894 display.drawBitmap (x*1.5 , (y*1.5 ) + 10 , bits, w, h, GxEPD_BLACK);
5995}
6096
0 commit comments