remove unused code

This commit is contained in:
Yunhorn 2023-08-15 13:29:14 +08:00
parent a57242ba2d
commit 9d7bc4f0c0
2 changed files with 28 additions and 14 deletions

View File

@ -114,10 +114,9 @@ int main(void)
BSP_LCD_Init(); BSP_LCD_Init();
BSP_LCD_Clear(LCD_COLOR_BLUE); BSP_LCD_Clear(LCD_COLOR_BLUE);
BSP_LCD_DisplayOn();
LCD_BL_ON(); //APP_LOG(TS_OFF, VLEVEL_L, "BSP LCD TEST....\r\n");
APP_LOG(TS_OFF, VLEVEL_L, "BSP LCD TEST....\r\n"); //BSP_LCD_Test();
BSP_LCD_Test();
// BSP_LCD_DisplayOff(); // BSP_LCD_DisplayOff();
@ -131,7 +130,7 @@ int main(void)
/* USER CODE END WHILE */ /* USER CODE END WHILE */
/* USER CODE BEGIN 3 */ /* USER CODE BEGIN 3 */
//BSP_LCD_DisplayOff();
mlx90640_display_process(); mlx90640_display_process();
} }
//HAL_TIM_PWM_Start(&htim3,TIM_CHANNEL_1); //HAL_TIM_PWM_Start(&htim3,TIM_CHANNEL_1);

View File

@ -181,7 +181,7 @@ static void drawMeasurement(void ) {
memset(tempBuffer,0,sizeof(tempBuffer)); memset(tempBuffer,0,sizeof(tempBuffer));
sprintf(tempBuffer,(char *)"%2d", (uint8_t)max(v_water_cnt, h_water_cnt)); 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); 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 uint8_t h_cnt[32]={0},v_cnt[24]={0}; //for horizon and vertical _water spill count
// start from 2, ignore edge of FOV // 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); 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) { if (zoneMask[y*32+x] > 3) {
@ -207,16 +207,32 @@ static void drawPicture(void)
// simple count of water spill point cloud // simple count of water spill point cloud
v_water_cnt=0; v_water_cnt=0;
h_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])) { 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])) { 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. // Read pixel data from MLX90640.
@ -257,7 +273,6 @@ void blackOutFilter(void)
if ((temp1 + (float)(waterTempThreshold/10.0)) < averageTemp ) if ((temp1 + (float)(waterTempThreshold/10.0)) < averageTemp )
{ {
zoneMask[y*32+x] ++; 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 ++; waterSpillCount ++;
} }
} }
@ -300,7 +315,7 @@ void mlx90640_display_process(void)
// BSP_LCD_DisplayOff(); // 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){ void mlx90640_display_init(void){