-
Notifications
You must be signed in to change notification settings - Fork 127
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
rotate screen #9
Comments
Can't rotate right now... |
Hopefully in the future? |
It should be possible in the future! |
I agree it would be great if at least text can be rotated |
M5EPD driver (for the M5Paper) looks like it supports rotation, but I'm not sure what pins need to be changed to try with this display. I think they are using the same display, but are they using a different driver to drive it (?). https://github.com/m5stack/M5EPD This is the pin map for the M5Paper:
It has other sensors, and a SD card which wouldn't be needed, so a striped down version of the library? |
I’ve only just started to look at this board and driver, have you tried reversing EPD_WIDTH and HEIGHT? I’ve seen examples that have been drawn in landscape with no obvious driver changes. |
the LilyGo driver is based on this https://github.com/vroland/epdiy driver - it appears to be in landscape to start with. With the driver provided by LilyGo I did try to change the EPD_WIDTH and HEIGHT with no luck (that would have been too simple honestly). The pictures above, are really in landscape, just flipped and are static pictures -it was an idea that I had, it wasn't a good idea...but there you go. I created those images in GIMP and converted them to hex files for use on the board with the LilyGo driver. I will play with the M5Paper driver a bit and see if I can get anything to work. |
This is the schematic for the M5Paper - https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/m5paper/M5_PAPER_SCH.pdf If I right, they are using two different drivers for the display (?) or am I looking at something wrong. I tried the M5Paper library as is, with no luck, and then found the schematics. |
As far as I understand how the driver works, all the graphics and text are drawn in the buffer and the buffer uploaded to the screen. So if you swap X and Y when drawing in the buffer I think you'll rotate the content of the screen. |
@fdufnews Seems like all I am able to get it to do is move text and images around on the screen using the framebuffer. perhaps I am not using the framebuffer correctly have you tested it? can you post an example. |
I have not tried rotating yet, but I'm sure font rotation will not be achieved, yes drawing objects could have their x, y values reversed, but that's all. |
I am having to rotate the images in gimp before converting them to hex, it works, but it is one extra step. Of course if you are having to resize an image it only takes an extra couple of clicks to rotate it. I used "Fontforge" to rotate some fonts, and converted them - but didn't have much luck getting more than 5 or 6 to display. |
Loading the framebuffer with the font that I rotated, worked (mostly), my code is not pretty, and probably not ready to be shared. And it's a lot of work to rotate fonts, in fact I think I messed up the "i" when I did it...but proof of concept I guess. maybe we can build some common rotated fonts, and make a function that can load the framebuffer with them. (?) |
@G6EJD Another proof of concept that isn't quite right, but someone who knows more can probably fix it. P.S. this still may not be the best idea, but I'm trying things out - and that is half the fun. LOL |
I’ll have a look through this today, but I’ll also look at the driver data sheet as I’m guessing there may well be a hardware option to do this. |
Looking through the ED047TC1 data sheet there is mention of the display modes being Landscape and Portrait, so I assume from this it can be rotated by hardware/ Register control, I have not yet found the application notes if there are any or a more detailed description of the registers. This is promising. |
So M5 Display driver is an IT8951 versus the ED047TC1 of the LilyGo EPD board. Unfortunately, I have not found any reference to the driver registers/control but my instinct is it's usually used in portrait mode! |
So LilyGo EPD is bit banging the display (?) vs M5 using a driver chip (?) And this is a forum post about the M5 paper which also has links to the display panel datasheet. |
That’s where I got to, but no register descriptions which would lead the way to rotating the display. I had a look through the M5 library but not find how they are rotating the display if at all. |
I'm supporting rotation in my class ED047TC1 both for the epaper and also for the touch screen. Proof of concept video here |
@martinberlin very nice!! Maybe one day it will work with the Arduino IDE as well (?) |
Hi Leroy, |
@martinberlin acutally I tried it today, was getting some compile errors, some where easy to fix, |
You can also try CalEPD directly. Esp-IDF takes some days to master but is not super complicated. Both Cale and EPDiy are not hard to setup and compile. |
Clearly I don't know what I'm doing here - I finally got it to compile by scaling a lot of it back, and just using a little bit of your code, the Adafrutit_GFX library, and this library from LilyGo. When I upload the code to the board I get nothing but reboots. So clearly I've done something wrong, and not fully understanding what I've done. I posted a gist with the errors I got, since it's not part of this project, and something I was trying I decided not to post the errors here, but if someone wants to look at them - https://gist.github.com/kd8bxp/ff9da93a377716176869aac121afd909 Using the Adafruit_GFX library as a wrapper sounds like a great idea, and hopefully someone can get it to work. Thanks again @martinberlin |
You must enable PSRAM in the compiler options! |
@G6EJD maybe it will be cool to add a rotate option to this library? And it really does not need Adafruit GFX at all. I added that because I have a multi-epaper class where every model inherits the full GFX methods. But for rotation is not really needed. Like I mentioned, the only thing IMHO is to keep rotation state and be aware of it before drawing each pixel. |
@G6EJD PSRAM was enabled. (ESP32 Dev Module, with PSRAM enabled) and tried it with multiply boards, no luck. |
Alright so my 2 epapers are coming beginning next week so I will fork this and try to add a simple software rotate just as I did in my component. I don't use Arduino IDE but I use Platformio that I like much more. Arduino IDE makes me mad with their nasty library management. At least Platformio keeps all components in the project folder that makes all nicer (At the price of taking much more of your Hard-Disk space) |
Introducing software rotationForked this and added it in this commit: Note that my new parallel epaper comes next week so I could not really test it. But it's simple enough, so any of you can just point the Platformio lib_deps to my fork and try it out (Or just copy the small updated part to your library) To try it just update platformio.ini lib_deps and remove old library from .pio/libdeps folder
Explanation: 0 is the default |
Cool Martin! |
@martinberlin Got some errors, using both Arduino IDE 1.8.13 and Platform IO (which was recently updated, but I'm not sure what version it is). Both gave the same error - the wording was a little different (if I remember correctly). I tried to use my limited knowledge to fix, but no luck.
There maybe a problem with the use of the name "epd_rotation" I commented that out in the sketch, and commenting out the swap(T& a, T& b) function, I think I made another change because of that. I was getting errors related to "epd_rotation" being re-declared in font.c - I looked and I didn't see it - the only way I was able to get it to compile was changing epd_driver.h |
Hi @kd8bxp And just try to compile again. Note that I added a setter to set rotation, just check the grayscale example. Try to do the following: void setup() {
epd_init();
// Non tested: Update rotation (0 & 2: Landscape 1 & 3: Portrait)
epd_set_rotation(3);
}
// Use epd_get_rotation() to retrieve the rotation state In my tests I just tried to print a pixel like this after setting rotation to 3: // x, y And in the Serial output I get: Which means the x and y is being rotated on the switch. |
Hi @martinberlin, I was following the discussion with great interest and very keen to try out your fix. Many thanks for the work you have spent! What I found is the following (Using my weatherforecast sketch):
Yet I have not investigated in the issues - but probably you know what the problem may be? |
@martinberlin @Rainerlan It doesn't work using I tried with both Arduino IDE and Platform.IO That's my report for what it is worth. |
@martinberlin I'll update my report - I checked the following:
That's my updated report |
Thanks for the tests both! I will have to wait a few days so the new epaper comes. Already landed in Frankfurt am Main so it just needs 3 or 4 days if I'm lucky and is not stopped in customs.
That's already something. No idea why with 3 panics, that needs more research, and probably to do a printf("x: %d y:%d\n",x,y) to debug in Serial where is trying to place the pixel.
That's because I wrongly assumed that all other functions including fonts (font.c) where calling epd_draw_pixel. But I was wrong like you discovered write_string() is a different thing. That needs research, since I don't think is enough just to rotate cursor x & y. Will need some help figuring out that one. Another thing where probably needs to be calculated like I mentioned before is partial update. The best thing of course is to build this with Rotation in mind and not to add it afterwards as we are trying to do here. |
@martinberlin amazing work so far thou!!! Thanks for the hard work, I'm sure once you get your display you'll figure out what is going on. |
@martinberlin It looks to me like
but beyond that I'm not sure how to help or even if I am helping. |
That are the two “data sinks” that feed the Epaper with parallel data. But rotation by software should happen previously. The buffer sent should be already rotated. As a resume rotation should happen in:
Sadly the drawing pixel is not centralized on one single method otherwise it will be much easier to implement. |
@Rainerlan I could not reproduce what you commented about the rotation Doing: epd_set_rotation(3); |
@martinberlin @Rainerlan |
This is the sketch I used to test (Using both Platform IO and Arduino, I get kernel panics/reboots)
which translates to:
So, test to I commented out the
which translates too:
Using I believe the latest platform io, and Arduino 1.8.13 with esp32 1.0.4 core installed (ESP32 Dev module with PSRAM enabled) This is the same sketch I used to try the various draw features, and rotation set at 1 which worked without issues |
Thanks for the update will try to reproduce it. Now we need to be aware also that EPDiy has a new version and many methods got updated. That’s one of the disadvantages of copying the files like this. But anyways will try to make it. Update: I'm a bit blocked with this at the moment since I have another client works to finish. The thing is that previous to add this, the best would be to actually rethink how this is implemented. For me the best way to add this EPDiy library as a controller for this epaper would be to add it as a library itself (libdeps in platformio.ini) |
I’m updating this in my fork of the base component EPDiy I don’t think it makes sense to add it here since it uses an old version of EPDiy and it will be much harder and double work to add it on the fonts rendering. Related #33 Pull request made to add software rotation to EPDiy. I really don't think that updating it here makes any sense since you are using an old static version of the mother library that is EPDiy. I would suggest to use: to try it out. Also if you want to use it as an arduino library, you need to add: https://github.com/martinberlin/epdiy-rotation.git#develop to your platformio.ini lib_deps |
My fork of EPDiy is ready to be tested: branch develop just use EPDiy in libdeps as a dependency and try one of the demo examples rotation is covered in:
could use some help if someone wants to give it a try. |
@martinberlin I tested your fork and it works great for me. |
My fork is merged on EPDiy Master branch. So you can use it directly! |
Closing here since I don't want this to get stale. Please just as @DavidM42 commented, use directly: Remember to make an: idf.py menuconfig And there set both options Display type and board to use LILYGO. Do not forget that SPRAM should be active! Go to Component config -> ESP32-Specific and check Support for external SPI-connected RAM |
I think an example for this device here with platformIO config and the new high level api would be a nice addition to the epdiy repo. |
Ah yes sure. A part of that I cannot close it since this is not my repository ;) |
i tried, and spent 3 days working on trying to make the code work. but i face many errors. most of the errors are just unknown variables, unions and constructs. i tried to digest the code and understand it... but no hope, it is too distant like it is a different project than the original lilygo codes. May be i am just new to this .... Anyway i was looking for simple tweak to make the screen rotate, but couldn't find any working way to do it. |
This issue is stale because it has been open for 30 days with no activity. |
is it possible to rotate the screen, from landscape to portrait?
Thanks
The text was updated successfully, but these errors were encountered: