esp32-smartdisplay icon indicating copy to clipboard operation
esp32-smartdisplay copied to clipboard

esp32-1732S019N Rotation 90/270 Broken

Open lincomatic opened this issue 10 months ago • 6 comments

On the 1732S019N (ST7789 170x320), rotation 0 and 180 work properly, but 90 and 270 result in garbage thin horizontal dotted lines on the screen.

I'm using the lines from your sample code:

    smartdisplay_init();

    //__attribute__((unused)) auto disp = lv_disp_get_default();
    lv_disp_set_rotation(disp, LV_DISP_ROTATION_90);
    // lv_disp_set_rotation(disp, LV_DISP_ROTATION_180);
    // lv_disp_set_rotation(disp, LV_DISP_ROTATION_270);

    ui_init();

lincomatic avatar Feb 02 '25 04:02 lincomatic

Are you using the demo? It the dimensions might be out of bounds and this might result in writing outside the buffer (this creating strange images)...

rzeldent avatar Feb 08 '25 11:02 rzeldent

I reproduced this too.

The bug seems to be correlated with the DISPLAY_GAP_X and DISPLAY_GAP_Y defines in the board file. The board definition is in vertical mode (height > width) and sets DISPLAY_GAP_X=35 and DISPLAY_GAP_Y=0.

If you want to use it in horizontal mode you have to swap the gaps, setting DISPLAY_GAP_X=0 and DISPLAY_GAP_Y=35. Then in the app code you can set lv_disp_set_rotation(disp, LV_DISP_ROTATION_90) or lv_disp_set_rotation(disp, LV_DISP_ROTATION_270) and it will work correctly.

This is not ideal, maybe a solution could be to implement a custom rotation function that also sets the gaps with the function esp_lcd_panel_set_gap in the swapped order if the chosen orientation is 90 or 270.

antlanc7 avatar Mar 20 '25 14:03 antlanc7

Any progress on this as I have the same problem. Workaround from antlanc7 didn't fix it for me.

GeoffWebster avatar Jul 03 '25 11:07 GeoffWebster

antlanc7' workaround didn't work for me (see previous post) but using his workaround as a clue, I came up with working display for 90 deg and 270 deg by using "'-D DISPLAY_GAP_X=-20'", "'-D DISPLAY_GAP_Y=35'".

GeoffWebster avatar Jul 04 '25 09:07 GeoffWebster

Yeah it depends on the specific display you have.

antlanc7 avatar Jul 04 '25 09:07 antlanc7

These values work with the built-in display (170 x 240) of the ESP32-1732S019N board, the same one that started the ball rolling on this bug report

GeoffWebster avatar Jul 04 '25 10:07 GeoffWebster