refine display window

This commit is contained in:
Yunhorn 2023-08-10 10:01:11 +08:00
parent 94f2a19144
commit e9596d0ab4
3 changed files with 32 additions and 13 deletions

View File

@ -134,7 +134,11 @@ static void drawLegend(void)
BSP_LCD_DrawHLine(0,246,ST7789V_LCD_PIXEL_WIDTH, LCD_COLOR_LIGHTBLUE);
BSP_LCD_DrawHLine(0,245,ST7789V_LCD_PIXEL_WIDTH, LCD_COLOR_LIGHTBLUE);
#if 0
BSP_LCD_DrawHLine(0,0,ST7789V_LCD_PIXEL_WIDTH, LCD_COLOR_LIGHTBLUE);
BSP_LCD_DrawVLine(0,0,ST7789V_LCD_PIXEL_HEIGHT-16-2, LCD_COLOR_LIGHTBLUE);
BSP_LCD_DrawVLine(ST7789V_LCD_PIXEL_WIDTH/2,0,ST7789V_LCD_PIXEL_HEIGHT-16-16, LCD_COLOR_LIGHTBLUE);
#endif
BSP_LCD_SetFont(&Font16);
memset(tempBuffer,0,sizeof(tempBuffer));
DrawProp.BackColor = LCD_COLOR_BLACK;
@ -206,7 +210,7 @@ averageTemp = 0.0;
for (i=0; i<32*24; i++)
averageTemp += tempValues[i];
averageTemp /= 768;
BSP_LCD_FillRect(0,0,ST7789V_LCD_PIXEL_WIDTH, ST7789V_LCD_PIXEL_HEIGHT-16, LCD_COLOR_BLACK);
BSP_LCD_FillRect(1,1,ST7789V_LCD_PIXEL_WIDTH-2, ST7789V_LCD_PIXEL_HEIGHT-16-16, LCD_COLOR_BLACK);
for (y=1; y<23; y++)
{
for (x=1; x<31; x++)
@ -258,9 +262,11 @@ static void readTempValues(void) {
static uint8_t blackOutFilter(void)
{
if (maxTemp < normalPeopleTemp) {
return 1;
} else {
blackOutTag =0;
return 0;
} else {
blackOutTag =1;
return 1;
}
}
void mlx90640_display_process(void)

View File

@ -133,8 +133,8 @@ void st7789v_Init(void)
/* Out of sleep mode, 0 args, no delay */
st7789v_WriteRegCmd(0x11);
HAL_Delay(120);
st7789v_WriteRegCmd(0x36);
st7789v_WriteRegCmd(0x36);
if (st7789v_rotation ==0) st7789v_WriteRegCmd(0x00);
else if (st7789v_rotation ==1) st7789v_WriteRegCmd(0xC0);
if (st7789v_rotation ==2) st7789v_WriteRegCmd(0x70);
@ -370,12 +370,22 @@ void st7789v_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t
void st7789v_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint8_t counter = 0;
if(Ypos + Length > ST7789V_LCD_PIXEL_HEIGHT) return;
for(counter = 0; counter < Length; counter++)
{
st7789v_WritePixel(Xpos, Ypos + counter, RGBCode);
}
if(0 == st7789v_rotation || 2 == st7789v_rotation){
if(Ypos + Length > ST7789V_LCD_PIXEL_HEIGHT) return;
for(counter = 0; counter < Length; counter++)
{
st7789v_WritePixel(Xpos, Ypos, RGBCode);
}
} else {
if(Ypos + Length > ST7789V_LCD_PIXEL_WIDTH) return;
for(counter = 0; counter < Length; counter++)
{
st7789v_WritePixel(Xpos, Ypos, RGBCode);
}
}
}
/**
@ -484,7 +494,10 @@ void st7789_SetRotation(uint8_t rotation)
case 0:
/* Memory access control: MY = 0, MX = 0, MV = 0, ML = 0 */
/* */
#if 1
st7789v_WriteReg(0X2A, 0x01);
st7789v_WriteReg(0X2A, 0x02);
st7789v_WriteReg(0X2B, 0x01);
#if 0
st7789v_WriteReg(0X36, 0x08);
st7789v_WriteReg(0x2A, 0x00);
st7789v_WriteReg(0x2A, 0x00);

View File

@ -158,7 +158,7 @@ uint8_t BSP_LCD_Init(void)
//LCD_IO_Init();
/* LCD Init */
lcd_drv->Init();
lcd_drv->SetRotation(2);
lcd_drv->SetRotation(0);
#if 0
/* Clear the LCD screen */
BSP_LCD_Clear(LCD_COLOR_WHITE);