Closed jeroenvermeulen closed 3 years ago
ok did you load my last commit? you need only the driver file (Arduino_ST7789.cpp) do not change anything in the driver, just report what is happening you should only set display width in console to 135
the offset should now be set by the driver automatically to 40, 52
i will adjust things when it goes wrong
I have tested 403dc9ba, I just build your development branch. It is almost right! I suspect you need to change the 52 to 53 but I did not study your changes.
Rotation 0 is one pixel too far to the left:
Rotation 1 is one pixel too far to the top:
Rotation 2 looks perfect but I suspect it is also one pixel off:
Rotation 3 is one pixel too far to the top:
i am bit confused about where to set 52 or 53
there are 3 places to check
please iterate the 52,53 at these places and check the result.
we then can fix the remaining rotations.
if (width==240 && height==240) { _colstart = ST7789_240x240_XSTART; _rowstart = ST7789_240x240_YSTART; } else { _colstart = 40; _rowstart = 52; }
void Arduino_ST7789::setRotation(uint8_t m) {
writecommand(ST7789_MADCTL); rotation = m % 4; // can't be higher than 3 switch (rotation) { case 0: writedata(ST7789_MADCTL_MX | ST7789_MADCTL_MY | ST7789_MADCTL_RGB);
_xstart = _colstart;
// _ystart = _rowstart;
if (_width==240 && _height==240) {
_ystart = 80;
} else {
_ystart = 53;
}
break;
case 1: writedata(ST7789_MADCTL_MY | ST7789_MADCTL_MV | ST7789_MADCTL_RGB);
_ystart = _colstart;
// _xstart = _rowstart;
if (_width==240 && _height==240) {
_xstart = 80;
} else {
_xstart = 53;
}
break;
case 2: writedata(ST7789_MADCTL_RGB);
_xstart = _colstart;
_ystart = _rowstart;
break;
case 3: writedata(ST7789_MADCTL_MX | ST7789_MADCTL_MV | ST7789_MADCTL_RGB);
_ystart = _colstart;
_xstart = _rowstart;
break;
} }
I think my previous message was based on the firmware, I am sorry.
Your dev branch seems to output build.bin
instead of tasmota32.bin
Currently testing further.
you can use original tasmota and only take the driver file from my fork
Why don't you merge from upstream?
i want to take control what i merge and keep my own project with some special settings.
ok try my very last version.
i copied the rotation settings from a working driver. it has a different coding of rotations but i think i reordered it right
Maybe you can check if my version still works on 240*240. It is based on your version dd9567a
This are my test commands:
BackLog DisplayRotate 0; DisplayWidth 135; DisplayHeight 240; DisplayFont 0; DisplayCols 22; DisplayRows 29;
BackLog DisplayText [zs1l1c1]# Hello how are you? #; DisplayText [s1l29c1]1234567890123456789012
BackLog DisplayRotate 1; DisplayWidth 240; DisplayHeight 135; DisplayFont 0; DisplayCols 40; DisplayRows 16;
BackLog DisplayText [zs1l1c1]########## Hello how are you? ##########; DisplayText [s1l16c1]1234567890123456789012345678901234567890
BackLog DisplayRotate 2; DisplayWidth 135; DisplayHeight 240; DisplayFont 0; DisplayCols 22; DisplayRows 29;
BackLog DisplayText [zs1l1c1]# Hello how are you? #; DisplayText [s1l29c1]1234567890123456789012
BackLog DisplayRotate 3; DisplayWidth 240; DisplayHeight 135; DisplayFont 0; DisplayCols 40; DisplayRows 17;
BackLog DisplayText [zs1l1c1]########## Hello how are you? ##########; DisplayText [s1l16c1]1234567890123456789012345678901234567890
are you sure about your modifications? there is a discussion in a driver forum with a sample driver that definitely has also offsets of 53 ?
I have just built your universal
branch, commit ebfb6a21
This is Tasmota 9.1.0.2
probably you won't see 1 pixel offsets with text. you should draw rectangles with full size to test like in the link
You are right, I found 1 pixel off in Rotate 1 using a rectangle. Working on a fix.
2 rotates should have 53 and 2 52
Test universal
branch with PR #30 changes, Tasmota 9.1.0.2
BackLog DisplayRotate 0; DisplayWidth 135; DisplayHeight 240; DisplayFont 0; DisplayCols 22; DisplayRows 29;
DisplayText [zr135:240s2l2c2] Tasmota [s1l7c2] IPS ST7789V 1.14" [l9c2] 135 x 240 [l11c2] Rotate 0
BackLog DisplayRotate 1; DisplayWidth 240; DisplayHeight 135; DisplayFont 0; DisplayCols 40; DisplayRows 16;
DisplayText [zr240:135s2l2c7] Tasmota [s1l7c2] IPS ST7789V 1.14" 135 x 240 [l9c2] Rotate 1
BackLog DisplayRotate 2; DisplayWidth 135; DisplayHeight 240; DisplayFont 0; DisplayCols 22; DisplayRows 29;
DisplayText [zr135:240s2l2c2] Tasmota [s1l7c2] IPS ST7789V 1.14" [l9c2] 135 x 240 [l11c2] Rotate 2
BackLog DisplayRotate 3; DisplayWidth 240; DisplayHeight 135; DisplayFont 0; DisplayCols 40; DisplayRows 17;
DisplayText [zr240:135s2l2c7] Tasmota [s1l7c2] IPS ST7789V 1.14" 135 x 240 [l9c2] Rotate 3
ok well done, had to change one define for my display but now it works for my display too. i also removed some unnecessary code
please test again and then you can make a pr to tasmota.
Thanks, will do it this evening (in Belgium)
@gemu2015 Can you maybe take a look at the compiler errors? https://github.com/gemu2015/Sonoff-Tasmota/pull/30#issuecomment-751878988
To repeat the warning you need to remove the .cache
and .pio
dirs and compile.
Never mind, I see you already fixed it
I have version using
backlight_pin: GPIO5
cs_pin: GPIO22
dc_pin: GPIO21
reset_pin: GPIO18
clk_pin: GPIO19
mosi_pin: GPIO23
miso_pin: GPIO25
TFT_WIDTH=240
TFT_HEIGHT=320
TFT_INVERSION_OFF ; for normal colors
TFT_RGB_ORDER=TFT_BGR ; Colour order Blue-Green-Red
with an FT6336U touch chip
@blakadder Can you test my PR https://github.com/arendst/Tasmota/pull/10310 ?
couldn't even get it to display anything
@blakadder Do you have a link to the product you have?
@blakadder did you use the very last dev version from today ?
and how did you connect your pins ? i use SSPI on both devices i have and did not test with spi (spi should work also i assume).
then in console type display and check if the driver was found.
if found, set the width to 320 for your display
since your display is the max possible resolution of the chip the zero offsets should work.
at least you should be able to switch backlight On and Off and see partial pictures
pins are not changeable and are as follows
backlight_pin: GPIO5
cs_pin: GPIO22
dc_pin: GPIO21
reset_pin: GPIO18
clk_pin: GPIO19
mosi_pin: GPIO23
miso_pin: GPIO25
i meant what was your pin function selection in Tasmota ?
i would suggest:
backlight_pin: GPIO5 Backlight cs_pin: GPIO22 ST7789_CS dc_pin: GPIO21 ST7789_DC reset_pin: GPIO18 OLED_Reset clk_pin: GPIO19 SSPI_SCLK mosi_pin: GPIO23 SSPI_MOSI miso_pin: GPIO25 not needed for display
ok got it working with that config... looks fine out of the box
nice to hear
to get the touch screen working you need to (only with scripting)
you then in a script can define touch buttons directly linked with relays or virtual buttons
one more hiccup: my display has inverted colors
this driver inverts your display (if width or height == 320)
Hello gemu2015, respect for your work, just came along since I bought the same device and am trying to get something drawn/written to this nice little board with display! But I'm going nearly crazy, I already checked out your Repo and compiled it, checked also the dev-repo from tasmota / Theo Arends out and compiled it (9.2.0.3), tried to use the nightly esp32 builds provided by Theo Arends and tried also nearly each combination of gpio setup for this device, only thing that works: Switching backlight on/off !
I don't know what I'm doing wrong, but trying to write out some text, also using your examples above, ends up with no output at all. Also playing with the fore- and background colours makes no difference.
When the device freshly powers up you see some kind of initialization (white stripes going down), then it goes to black screen and stays there. Playing with DisplayDimmer only makes the background look brighter or darker, that's it.
Actual configuration: GPIO4: Backlight GPIO5: ST7789CS GPIO16: ST7789DC GPIO18: SSPI SCLK GPIO19: SSPI MOSI GPIO23: OLED Reset
Program Version 9.2.0.3(display) Core/SDK Version 1_0_5_RC4/v3.3.4-286-gb4c075169
But trying out all other combinations with SPI, SSPI etc. only lead to no recognition of the display. Please shed some light on me...
Greetings joe
what hardware do you have ? if you have the 135x240 board you should ask @jeroenvermeulen
Hi, I also have the TTGO T-Display Dev-Board with 1.14" TFT. OK, so now my question goes to jeroenvermeulen :-)
These are my notes:
GPIO19 = SSPI MOSI/SID
GPIO18 = SSPI SCLK
GPIO5 = ST7789 CS
GPIO16 = ST7789 DC
GPIO23 = OLED Reset
GPIO4 = Backlight
Template for Software SPI:
{"NAME":"TTGO T-Display v1.1","GPIO":[1,1,1,1,992,6592,1,1,1,1,1,1,6624,1,896,864,0,640,608,1024,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1}
To test I enter in console:
BackLog DisplayModel 12; DisplayRotate 0; DisplayWidth 135; DisplayHeight 240; DisplayFont 0; DisplayCols 22; DisplayRows 29;
DisplayText [zr135:240s2C63488l2c2] Tasmota [s1C31l7c2] IPS ST7789V 1.14" [l9c2] 135 x 240 [l11c2] Rotate 0
Does this help?
Hi Jeroenvermeulen, thank you for your very fast reply also! It seems, the Template did the trick!!! I was using before the standard ESP32DEV template and had the GPIO's configured same like you (and all other combinations...), without success, now I activated the template and copy/pasted your test strings: That's it! Works!
Thank you so much! I was already going crazy about no succes even doing (nearly) everything like stated in this thread and all others I found on the Net.
Have a nice evening and thank you again for your help, also to Gemu2015! Greetings Joe
You're welcome. To make this help complete:
I build tasmota32
, this should be possible using the current development branch.
You need to have PlatformIO Core and esptool installed.
I use these settings in tasmota/user_config_override.h
:
#define USE_DISPLAY
#define USE_DISPLAY_ST7789
#define USE_SPI
#define SHOW_SPLASH
Build command:
platformio run -e tasmota32
Flash command:
BINDIR="build_output/firmware"
SERIAL="/dev/tty.usbserial-01F93A32"
wget https://github.com/arendst/Tasmota/raw/firmware/firmware/tasmota32/ESP32_needed_files/bootloader_dout_40m.bin -O $BINDIR/bootloader_dout_40m.bin
wget https://github.com/arendst/Tasmota/raw/firmware/firmware/tasmota32/ESP32_needed_files/partitions.bin -O $BINDIR/partitions.bin
wget https://github.com/arendst/Tasmota/raw/firmware/firmware/tasmota32/ESP32_needed_files/boot_app0.bin -O $BINDIR/boot_app0.bin
esptool.py \
--chip esp32 \
--port $SERIAL \
--baud 921600 \
--before default_reset \
--after hard_reset \
write_flash \
-z \
--flash_mode dout \
--flash_freq 40m \
--flash_size detect \
0x1000 $BINDIR/bootloader_dout_40m.bin \
0x8000 $BINDIR/partitions.bin \
0xe000 $BINDIR/boot_app0.bin \
0x10000 $BINDIR/tasmota32.bin
OK, thank you very much for this information, PlatformIO is already setup, GIT and ESPTOOL also, but since I'm quite new to this I was already wondering how to not build the whole platforms and derivates, flashing was no problem, using Tasmota already some time longer, but selfcompiling was the challenge...will try your settings! Thank's a lot!
Hi together is there still the need to compile by my self? Or is the Ttgo display already in the stable branch or the development branch?
Cheers Robert
On https://tasmota.github.io/docs/Firmware-Builds/#available-features-and-sensors you can search for USE_DISPLAY_ST7789
.
You will see it is not included by default in any build.
There is a Universal Display Driver, the file is here. The last time I have worked with a universal display driver it did not work as good as a compiled driver. It can also be quite a hassle to get it working.
So at the moment I got some information on the display. Could it be that I nee first to Set the Displaymode to 0 (DisplayText)?
Can you send a photo?
I just figured out, that I need to to configure a button. An after I pushed the button, the display shows something. A second push let the display turn off. Is this behaviour correct? Edit: No correct, you need to activate the Backlight by using the Toggle Switch on the WebGui
Yes, kind of. You can also use the Tasmota web interface. When there is a pin configured for the Display Background / Led, the last 'Toggle' button can be used to switch the display on/off. If you wish you can connect a physical button to this toggle.
I did not understand the button behaviour. When I configure a button in "Configure Module" should it normaly appears in on the first page of the webgui? It looks like every button number I choose is for turning the display on or off. I also didn't do any rules.
Can you maybe try to not configure a pin for Backlight
?
If you need a button to switch something else you can add a Relay with the same number.
Copy of Tasmota #10282 to discuss solution.
PROBLEM DESCRIPTION
A 135*240 ST7789 TFT is not working correct, caused by hard-coded _xstart and _ystart in Arduino_ST7789.cpp
REQUESTED INFORMATION
esptool.py --chip esp32 --port /dev/tty.usbserial-01F93A32 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 build_output/firmware/bootloader_dout_40m.bin 0x8000 build_output/firmware/partitions.bin 0xe000 build_output/firmware/boot_app0.bin 0x10000 build_output/firmware/tasmota32.bin
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log:define ST7789_TFTWIDTH 135
define ST7789_TFTHEIGHT 240
define ST7789_240x240_XSTART 53
define ST7789_240x240_YSTART 40
BackLog DisplayRotate 0; DisplayFont 1; DisplayCols 19; DisplayRows 20; DisplayMode 0 DisplayText [zl1c1]Hello, World!