Closed ihayri closed 1 year ago
@ihayri Thank you for your interest ! I don't own an ILI9481 yet, so I can't check how it works. I would also like to get ILI9481. Please let me know the product page URL and other information of the panel you purchased.
I've tentatively added the definition to the develop branch, so please try it out.
I think the basic functions will probably work, but there are many things like adjusting the rotation direction and reading pixel data that I need to see in action.
Hi, thank you so much for replying. This is the link where I did buy my displays, it is the ILI9481 with single point touch display that uses the FT6236 chip that your great library supports as well.
https://www.aliexpress.com/item/1005001309491536.html
Here is a video I made today, where I do show the display and after much searching I finally found a library that does work with the ILI9481 and over SPI, as most other libraries do use parallel connection, which I would like not do do as it uses too many pins.
Your library works great with the ILI9488 which you can see in the video as well.
https://github.com/moononournation/Arduino_GFX
I hope it is ok if I put links here, if not please remove them or I can do it I presume.
If there is anything I can do to help please let me know, thanks.
@ihayri Thanks for letting me know where to buy it ! I placed an order immediately. It will probably take about two weeks to arrive.
In the meantime, I've added support for ILI9481 to the "develop" branch, so you can try it out.
You are most welcome. I will try the the library and let you know later on. Will go to bed soon as it is 5 o' clock in the morning here. Take care and thank you.
Hi lovyan, I am at it since this morning but so far I could not get it to work, I am probably doing something wrong. This is the code I am using:
#include <LovyanGFX.hpp>
#include "Panel_ILI9481.hpp"
struct LGFX_Config
{
static constexpr spi_host_device_t spi_host = HSPI_HOST;
static constexpr int dma_channel = 0;
static constexpr int spi_sclk = 14;
static constexpr int spi_mosi = 13;
static constexpr int spi_miso = 12;
static constexpr int spi_cs = 18;
static constexpr int spi_dc = 22;
static constexpr int spi_rst = 21;
static constexpr int spi_dlen = 8;
};
static lgfx::LGFX_SPI<LGFX_Config> lcd;
static lgfx::Panel_ILI9481 panel;
static lgfx::Touch_FT5x06 touch;
void setup(void)
{
Serial.begin(115200);
panel.freq_write = 27000000;
panel.freq_fill = 27000000;
panel.freq_read = 16000000;
panel.spi_mode = 0;
panel.spi_mode_read = 0;
panel.len_dummy_read_pixel = 8;
panel.spi_read = true;
panel.spi_3wire = false;
panel.spi_cs = 15;
panel.spi_dc = 33;
panel.gpio_rst = 26;
panel.gpio_bl = 5;
panel.pwm_ch_bl = 5;
panel.backlight_level = true;
panel.reverse_invert = false;
panel.rgb_order = true;
panel.memory_width = 320;
panel.memory_height = 480;
panel.panel_width = 320;
panel.panel_height = 480;
panel.offset_x = 0;
panel.offset_y = 0;
panel.rotation = 1;
panel.offset_rotation = 0;
lcd.setPanel(&panel);
touch.i2c_port = I2C_NUM_1;
touch.i2c_sda = 26;
touch.i2c_scl = 27;
touch.i2c_addr = 0x38;
touch.freq = 400000;
touch.x_min = 0;
touch.x_max = 319;
touch.y_min = 0;
touch.y_max = 319;
lcd.setTouch(&touch);
lcd.init();
Serial.println("lcd.init done");
if (lcd.width() > 240 || lcd.height() > 240) lcd.setTextSize(2);
if (lcd.touch())
{
if (lcd.width() < lcd.height()) lcd.setRotation(3 & (lcd.getRotation() + 1));
lcd.drawString("touch the arrow marker.", 0, lcd.height() >> 1);
lcd.clear();
}
}
uint32_t count = ~0;
void loop(void)
{
// Serial.println("void loop started");
delay(10);
lcd.startWrite();
lcd.setRotation(++count & 7);
lcd.setColorDepth((count & 8) ? 16 : 24);
lcd.setTextColor(random(65536));
lcd.drawNumber(lcd.getRotation(), 16, 0);
lcd.setTextColor(0xFF0000U);
lcd.drawString("R", 30, 16);
lcd.setTextColor(0x00FF00U);
lcd.drawString("G", 40, 16);
lcd.setTextColor(0x0000FFU);
lcd.drawString("B", 50, 16);
lcd.drawRect(30, 30, lcd.width() - 60, lcd.height() - 60, random(65536));
lcd.endWrite();
int32_t x, y;
if (lcd.getTouch(&x, &y)) {
lcd.fillRect(x - 2, y - 2, 5, 5, random(65536));
Serial.print("x = ");
Serial.print(x);
Serial.print(" y = ");
Serial.println(y);
}
}
Hope this is the correct way to add code :-)
I did add a new tab with Panel_ILI9481.hpp , with #include "Panel_ILI9481.hpp" Which might not be needed or completely wrong, sorry.
@ihayri Yes, you don't need that include statement.
Are you currently experiencing any errors? Or is there something wrong with the operation? I'm counting on your reports. Please let me know what's happening.
Hi there, I am working on it with Tobozo since this morning and we have some steps toward it working. this is the stripped down version:
struct LGFX_Config
{
static constexpr spi_host_device_t spi_host = HSPI_HOST;
static constexpr int dma_channel = 0;
static constexpr int spi_sclk = 14;
static constexpr int spi_mosi = 13;
static constexpr int spi_miso = 12;
static constexpr int spi_dlen = 8;
};
panel.freq_write = 12000000;
panel.freq_fill = 12000000;
panel.freq_read = 12000000;
panel.spi_mode = 0;
panel.spi_mode_read = 0;
panel.len_dummy_read_pixel = 8;
panel.spi_read = true;
panel.spi_3wire = false;
panel.spi_cs = 15;
panel.spi_dc = 33;
panel.gpio_rst = 26;
panel.gpio_bl = 5;
panel.pwm_ch_bl = 5;
panel.backlight_level = true;
panel.reverse_invert = true;
panel.rgb_order = false;
panel.memory_width = 320;
panel.memory_height = 480;
panel.panel_width = 320;
panel.panel_height = 480;
panel.offset_x = 0;
panel.offset_y = 0;
panel.rotation = 1;
panel.offset_rotation = 0; // tried with 1, no change on the display
static constexpr std::uint8_t list0[] = {
CMD::SLPOUT , CMD_INIT_DELAY, 5, // Exit sleep mode
CMD::PWSET , 3, 0x07, 0x41, 0x1D,
CMD::VMCTR , 3, 0x00, 0x1C, 0x1F,
CMD::PWSETN , 2, 0x01, 0x11,
CMD::PNLDRV , 5, 0x10, 0x3B, 0x00, 0x02, 0x11,
CMD::FRMCTR , 1, 0x03,
CMD::IFCTR , 1, 0x83,
CMD::GMCTR ,12, 0x00, 0x26, 0x21, 0x00, 0x00, 0x1F,
0x65, 0x23, 0x77, 0x00, 0x0F, 0x00,
0xB0 , 1, 0x00, // CommandAccessProtect
0xE4 , 1, 0xA0,
0xF0 , 1, 0x01,
0xFF,0xFF, // end
};
and a picture
Hello Lovyan,
I did some progress and it does work now, the only thing I can not add are custom colors. Here is the current code:
#include <LovyanGFX.hpp>
struct LGFX_Config
{
static constexpr spi_host_device_t spi_host = HSPI_HOST;
static constexpr int dma_channel = 0;
static constexpr int spi_sclk = 14;
static constexpr int spi_mosi = 13;
static constexpr int spi_miso = 12;
static constexpr int spi_dlen = 8;
static constexpr int TFT_DARKGRAY = 0x7BEF; // does not work
};
static lgfx::LGFX_SPI<LGFX_Config> lcd;
static lgfx::Panel_ILI9481 panel;
//static lgfx::Touch_FT5x06 touch;
void setup() {
Serial.begin(115200);
panel.freq_write = 17000000;
panel.freq_fill = 17000000;
panel.freq_read = 27000000;
panel.spi_mode = 0;
panel.spi_mode_read = 0;
panel.len_dummy_read_pixel = 8;
panel.spi_read = true;
panel.spi_3wire = false;
panel.spi_cs = 15;
panel.spi_dc = 33;
panel.gpio_rst = 26;
panel.gpio_bl = 5;
panel.pwm_ch_bl = 5;
panel.backlight_level = true;
panel.reverse_invert = true;
panel.rgb_order = false;
panel.memory_width = 320;
panel.memory_height = 480;
panel.panel_width = 320;
panel.panel_height = 480;
panel.offset_x = 0;
panel.offset_y = 0;
panel.rotation = 1;
panel.offset_rotation = 0;
lcd.setPanel(&panel);
lcd.init();
lcd.setBrightness(255);
lcd.setColorDepth(24);
// lcd.fillScreen (TFT_DARKGRAY); // produces vertical lines and wrong color
lcd.fillScreen (TFT_BLACK);
lcd.setTextSize(4);
lcd.setTextColor(TFT_RED, TFT_BLACK);
lcd.drawString("R", 30, 30);
lcd.setTextColor(TFT_GREEN);
lcd.drawString("G", 60, 30);
lcd.setTextColor(TFT_BLUE);
lcd.drawString("B", 90, 30);
lcd.setTextColor(TFT_YELLOW, TFT_BLUE);
lcd.setTextSize(3);
lcd.drawString("ILI9481 Working", 30, 90);
lcd.drawRect(30, 30, lcd.width() - 60, lcd.height() - 60, TFT_BLUE);
delay(3000);
}
void loop() {
lcd.setTextSize(4);
lcd.setTextColor(TFT_WHITE, TFT_RED);
lcd.drawString("R", 30, 30);
delay(1000);
lcd.setTextColor(TFT_BLACK, TFT_GREEN);
lcd.drawString("G", 60, 30);
delay(1000);
lcd.setTextColor(TFT_YELLOW, TFT_BLUE);
lcd.drawString("B", 90, 30);
}
and a picture
PS: it does not like random colors, that was the problem in the first picture.
I am sure you can fix that. Somehow the panel frequencies are pretty low.
maybe the pdf file will help you further if you don't have it already.
Thank you very much for all your work and thanks to Tobozo as well of course.
Just noticed that he edited my first code upload to me more readable, thanks Tobozo :-)
@ihayri Thank you for the information.
Do not make TFT_DARKGRAY a member of LGFX_Config. It should be placed outside of LGFX_Config.
I ordered ILI9481 and it seems it has already shipped. I will make adjustments when I receive the product.
No problem, anyway I can help is good.
Correct, never mind the color definition, did remove that and put it at the beginning of the code. It works rather nicely with digits updating without any flicker by just using fore and background colors.
So far I am loving this display and tomorrow I can finally try it outside in sunlight, where it is supposed to be seen without a problem. Viewing angles are great of course, being a IPS display.
Thank you again for your great library and all your help.
Now I'm using ILI9481 on an ESP32 with 12MHz SPI. It's too slow for me. And its pixels cannot be read in your examples. What can I do? My sketch needs to read pixels on it.
@fsender Try changing the settings here.
panel.spi_3wire = false; // or true
closing this issue as solved, feel free to reopen if needed
Hi Lovyan, first of all, thank you for your great work on making this library. Was using the TFT_eSPI from Bodmer, thanks to him as well of course, but yours seems a bit faster and I love your analog gauge. Today I received my ILI9481 IPS displays and wonder if you could add that driver to your library. The display is a 3.5" 480x320 pixel with the FT6236 capacitive touchscreen controller, which you library supports as well, and has the ILI9481 driver chip as opposed to the ILI9488 which my Makerfabs display uses. Btw, Bodmer's library does support the ILI9481 and I tried to add it to your library but the configuration files are quite different. I am of course happy to test and give feedback. The reason why I did go with the ILI9481 is that the display is IPS and fully sunlight readable which I need for my project. Thank you very much in advance and if there is anything I can do to help. please let me know. Happy New Year.