Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added LilyGo T5 4.7inch EPD PlatformIO example #79

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

DavidM42
Copy link
Contributor

This adds an example how to use this library with the LilyGo T5 4.7 inch EPD device with an Esp32 on board and some exra features like buttons on the side.
It includes

  • A full PlatformIO config
  • Some additional example code how to combine the epd-driver with the deepsleep functionalities of the Esp32
  • An experimental (not ideal) calculation method to find out the battery percentage on this specific device

As discussed here over on the repo of the manufacturer driver fork I think this would be a good kickstart for buyers of that device.

If anyone can test it and maybe suggest improvements to stop random screen greying of the background or how to improve the battery percentage calculation that would be greatly appreciated.

Thanks again for this nice library

@vroland
Copy link
Owner

vroland commented Apr 21, 2021

That looks interesting, thank you :) I'll try to review and test this this weekend!

@fdev31
Copy link
Contributor

fdev31 commented Apr 23, 2021

I wanted to do something a bit similar, but it went a bit too far I guess...
https://github.com/fdev31/LilygoT5-weather-photo-display

Also I'm not exactly certain about the best practices here... but It looks like you have more advanced battery handling code (mine was a simple example I borrowed somewhere). Is a lookup table really needed in theory ? (I thought some linear math as you did was good enough....)

examples/lilygo-t5-47-epd-platformio/platformio.ini Outdated Show resolved Hide resolved
examples/lilygo-t5-47-epd-platformio/src/main.cpp Outdated Show resolved Hide resolved
epd_clear();
err = epd_hl_update_screen(&hl, MODE_GL16, temperature);
epd_poweroff();
delay(100);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, this produces rendering artifacts, because clear() is used without clearing the framebuffer.
I would clear the screen after power on, and then use the highlevel API:
`
void display_center_message(const char* text) {

epd_hl_set_all_white(&hl);

int cursor_x = EPD_WIDTH / 2;
int cursor_y = EPD_HEIGHT / 2;
if (orientation == EPD_ROT_PORTRAIT) {
    // height and width switched here because portrait mode
    cursor_x = EPD_HEIGHT / 2;
    cursor_y = EPD_WIDTH / 2;
}
EpdFontProperties font_props = epd_font_properties_default();
font_props.flags = EPD_DRAW_ALIGN_CENTER;
epd_write_string(&FiraSans_12, text, &cursor_x, &cursor_y, fb, &font_props);

epd_poweron();
err = epd_hl_update_screen(&hl, MODE_GC16, temperature);
delay(500);
epd_poweroff();
delay(1000);

}
`
Also, the delays seem unnecessary for me?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now use the epd_hl_set_all_white method, but the delays reduce some artifacts or graying of the background in my testing.
Maybe they can be avoided with further changes to the driving code here

@vroland
Copy link
Owner

vroland commented Apr 24, 2021

Thanks for the example, so far everything works with platformio. I noticed one issue where the text drawn after 30 seconds of run time produces weird artefacts. This is because the screen is cleared without setting the framebuffer to white. Could you fix that before the merge?

@DavidM42
Copy link
Contributor Author

Thanks for the great input. I'm new to electronic paper displays, so I'm thankful for all tips.
I adapted most of your requests, but I still sometimes encounter artefacts. If you have time maybe you can have a look at the reasons for that

@vroland
Copy link
Owner

vroland commented Apr 29, 2021

Thanks, looks good :)
Yes, there is still a little bit of aliasing after updating the font. This is because I use an approximate waveform, not the matching vendor waveform. With the vendor waveform it looks better, but LilyGO did not publish it in their repository and don't reply to the corresponding issue. I won't publish it myself, because it's unclear if these are copyright-able, and I don't want this repo to be taken down because of it.

@vroland vroland merged commit e228afb into vroland:master Apr 29, 2021
@entozoon
Copy link

@vroland LilyGo appear to have responded to you and open-sourced their waveform, which is awesome!
I've created a PR if you'd to merge. It's tested and looks great

@DavidM42 Thank you so much for this! Saved me so much time, I can't even.

@DavidM42
Copy link
Contributor Author

@entozoon I wanted to comment on your PR that I tested it and that it really looks great and sharp with the added waveform 🎉 but it got merged already so here

I'm glad I could help you and my long struggle with this was less of a waste

@entozoon
Copy link

entozoon commented Dec 1, 2021

Thanks @DavidM42, and yeah I'd have given up without your work. In fact, I'm pretty close again .. lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants