revise display legend and time scale

This commit is contained in:
Yunhorn 2023-08-07 19:03:33 +08:00
parent 10a012c390
commit b01fa57bd9
3 changed files with 19 additions and 19 deletions

View File

@ -110,19 +110,21 @@ static void setAbcd(void) {
// Draw a legend.
static void drawLegend(void) {
float inc = (maxTemp - minTemp) / 224.0f;
j = 0;
for (ii = minTemp; ii < maxTemp; ii += inc) {
BSP_LCD_DrawVLine(8+ + j++, 292, 20, TempToColor(ii));
BSP_LCD_DrawVLine(8+ + j, 260, 20, TempToColor(ii));
j+=10;
}
BSP_LCD_SetFont(&Font16);
memset(tempBuffer,0,sizeof(tempBuffer));
sprintf(tempBuffer,(char *)"%2.1f",minTemp);
BSP_LCD_DisplayStringAt(8,230,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_BLUE);
BSP_LCD_DisplayStringAt(8,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_BLUE);
memset(tempBuffer,0,sizeof(tempBuffer));
sprintf(tempBuffer,(char *)"%2.1f",maxTemp);
BSP_LCD_DisplayStringAt(190,230,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_RED);
BSP_LCD_DisplayStringAt(190,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_RED);
}
@ -138,13 +140,13 @@ static void drawMeasurement(void ) {
BSP_LCD_SetFont(&Font16);
memset(tempBuffer,0,sizeof(tempBuffer));
sprintf(tempBuffer,(char *)"%2.2f ",centerTemp);
BSP_LCD_DisplayStringAt(88,230,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_RED);
BSP_LCD_DisplayStringAt(88,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_RED);
}
static void drawPicture(void) {
for (y=0; y<24; y++) {
for (x=0; x<32; x++) {
BSP_LCD_FillRect(x*10, y*10, 9, 10, TempToColor(tempValues[(x) + (y*32)]));
BSP_LCD_FillRect(x*10, y*11, 9, 11, TempToColor(tempValues[(x) + (y*32)]));
}
}
}

View File

@ -516,7 +516,7 @@ void st7789_SetRotation(uint8_t rotation)
break;
case 2:
/* Memory access control: MY = 1, MX = 1, MV = 0, ML = 0 */
#if 0
#if 1
st7789v_WriteReg(0X36, 0xC8);
st7789v_WriteReg(0x2A, 0x00);
st7789v_WriteReg(0x2A, 0x00);
@ -532,7 +532,7 @@ void st7789_SetRotation(uint8_t rotation)
break;
case 3:
/* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */
#if 0
#if 1
st7789v_WriteReg(0X36, 0xA8);
st7789v_WriteReg(0x2A, 0x00);
st7789v_WriteReg(0x2A, 0x00);

View File

@ -157,7 +157,7 @@ uint8_t BSP_LCD_Init(void)
//LCD_IO_Init();
/* LCD Init */
lcd_drv->Init();
lcd_drv->SetRotation(1);
lcd_drv->SetRotation(2);
#if 0
/* Clear the LCD screen */
BSP_LCD_Clear(LCD_COLOR_WHITE);
@ -1338,26 +1338,23 @@ void LCD_Delay(uint32_t Delay)
void BSP_LCD_Test(void)
{
BSP_LCD_Clear(LCD_COLOR_WHITE);
HAL_Delay(500);
HAL_Delay(200);
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Clear with red...........\r\n");
BSP_LCD_Clear(LCD_COLOR_RED);
HAL_Delay(500);
HAL_Delay(200);
BSP_LCD_Clear(LCD_COLOR_RED);
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Clear with blue...........\r\n");
BSP_LCD_Clear(LCD_COLOR_BLUE);
HAL_Delay(500);
HAL_Delay(200);
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Clear with YELLOW...........\r\n");
BSP_LCD_Clear(LCD_COLOR_YELLOW);
HAL_Delay(500);
HAL_Delay(200);
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Clear with GREEN...........\r\n");
BSP_LCD_Clear(LCD_COLOR_GREEN);
HAL_Delay(500);
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Clear with WHITE...........\r\n");
BSP_LCD_Clear(LCD_COLOR_WHITE);
HAL_Delay(500);
HAL_Delay(200);
#if 0
BSP_LCD_FillRect(0,0,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT,LCD_COLOR_WHITE);
HAL_Delay(500);
BSP_LCD_FillRect(0,0,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT,LCD_COLOR_RED);
@ -1370,7 +1367,7 @@ void BSP_LCD_Test(void)
BSP_LCD_FillRect(0,0,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT,LCD_COLOR_LGRAYBLUE);
HAL_Delay(500);
BSP_LCD_FillRect(0,0,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT,LCD_COLOR_BLUE);
#endif
#if 0
BSP_LCD_DisplayStringAt(10, 20, "Speed Test", LEFT_MODE, LCD_COLOR_RED);
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Speed Test...........");
@ -1389,6 +1386,7 @@ void BSP_LCD_Test(void)
BSP_LCD_Clear(LCD_COLOR_WHITE);
BSP_LCD_Clear(LCD_COLOR_BLACK);
#endif
#if 0
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Font and Hellow world Test...........");
BSP_LCD_DisplayStringAt(10, 10, "Font test.", LEFT_MODE, LCD_COLOR_RED);
BSP_LCD_DisplayStringAt(10, 50, "Hello World!", LEFT_MODE, LCD_COLOR_RED);
@ -1425,7 +1423,7 @@ void BSP_LCD_Test(void)
BSP_LCD_Clear(LCD_COLOR_BLACK);
//BSP_LCD_DrawBitmap(0, 0, (char *)gImage_1);
HAL_Delay(500);
#endif
/*
ST7789_Fill_Color(BLACK);