From 9d7bc4f0c0de4d8472a7d2cb922b96dd158da88a Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Tue, 15 Aug 2023 13:29:14 +0800 Subject: [PATCH] remove unused code --- Core/Src/main.c | 9 ++++----- mlx90640/mlx90640_lcd_display.c | 33 ++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Core/Src/main.c b/Core/Src/main.c index 5950fe0..1bcf060 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -114,10 +114,9 @@ int main(void) BSP_LCD_Init(); BSP_LCD_Clear(LCD_COLOR_BLUE); - BSP_LCD_DisplayOn(); - LCD_BL_ON(); - APP_LOG(TS_OFF, VLEVEL_L, "BSP LCD TEST....\r\n"); - BSP_LCD_Test(); + + //APP_LOG(TS_OFF, VLEVEL_L, "BSP LCD TEST....\r\n"); + //BSP_LCD_Test(); // BSP_LCD_DisplayOff(); @@ -131,7 +130,7 @@ int main(void) /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ - //BSP_LCD_DisplayOff(); + mlx90640_display_process(); } //HAL_TIM_PWM_Start(&htim3,TIM_CHANNEL_1); diff --git a/mlx90640/mlx90640_lcd_display.c b/mlx90640/mlx90640_lcd_display.c index 037375d..e533eab 100644 --- a/mlx90640/mlx90640_lcd_display.c +++ b/mlx90640/mlx90640_lcd_display.c @@ -181,7 +181,7 @@ static void drawMeasurement(void ) { memset(tempBuffer,0,sizeof(tempBuffer)); sprintf(tempBuffer,(char *)"%2d", (uint8_t)max(v_water_cnt, h_water_cnt)); BSP_LCD_DisplayStringAt(ST7789V_LCD_PIXEL_WIDTH-60, 15,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_YELLOW); - APP_LOG(TS_OFF, VLEVEL_L, "%s\r\n",tempBuffer); + //APP_LOG(TS_OFF, VLEVEL_L, "%s\r\n",tempBuffer); } @@ -190,10 +190,10 @@ static void drawPicture(void) uint8_t h_cnt[32]={0},v_cnt[24]={0}; //for horizon and vertical _water spill count // start from 2, ignore edge of FOV - for (y=2; y<22; y++) + for (y=2; y<23; y++) { BSP_LCD_FillRect(0, y*11+16, ST7789V_LCD_PIXEL_WIDTH, 4, LCD_COLOR_BLACK); - for (x=2; x<30; x++) // Start from 2, ignore edge of FOV + for (x=2; x<31; x++) // Start from 2, ignore edge of FOV { if (zoneMask[y*32+x] > 3) { @@ -207,16 +207,32 @@ static void drawPicture(void) // simple count of water spill point cloud v_water_cnt=0; h_water_cnt=0; - for (y=2; y<23; y++) { + uint8_t v_1=0, v_2=0,h_1=0,h_2=0; + + for (y=1; y<12; y++) { if ((1 == v_cnt[y]) && (0 == v_cnt[y-1])) { - v_water_cnt ++; + v_1++; } } - for (x=2; x<32; x++) { + for (y=12; y<23; y++) { + if ((1 == v_cnt[y]) && (0 == v_cnt[y-1])) { + v_2++; + } + } + v_water_cnt= v_1 + v_2; + + for (x=1; x<16; x++) { if ((1 == h_cnt[x]) && (0 == h_cnt[x-1])) { - h_water_cnt ++; + h_1 ++; } } + for (x=16; x<32; x++) { + if ((1 == h_cnt[x]) && (0 == h_cnt[x-1])) { + h_2 ++; + } + } + h_water_cnt = h_1 + h_2; + } // Read pixel data from MLX90640. @@ -257,7 +273,6 @@ void blackOutFilter(void) if ((temp1 + (float)(waterTempThreshold/10.0)) < averageTemp ) { zoneMask[y*32+x] ++; - APP_LOG(TS_OFF, VLEVEL_L, "Detect Zone X=%d Y=%d Count=%d T=%2.2f \r\n", x, y, zoneMask[y*32+x], (int)(temp1+waterTempThreshold/10.0)); waterSpillCount ++; } } @@ -300,7 +315,7 @@ void mlx90640_display_process(void) // BSP_LCD_DisplayOff(); } - APP_LOG(TS_OFF, VLEVEL_L, "Water Spill Detected Level = %d of %d, \r\n", waterSpillCount, 30*20); + //APP_LOG(TS_OFF, VLEVEL_L, "Water Spill Detected Level = %d of 600 \r\n", waterSpillCount); } void mlx90640_display_init(void){