mcufriend 2.8 tft 0139

I have updated the test_0139 Branch on GitHub.

Please try this sketch:

#include <Adafruit_GFX.h> // Hardware-specific library
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

void setup(void);
void loop(void);

uint16_t ID;

void setup(void)
{
    ID = tft.readID();
    tft.begin(ID);
    tft.setRotation(0);
    tft.setTextColor(BLACK);
    tft.setTextSize(2);
    switch (ID) {
        case 0x0139:
            break;
        case 0x0154:
            break;
        // 9320 style controllers
        case 0x1505:
        case 0xB505:
        case 0xC505:
        case 0x1580:
        case 0x6809:
        case 0x5408:
        case 0x7783:
        case 0x8230:
        case 0x9320:
        case 0x9325:
        case 0x9328:
            break;
        default:
            tft.fillScreen(MAGENTA);
            tft.println("Not Supported");
            while (1) ;
            break;
    }
}

void base_screen(char *msg)
{
    partial(1, 0, 0, 319);
    partial(2, 0, 0, 319);
    show_partial(0);    //BASEE
    tft.fillScreen(GREEN);
    tft.fillRect(0, 48, 240, 16, RED);
    tft.fillRect(0, 240, 240, 64, BLUE);
    tft.setCursor(0, 0);
    for (int line = 1; line <= 15; line++) {
        if (line < 10) tft.print("0");
        tft.print(line);
        tft.println((line == 4) ? ": IMAGE 1" : ":");
    }
    tft.println("PARTIAL 2 fixed here");
    tft.print("ID = 0x");
    tft.println(ID, HEX);
    tft.println(msg);
}

void partial(int n, int pos, int SA, int EA)
{
    if (ID == 0x7783) pos -= SA;
    switch (n) {
        case 1:
            switch (ID) {
                case 0x0139:
                    tft.WriteCmdData(0x43, SA);           //2
                    tft.WriteCmdData(0x42, EA);        //317
                    break;
                case 0x0154:
                    tft.WriteCmdData(0x35, SA);           //2
                    tft.WriteCmdData(0x34, EA);        //317
                    break;
                default:                       //9320 style
                    tft.WriteCmdData(0x80, pos);
                    tft.WriteCmdData(0x81, SA);           //2
                    tft.WriteCmdData(0x82, EA);        //317
                    break;
            }
        case 2:
            switch (ID) {
                case 0x0139:
                    tft.WriteCmdData(0x45, SA);           //2
                    tft.WriteCmdData(0x44, EA);        //317
                    break;
                case 0x0154:
                    // nuffink.  only one Partial
                    break;
                default:                       //9320 style
                    tft.WriteCmdData(0x83, pos);
                    tft.WriteCmdData(0x84, SA);           //2
                    tft.WriteCmdData(0x85, EA);        //317
                    break;
            }
    }
}

void show_partial(int mode)
{
    switch (ID) {
        case 0x0139:
            mode = (mode & 2) ? 0x0100 : 0;   //SPT
            tft.WriteCmdData(0x07, mode | 0x0033); //
            break;
        case 0x0154:
            break;
        default:                       //9320 style
            if (mode == 0) mode = 0x0100; //BASEE
            else mode = mode << 12;   //PTDEn
            tft.WriteCmdData(0x07, mode | 0x0033); //PTDE0=1, PTDE1=1
            break;
    }
    delay(1000);   //handy pause
}

void scroll_0139(void)
{
    partial(1, 0, 0, 319);
    partial(2, 0, 0, 319);
    tft.WriteCmdData(0x07, 0x0233); // VLE1=1
    for (int VL = 1; VL < 320; VL++) {
        tft.WriteCmdData(0x41, VL);
        delay(20);
    }
    delay(1000);
    tft.WriteCmdData(0x41, 0);
    tft.WriteCmdData(0x07, 0x0233); // VLE1=0
}

void loop(void)
{
    base_screen("Move IMAGE from GRAM");
    partial(1, 0x80, 0x30, 0x3F);
    partial(2, 240, 240, 303);
    show_partial(1);    //Partial 1
    show_partial(3);    //Bofe
    for (int pos = 0x80; pos < 224; pos++) {
        partial(1, pos, 0x30, 0x3F);
        partial(2, 240, 240, 303);
        delay(50);
    }
    //    show_partial(3);    //Bofe
    delay(1000);
    base_screen("Move GRAM to Screen");
    show_partial(3);    //Bofe
    for (int SA = 0x80; SA < 224; SA++) {
        partial(1, 0x30, SA, SA + 15);
        partial(2, 240, 240, 303);
        delay(50);
    }
    delay(1000);
    base_screen("Vertical Scroll");
    if (ID == 0x0139) scroll_0139();
    else {
        for (int VL = 1; VL <= 320; VL++) {
            tft.vertScroll(0, 320, VL);
            delay(20);
        }
    }
    delay(1000);
}

Please report back.

I would expect a BLUE message with a moving GREEN line and a stationary RED line "IMAGE 1" on a WHITE background.
An ILI9320 should give a moving RED line and a stationary GREEN line (with changing contents)

The "Vertical Scroll" may or may not work.

David.