Check for LV_USE_LOG when logging orientation

This commit is contained in:
C47D 2022-01-07 15:16:27 -06:00 committed by Carlos Diaz
parent dcff9a7f11
commit bb0e3a1f27
6 changed files with 30 additions and 23 deletions

View file

@ -221,12 +221,6 @@ static void GC9A01_set_orientation(uint8_t orientation)
{ {
assert(orientation < 4); assert(orientation < 4);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
};
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
#if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK #if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK
const uint8_t data[] = {0x68, 0x68, 0x08, 0x08}; const uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_WROVER4) #elif defined (CONFIG_LV_PREDEFINED_DISPLAY_WROVER4)
@ -235,7 +229,14 @@ static void GC9A01_set_orientation(uint8_t orientation)
const uint8_t data[] = {0x08, 0xC8, 0x68, 0xA8}; const uint8_t data[] = {0x08, 0xC8, 0x68, 0xA8};
#endif #endif
#if (LV_USE_LOG == 1);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
};
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]);
#endif
GC9A01_send_cmd(0x36); GC9A01_send_cmd(0x36);
GC9A01_send_data((void *) &data[orientation], 1); GC9A01_send_data((void *) &data[orientation], 1);

View file

@ -223,11 +223,12 @@ static void ili9163c_set_orientation(uint8_t orientation)
{ {
assert(orientation < 4); assert(orientation < 4);
#if (LV_USE_LOG == 1)
const char *orientation_str[] = { const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"}; "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"};
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
#endif
uint8_t data[] = {0x48, 0x88, 0xA8, 0x68}; uint8_t data[] = {0x48, 0x88, 0xA8, 0x68};
ili9163c_send_cmd(ILI9163C_MADCTL); ili9163c_send_cmd(ILI9163C_MADCTL);

View file

@ -165,15 +165,16 @@ static void ili9486_set_orientation(uint8_t orientation)
{ {
assert(orientation < 4); assert(orientation < 4);
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#if (LV_USE_LOG == 1)
const char *orientation_str[] = { const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
}; };
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]);
#endif
ili9486_send_cmd(0x36); ili9486_send_cmd(0x36);
ili9486_send_data((void *) &data[orientation], 1); ili9486_send_data((void *) &data[orientation], 1);

View file

@ -188,16 +188,16 @@ static void ili9488_send_color(lv_disp_drv_t * drv, void * data, uint16_t length
static void ili9488_set_orientation(lv_disp_drv_t * drv, uint8_t orientation) static void ili9488_set_orientation(lv_disp_drv_t * drv, uint8_t orientation)
{ {
assert(orientation < 4); assert(orientation < 4);
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#if (LV_USE_LOG == 1)
const char *orientation_str[] = { const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
}; };
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]);
#endif
ili9488_send_cmd(drv, 0x36); ili9488_send_cmd(drv, 0x36);
ili9488_send_data(drv, (void *) &data[orientation], 1); ili9488_send_data(drv, (void *) &data[orientation], 1);

View file

@ -205,11 +205,7 @@ static void st7735s_send_color(void * data, uint16_t length)
static void st7735s_set_orientation(uint8_t orientation) static void st7735s_set_orientation(uint8_t orientation)
{ {
const char *orientation_str[] = { assert(orientation < 4);
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
};
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
/* /*
Portrait: 0xC8 = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_BGR Portrait: 0xC8 = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_BGR
@ -218,7 +214,14 @@ static void st7735s_set_orientation(uint8_t orientation)
*/ */
uint8_t data[] = {0xC8, 0xC8, 0xA8, 0xA8}; uint8_t data[] = {0xC8, 0xC8, 0xA8, 0xA8};
#if (LV_USE_LOG == 1)
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
};
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]);
#endif
st7735s_send_cmd(ST7735_MADCTL); st7735s_send_cmd(ST7735_MADCTL);
st7735s_send_data((void *) &data[orientation], 1); st7735s_send_data((void *) &data[orientation], 1);

View file

@ -189,11 +189,6 @@ static void st7796s_set_orientation(uint8_t orientation)
{ {
assert(orientation < 4); assert(orientation < 4);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"};
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
#if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK #if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK
const uint8_t data[] = {0x68, 0x68, 0x08, 0x08}; const uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
#elif defined(CONFIG_LV_PREDEFINED_DISPLAY_WROVER4) #elif defined(CONFIG_LV_PREDEFINED_DISPLAY_WROVER4)
@ -204,7 +199,13 @@ static void st7796s_set_orientation(uint8_t orientation)
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8}; const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#endif #endif
#if (LV_USE_LOG == 1)
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"};
LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]);
LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]);
#endif
st7796s_send_cmd(0x36); st7796s_send_cmd(0x36);
st7796s_send_data((void *)&data[orientation], 1); st7796s_send_data((void *)&data[orientation], 1);