LOLIN_EPD_Library
LOLIN_EPD_Library copied to clipboard
Partial display update
Hello,
is it possible to do a partial display update and not always do the complete display update? It is really annoying when the full display is flashing black and white just to update a temperature value... I would love just to update some single value without affecting the whole display... If this is already possible could you update the examples to show how to do it, if not is it possible to implement such feature?
I did get it to work. It's all in LOLIN_IL3897.cpp and LOLIN_IL3897.h
This was my test
EPD.partInit(); const unsigned char* test = reinterpret_cast<const unsigned char *>( "abcde" ); EPD.partDisplay(0, 0, test, 100, 100);
Please note that you are not supposed to provide actual characters. I believe it works with bitmap images but I haven't found an easy way to do that. It does print noise on the selected area on the screen without affecting the rest (previous text/image still present, whole screen did not flash).
From the .cpp
void LOLIN_IL3897::partDisplay(int16_t x_start, int16_t y_start, const unsigned char *datas, int16_t PART_COLUMN, int16_t PART_LINE)
x_start is the origin for x (0-250) y_start is the origin for y (0-122) const unsigned char*datas is the data to print out PART_COLUMN is the "width" of the partial display PART_LINE is the "height" of the partial display
I'm not particularly interested in this function so I'm not bothering with it more, that being said, if you find a solution, please do share. It might come in handy
Somehow i cannot get it to work with your code. I just get some strange artifact on the screen. Is it because i am calling EPD.clearBuffer(); in a different part of the code? Or what else can be reason?
That strange artifact is the correct result
You're not supposed to send in regular characters, you're supposed to send in a character array that's the output of a processed bitmap Something like this http://blog.novaeletronica.com.br/en/converta-fotos-imagens-pequenos-displays-lcd-image2lcd/
I didn't test it further because I'm not using it, let me know how it goes tho
Oh, now i get it. I thought that the code which you provided actually should work:
EPD.partInit(); const unsigned char* test = reinterpret_cast<const unsigned char *>( "abcde" ); EPD.partDisplay(0, 0, test, 100, 100);
So the EPD.partDisplay function can only render bitmaps, is that correct?
I am mostly looking for a way to do that with text. I want to like replace some temperature values without refreshing the whole screen...
I am also looking for something to refresh only numerical stuff on part of the screen. I think I might have a solution as it seems easy to implement with lolin's code, I'll pull request something in the next 24h if it works out
That would be really good if you could provide such a pull request!
I played with it a bit, wasn't able to get readable text displayed but it is definitely achievable. It's just unfortunately out of my expertise.
For future contributors, my idea was to hack partDisplay() from LOLIN_IL3897: More precisely this bit,
sendCmd(0x24); //Write Black and White image to RAM
for (i = 0; i < PART_COLUMN * PART_LINE / 8; i++)
{
sendData(pgm_read_byte(&datas[i]));
}
partUpdate();
Instead of that for loop, I believe it is possible to scan through bw_buf/red_buf, copy pixel information and send it for updating.
Well that is a shame that you could not get it to work :( Hopefully someone can add such functionality since it would be really useful.
for numbers / digits you can check my repository https://github.com/SFeli/ESP32Pro_SHT30_ePaper. First I tried to generate the bitmap (needed by the partDisplay) within the program but finally I defined the digits as unsigned char - arrays and addressed them one by one.
- using image2cpp to generate the bitmap - I had to rotate and flip the digits first !?
- when and how often the partUpdate has to be processed - I don't know in the partDisplay this function is called as well at the bottom.
Thanks! That is at least something. But unfortunately this is not perfect... But seeing that it is possibly with bitmaps to partial update the screen, it must also be possible to do with font/text.
Is there anything new about the partial display update? I mean this must be somehow possible also for fonts(text) somehow... Other e-ink displays can do that...
or at least, does exist some way to convert a character in a const unsigned char array?
to try to update every character of a word one by one ...
Anyway to do a partial display update on this display would be really good...
Based on this link
http://www.gammon.com.au/forum/?id=11516
I tried to update every letter from a string one by one
for(int letter=0; letter < messageLength; letter++) {
for(int i=0;i<fontSize;i++) {
tempBuff[i] = ~cp437_font[message[letter]][i];
}
EPD.partDisplay(x, y + letter * fontSize, tempBuff, fontSize, fontSize);
}
https://github.com/juanpabloaj/lolin_d32_pro_with_epd_library/blob/6c9390b836a45021d9c31e14416b1959292fce92/part_display_string/part_display_string.ino#L327
... but I don't know why the letters are showed like in a mirror ...
https://imgur.com/a/eygedyf
And when a letter is added the previous disappear.
Oh, that is cool! That is at least some progress! I am not sure why the letters are mirrored and why the previous disappear... I till don'T understand why Lolin did not provide this functionality in their library...
I fixed the mirror effect and the disappeared letters
https://imgur.com/wzxl1yt
you could find the code in
https://github.com/juanpabloaj/lolin_d32_pro_with_epd_library/blob/1e2a2b7cb420fca00ffc11078ed21ce7098e127e/part_display_string/part_display_string.ino#L327
I fixed :
-
the mirror effect reversing the letters https://github.com/juanpabloaj/lolin_d32_pro_with_epd_library/commit/b99025ef9a465cd2aff9c4897ef8507b2920a62d
-
the disappeared letters following the example of @SFeli https://github.com/SFeli/ESP32Pro_SHT30_ePaper/blob/463c8915898e3d28b92f72a7e12cffa34b0a7552/ESP32Pro_SHT30_ePaper.ino#L183
@juanpabloaj Thanks! That looks good! I will definitely try it out. But i saw two issues in your example:
- When you display a new letter the whole text disappears and then appears with the new letter. Can this be done so that the previous letters always stay on the display just the new appear?
- I saw that after some time the display starting to get some artifacts/dirt (getting darker). can this be fixed?
@merdok
Sorry, I don't have answers to your questions.
- When you display a new letter the whole text disappears and then appears with the new letter. Can this be done so that the previous letters always stay on the display just the new appear?
- I saw that after some time the display starting to get some artifacts/dirt (getting darker). can this be fixed?
Maybe if you are searching for a better library an option could be
https://github.com/ZinggJM/GxEPD2/
I tried that and is very nice, but I can't make work it with some boards + epaper displays. For that reason, I'm trying with Lolin EPD library because it is easy to connect to D32 pro with the TFT cable, and it works easily.
At least for me, the options are:
- Lolin EPD library with TFT cable easy to use, (but now) without many support.
- GxEPD2 with a lot of options and the developer answers fast (in the Arduino forum) but you need to find the way to make it works with your board and your epaper display (which pin I need to connect with what pin etc).
I know that there are other displays out there which has better support, but i also like the easy way to connect the Lolin EPD to my D32 Pro. I just wish that Lolin would a little bit more support their libraries. They mostly just post the initial code and that was it, they do not even care about the pull requests... That is a shame.
@SFeli do you have an example on how to "unmirror" the array?
@beckmx I don’t have an example sorry, but the basic idea is to understand how every bit represents one pixel, understand it for some characters, identify some binary operations to apply these to every element, and create a script to do that automatically (I don't find my script to do that sorry :/ ).
I asked another user not you @juanpabloaj , unless you operate both users