Skip to content

Commit 3236d4e

Browse files
committed
leaveOn in display.display
1 parent 0912712 commit 3236d4e

File tree

7 files changed

+53
-35
lines changed

7 files changed

+53
-35
lines changed

src/Inkplate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ void Inkplate::clearDisplay()
6666
/**
6767
* @brief display function update display with new data from buffer
6868
*/
69-
void Inkplate::display()
69+
void Inkplate::display(bool leaveOn)
7070
{
7171
if (getDisplayMode() == 0)
72-
display1b();
72+
display1b(leaveOn);
7373
else if (getDisplayMode() == 1)
74-
display3b();
74+
display3b(leaveOn);
7575
}
7676

7777
/**

src/Inkplate.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Inkplate : public System, public Graphics
4545
#endif
4646
bool begin(void); // In boards
4747
void clearDisplay();
48-
void display();
48+
void display(bool leaveOn = false);
4949
// void writeRow(uint8_t data);
5050
void partialUpdate(bool _forced = false, bool leaveOn = false);
5151

@@ -95,8 +95,8 @@ class Inkplate : public System, public Graphics
9595
void sendData(uint8_t *_data, int _n);
9696
void sendData(uint8_t _data);
9797
#else
98-
void display1b();
99-
void display3b();
98+
void display1b(bool leaveOn = false);
99+
void display3b(bool leaveOn = false);
100100

101101
void vscan_start();
102102
void vscan_end();

src/boards/Inkplate10.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,14 @@ void Graphics::writePixel(int16_t x0, int16_t y0, uint16_t color)
193193
*
194194
* @brief display1b function writes black and white data to display
195195
*/
196-
void Inkplate::display1b()
196+
void Inkplate::display1b(bool leaveOn)
197197
{
198198
memcpy(DMemoryNew, _partial, E_INK_WIDTH * E_INK_HEIGHT / 8);
199199

200200
uint32_t _pos;
201201
uint8_t data;
202202
uint8_t dram;
203-
if (!einkOn())
203+
if (!leaveOn && !einkOn())
204204
{
205205
return;
206206
}
@@ -241,17 +241,19 @@ void Inkplate::display1b()
241241

242242
clean(2, 2);
243243
clean(3, 1);
244+
244245
vscan_start();
245-
einkOff();
246+
if (!leaveOn)
247+
einkOff();
246248
_blockPartial = 0;
247249
}
248250

249251
/**
250252
* @brief display3b function writes grayscale data to display
251253
*/
252-
void IRAM_ATTR Inkplate::display3b()
254+
void IRAM_ATTR Inkplate::display3b(bool leaveOn)
253255
{
254-
if (!einkOn())
256+
if (!leaveOn && !einkOn())
255257
{
256258
return;
257259
}
@@ -295,7 +297,9 @@ void IRAM_ATTR Inkplate::display3b()
295297
}
296298
clean(3, 1);
297299
vscan_start();
298-
einkOff();
300+
301+
if (!leaveOn)
302+
einkOff();
299303
}
300304

301305
/**
@@ -314,7 +318,7 @@ void Inkplate::partialUpdate(bool _forced, bool leaveOn)
314318
return;
315319
if (_blockPartial == 1 && !_forced)
316320
{
317-
display1b();
321+
display1b(leaveOn);
318322
return;
319323
}
320324

src/boards/Inkplate5.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ void Graphics::writePixel(int16_t x0, int16_t y0, uint16_t color)
193193
*
194194
* @brief display1b function writes black and white data to display
195195
*/
196-
void Inkplate::display1b()
196+
void Inkplate::display1b(bool leaveOn)
197197
{
198198
for (int i = 0; i < (E_INK_HEIGHT * E_INK_WIDTH) / 8; i++)
199199
{
@@ -204,7 +204,8 @@ void Inkplate::display1b()
204204
uint8_t data;
205205
uint8_t dram;
206206

207-
if (!einkOn())
207+
208+
if (!leaveOn && !einkOn())
208209
{
209210
return;
210211
}
@@ -275,16 +276,18 @@ void Inkplate::display1b()
275276
clean(2, 2);
276277
clean(3, 1);
277278
vscan_start();
278-
einkOff();
279+
280+
if (!leaveOn)
281+
einkOff();
279282
_blockPartial = 0;
280283
}
281284

282285
/**
283286
* @brief display3b function writes grayscale data to display
284287
*/
285-
void IRAM_ATTR Inkplate::display3b()
288+
void IRAM_ATTR Inkplate::display3b(bool leaveOn)
286289
{
287-
if (!einkOn())
290+
if (!leaveOn && !einkOn())
288291
{
289292
return;
290293
}
@@ -328,7 +331,9 @@ void IRAM_ATTR Inkplate::display3b()
328331
}
329332
clean(3, 1);
330333
vscan_start();
331-
einkOff();
334+
335+
if (!leaveOn)
336+
einkOff();
332337
}
333338

334339
/**
@@ -348,7 +353,7 @@ void Inkplate::partialUpdate(bool _forced, bool leaveOn)
348353

349354
if (_blockPartial == 1 && !_forced)
350355
{
351-
display1b();
356+
display1b(leaveOn);
352357
return;
353358
}
354359
uint32_t _pos = (E_INK_WIDTH * E_INK_HEIGHT / 8) - 1;

src/boards/Inkplate6.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ void Graphics::writePixel(int16_t x0, int16_t y0, uint16_t color)
177177
*
178178
* @brief display1b function writes black and white data to display
179179
*/
180-
void Inkplate::display1b()
180+
void Inkplate::display1b(bool leaveOn)
181181
{
182182
memcpy(DMemoryNew, _partial, E_INK_WIDTH * E_INK_HEIGHT / 8);
183183

184184
uint32_t _send;
185185
uint8_t data;
186186
uint8_t dram;
187187

188-
if (!einkOn())
188+
if (!leaveOn && !einkOn())
189189
{
190190
return;
191191
}
@@ -289,16 +289,19 @@ void Inkplate::display1b()
289289
delayMicroseconds(230);
290290

291291
vscan_start();
292-
einkOff();
292+
293+
if (!leaveOn)
294+
einkOff();
295+
293296
_blockPartial = 0;
294297
}
295298

296299
/**
297300
* @brief display3b function writes grayscale data to display
298301
*/
299-
void Inkplate::display3b()
302+
void Inkplate::display3b(bool leaveOn)
300303
{
301-
if (!einkOn())
304+
if (!leaveOn && !einkOn())
302305
{
303306
return;
304307
}
@@ -344,7 +347,9 @@ void Inkplate::display3b()
344347
}
345348
clean(3, 1);
346349
vscan_start();
347-
einkOff();
350+
351+
if (!leaveOn)
352+
einkOff();
348353
}
349354

350355
/**
@@ -364,7 +369,7 @@ void Inkplate::partialUpdate(bool _forced, bool leaveOn)
364369

365370
if (_blockPartial == 1 && !_forced)
366371
{
367-
display1b();
372+
display1b(leaveOn);
368373
return;
369374
}
370375

src/boards/Inkplate6plus.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void Inkplate::clean(uint8_t c, uint8_t rep)
261261
*
262262
* @brief display1b function writes black and white data to display
263263
*/
264-
void Inkplate::display1b()
264+
void Inkplate::display1b(bool leaveOn)
265265
{
266266
for (int i = 0; i < (E_INK_HEIGHT * E_INK_WIDTH) / 8; i++)
267267
{
@@ -271,7 +271,7 @@ void Inkplate::display1b()
271271
uint32_t _pos;
272272
uint8_t data;
273273
uint8_t dram;
274-
if (!einkOn())
274+
if (!leaveOn && !einkOn())
275275
{
276276
return;
277277
}
@@ -343,16 +343,18 @@ void Inkplate::display1b()
343343
clean(2, 2);
344344
clean(3, 1);
345345
vscan_start();
346-
einkOff();
346+
347+
if (leaveOn)
348+
einkOff();
347349
_blockPartial = 0;
348350
}
349351

350352
/**
351353
* @brief display3b function writes grayscale data to display
352354
*/
353-
void Inkplate::display3b()
355+
void Inkplate::display3b(bool leaveOn)
354356
{
355-
if (!einkOn())
357+
if (!leaveOn && !einkOn())
356358
{
357359
return;
358360
}
@@ -397,7 +399,9 @@ void Inkplate::display3b()
397399
}
398400
clean(3, 1);
399401
vscan_start();
400-
einkOff();
402+
403+
if (!leaveOn)
404+
einkOff();
401405
}
402406

403407
/**
@@ -416,7 +420,7 @@ void Inkplate::partialUpdate(bool _forced, bool leaveOn)
416420
return;
417421
if (_blockPartial == 1 && !_forced)
418422
{
419-
display1b();
423+
display1b(leaveOn);
420424
return;
421425
}
422426

src/boards/InkplateColor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ bool Inkplate::begin(void)
117117
/**
118118
* @brief display function update display with new data from buffer
119119
*/
120-
void Inkplate::display()
120+
void Inkplate::display(bool leaveOn)
121121
{
122122
if (!_panelState)
123123
return;

0 commit comments

Comments
 (0)