Skip to content

Commit f5170c2

Browse files
authored
Merge pull request #110 from e-radionicacom/dev
Fixed panel fading and darkening after full refresh in light mode (Inkplate10).
2 parents b9a81b7 + c3e3bd3 commit f5170c2

File tree

3 files changed

+73
-18
lines changed

3 files changed

+73
-18
lines changed

src/Inkplate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ class Inkplate : public System, public Graphics
117117

118118
uint8_t _beginDone = 0;
119119

120+
#ifdef ARDUINO_INKPLATE10
121+
uint8_t _useLightMode = 0;
122+
#endif
123+
120124
#ifdef WAVEFORM3BIT
121125
uint8_t waveform3Bit[8][9] = WAVEFORM3BIT;
122126
#endif

src/boards/Inkplate10.cpp

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ bool Inkplate::begin(uint8_t lightWaveform)
3434
{
3535
if (lightWaveform)
3636
{
37+
_useLightMode = 1;
3738
uint8_t alternateWaveform[8][9] = WAVEFORM3BIT_LIGHT;
3839
memcpy(waveform3Bit, alternateWaveform, sizeof(waveform3Bit));
3940
}
@@ -205,34 +206,56 @@ void Inkplate::display1b(bool leaveOn)
205206
uint32_t _pos;
206207
uint8_t data;
207208
uint8_t dram;
209+
uint8_t _repeat;
208210

209211
if (!einkOn())
210212
return;
211213

212-
clean(0, 10);
213-
clean(1, 10);
214-
clean(0, 10);
215-
clean(1, 10);
216-
for (int k = 0; k < 5; k++)
214+
if (_useLightMode)
215+
{
216+
clean(0, 1);
217+
clean(1, 12);
218+
clean(2, 1);
219+
clean(0, 9);
220+
clean(2, 1);
221+
clean(1, 12);
222+
clean(2, 1);
223+
clean(0, 9);
224+
_repeat = 3;
225+
}
226+
else
227+
{
228+
clean(0, 1);
229+
clean(1, 10);
230+
clean(2, 1);
231+
clean(0, 10);
232+
clean(2, 1);
233+
clean(1, 10);
234+
clean(2, 1);
235+
clean(0, 10);
236+
_repeat = 5;
237+
}
238+
239+
for (int k = 0; k < _repeat; k++)
217240
{
218241
_pos = (E_INK_HEIGHT * E_INK_WIDTH / 8) - 1;
219242
vscan_start();
220243
for (int i = 0; i < E_INK_HEIGHT; i++)
221244
{
222-
dram = ~(*(DMemoryNew + _pos));
223-
data = LUTW[(dram >> 4) & 0x0F];
245+
dram = (*(DMemoryNew + _pos));
246+
data = LUTB[(dram >> 4) & 0x0F];
224247
hscan_start(pinLUT[data]);
225-
data = LUTW[dram & 0x0F];
248+
data = LUTB[dram & 0x0F];
226249
GPIO.out_w1ts = pinLUT[data] | CL;
227250
GPIO.out_w1tc = DATA | CL;
228251
_pos--;
229252
for (int j = 0; j < ((E_INK_WIDTH / 8) - 1); j++)
230253
{
231-
dram = ~(*(DMemoryNew + _pos));
232-
data = LUTW[(dram >> 4) & 0x0F];
254+
dram = (*(DMemoryNew + _pos));
255+
data = LUTB[(dram >> 4) & 0x0F];
233256
GPIO.out_w1ts = pinLUT[data] | CL;
234257
GPIO.out_w1tc = DATA | CL;
235-
data = LUTW[dram & 0x0F];
258+
data = LUTB[dram & 0x0F];
236259
GPIO.out_w1ts = pinLUT[data] | CL;
237260
GPIO.out_w1tc = DATA | CL;
238261
_pos--;
@@ -261,10 +284,28 @@ void IRAM_ATTR Inkplate::display3b(bool leaveOn)
261284
if (!einkOn())
262285
return;
263286

264-
clean(0, 10);
265-
clean(1, 10);
266-
clean(0, 10);
267-
clean(1, 10);
287+
if (_useLightMode)
288+
{
289+
clean(1, 1);
290+
clean(0, 7);
291+
clean(2, 1);
292+
clean(1, 12);
293+
clean(2, 1);
294+
clean(0, 7);
295+
clean(2, 1);
296+
clean(1, 12);
297+
}
298+
else
299+
{
300+
clean(1, 1);
301+
clean(0, 10);
302+
clean(2, 1);
303+
clean(1, 10);
304+
clean(2, 1);
305+
clean(0, 10);
306+
clean(2, 1);
307+
clean(1, 10);
308+
}
268309

269310
for (int k = 0; k < 8; k++)
270311
{
@@ -333,6 +374,7 @@ uint32_t Inkplate::partialUpdate(bool _forced, bool leaveOn)
333374
uint8_t data = 0;
334375
uint8_t diffw, diffb;
335376
uint32_t n = (E_INK_WIDTH * E_INK_HEIGHT / 4) - 1;
377+
uint8_t _repeat;
336378

337379
uint32_t changeCount = 0;
338380

@@ -361,7 +403,16 @@ uint32_t Inkplate::partialUpdate(bool _forced, bool leaveOn)
361403
if (!einkOn())
362404
return 0;
363405

364-
for (int k = 0; k < 5; ++k)
406+
if (_useLightMode)
407+
{
408+
_repeat = 4;
409+
}
410+
else
411+
{
412+
_repeat = 5;
413+
}
414+
415+
for (int k = 0; k < _repeat; ++k)
365416
{
366417
vscan_start();
367418
n = (E_INK_WIDTH * E_INK_HEIGHT / 4) - 1;

src/boards/Inkplate10.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
{0, 2, 1, 2, 2, 2, 1, 0}, {2, 2, 2, 2, 2, 2, 1, 0}, {0, 0, 0, 0, 2, 1, 2, 0}, {0, 0, 2, 2, 2, 2, 2, 0}};
8888

8989
#define WAVEFORM3BIT_LIGHT \
90-
{{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 2, 2, 1, 2, 1, 0}, {0, 2, 2, 1, 2, 2, 1, 0}, {0, 0, 2, 2, 2, 2, 1, 0}, \
91-
{0, 0, 2, 1, 1, 1, 2, 0}, {0, 2, 2, 2, 1, 1, 2, 0}, {0, 0, 0, 2, 1, 2, 2, 0}, {0, 0, 2, 2, 2, 2, 2, 0}};
90+
{{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 2, 2, 2, 1, 1, 0}, {0, 0, 2, 2, 1, 2, 1, 0}, {0, 2, 2, 1, 2, 2, 1, 0}, \
91+
{0, 0, 2, 1, 1, 1, 2, 0}, {0, 2, 2, 2, 1, 1, 2, 0}, {0, 0, 0, 0, 1, 2, 2, 0}, {0, 0, 0, 2, 2, 2, 2, 0}};
9292

9393
#endif

0 commit comments

Comments
 (0)