add maxTemp blackOutFilter to avoid people in/out impact to average
temperature.
This commit is contained in:
parent
7d8b64a31a
commit
e72f20c5e3
|
@ -62,7 +62,7 @@ SOFTWARE.
|
||||||
* @brief HX8347D Size
|
* @brief HX8347D Size
|
||||||
*/
|
*/
|
||||||
#define HX8347D_LCD_PIXEL_WIDTH ((uint16_t)240)
|
#define HX8347D_LCD_PIXEL_WIDTH ((uint16_t)240)
|
||||||
#define HX8347D_LCD_PIXEL_HEIGHT ((uint16_t)320)
|
#define HX8347D_LCD_PIXEL_HEIGHT ((uint16_t)280)
|
||||||
#define TFT_MAX_PIXELS_AT_ONCE 32
|
#define TFT_MAX_PIXELS_AT_ONCE 32
|
||||||
/**
|
/**
|
||||||
* @brief HX8347D Registers
|
* @brief HX8347D Registers
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
paramsMLX90640 mlx90640;
|
paramsMLX90640 mlx90640;
|
||||||
static uint16_t eeMLX90640[832];
|
static uint16_t eeMLX90640[832];
|
||||||
int status;
|
int status;
|
||||||
|
volatile uint8_t draw_legend_once=0, normalPeopleTemp=30, blackOutTag=0;
|
||||||
// start with some initial colors
|
// start with some initial colors
|
||||||
float minTemp = 1.0f;
|
float minTemp = 1.0f;
|
||||||
float maxTemp = 60.0f;
|
float maxTemp = 60.0f;
|
||||||
float centerTemp;
|
float centerTemp;
|
||||||
float averageTemp;
|
float averageTemp;
|
||||||
|
|
||||||
char tempBuffer[6];
|
char tempBuffer[128];
|
||||||
// variables for interpolated colors
|
// variables for interpolated colors
|
||||||
uint8_t red, green, blue;
|
uint8_t red, green, blue;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ int x, y, i, j;
|
||||||
static float tempValues[32*24];
|
static float tempValues[32*24];
|
||||||
static uint8_t zoneMask[32*24]={0x0};
|
static uint8_t zoneMask[32*24]={0x0};
|
||||||
|
|
||||||
|
static uint8_t blackOutFilter(void);
|
||||||
static uint16_t TempToColor(float val);
|
static uint16_t TempToColor(float val);
|
||||||
static void setTempScale(void);
|
static void setTempScale(void);
|
||||||
static void setAbcd(void);
|
static void setAbcd(void);
|
||||||
|
@ -95,7 +95,12 @@ static void setTempScale(void) {
|
||||||
minTemp = min(minTemp, tempValues[i]);
|
minTemp = min(minTemp, tempValues[i]);
|
||||||
maxTemp = max(maxTemp, tempValues[i]);
|
maxTemp = max(maxTemp, tempValues[i]);
|
||||||
}
|
}
|
||||||
|
if (maxTemp > normalPeopleTemp)
|
||||||
|
{
|
||||||
|
blackOutTag = 1;
|
||||||
|
} else {
|
||||||
|
blackOutTag = 0;
|
||||||
|
}
|
||||||
setAbcd();
|
setAbcd();
|
||||||
drawLegend();
|
drawLegend();
|
||||||
|
|
||||||
|
@ -112,15 +117,34 @@ static void setAbcd(void) {
|
||||||
|
|
||||||
|
|
||||||
// Draw a legend.
|
// Draw a legend.
|
||||||
static void drawLegend(void) {
|
static void drawLegend(void)
|
||||||
|
{
|
||||||
|
if (draw_legend_once ==0)
|
||||||
|
{
|
||||||
#if 0
|
#if 0
|
||||||
//float inc = (maxTemp - minTemp) / 224.0f;
|
float inc = (maxTemp - minTemp) / 224.0f;
|
||||||
float inc = (maxTemp - minTemp) / 224.0f;
|
j = 0;
|
||||||
j = 0;
|
for (ii = minTemp; ii < maxTemp; ii += inc) {
|
||||||
for (ii = minTemp; ii < maxTemp; ii += inc) {
|
BSP_LCD_DrawVLine(8+ + j++, 260, 20, TempToColor(ii));
|
||||||
BSP_LCD_DrawVLine(8+ + j++, 260, 20, TempToColor(ii));
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
BSP_LCD_FillRect(0,240,240, 300, LCD_COLOR_BLACK);
|
||||||
|
draw_legend_once =1;
|
||||||
|
|
||||||
|
BSP_LCD_DrawHLine(0,246,ST7789V_LCD_PIXEL_WIDTH, LCD_COLOR_LIGHTBLUE);
|
||||||
|
BSP_LCD_DrawHLine(0,245,ST7789V_LCD_PIXEL_WIDTH, LCD_COLOR_LIGHTBLUE);
|
||||||
|
|
||||||
|
BSP_LCD_SetFont(&Font16);
|
||||||
|
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||||
|
DrawProp.BackColor = LCD_COLOR_BLACK;
|
||||||
|
sprintf(tempBuffer,(char *)"Yunhorn Technology");
|
||||||
|
BSP_LCD_DisplayStringAt(20,ST7789V_LCD_PIXEL_HEIGHT,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_BLUE);
|
||||||
|
|
||||||
|
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||||
|
sprintf(tempBuffer,(char *)"F10.Male#1.WashBasin",centerTemp);
|
||||||
|
BSP_LCD_DisplayStringAt(8, ST7789V_LCD_PIXEL_HEIGHT-16,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_WHITE);
|
||||||
|
}
|
||||||
|
#if 1
|
||||||
BSP_LCD_SetFont(&Font16);
|
BSP_LCD_SetFont(&Font16);
|
||||||
DrawProp.BackColor = LCD_COLOR_BLACK;
|
DrawProp.BackColor = LCD_COLOR_BLACK;
|
||||||
memset(tempBuffer,0,sizeof(tempBuffer));
|
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||||
|
@ -130,6 +154,7 @@ static void drawLegend(void) {
|
||||||
memset(tempBuffer,0,sizeof(tempBuffer));
|
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||||
sprintf(tempBuffer,(char *)"%2.1f",maxTemp);
|
sprintf(tempBuffer,(char *)"%2.1f",maxTemp);
|
||||||
BSP_LCD_DisplayStringAt(190,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_RED);
|
BSP_LCD_DisplayStringAt(190,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_RED);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,12 +171,22 @@ static void drawMeasurement(void ) {
|
||||||
averageTemp += tempValues[i];
|
averageTemp += tempValues[i];
|
||||||
averageTemp /= 768;
|
averageTemp /= 768;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
BSP_LCD_DrawHLine(0,246,ST7789V_LCD_PIXEL_WIDTH, LCD_COLOR_LIGHTBLUE);
|
||||||
|
BSP_LCD_DrawHLine(0,245,ST7789V_LCD_PIXEL_WIDTH, LCD_COLOR_LIGHTBLUE);
|
||||||
|
|
||||||
BSP_LCD_SetFont(&Font16);
|
BSP_LCD_SetFont(&Font16);
|
||||||
memset(tempBuffer,0,sizeof(tempBuffer));
|
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||||
DrawProp.BackColor = LCD_COLOR_BLACK;
|
DrawProp.BackColor = LCD_COLOR_BLACK;
|
||||||
sprintf(tempBuffer,(char *)"Yunhorn Technology");
|
sprintf(tempBuffer,(char *)"Yunhorn Technology");
|
||||||
BSP_LCD_DisplayStringAt(18,240,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_BLUE);
|
BSP_LCD_DisplayStringAt(20,ST7789V_LCD_PIXEL_HEIGHT,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_BLUE);
|
||||||
|
|
||||||
|
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||||
|
sprintf(tempBuffer,(char *)"F10.Male#1.WashBasin",centerTemp);
|
||||||
|
BSP_LCD_DisplayStringAt(8, ST7789V_LCD_PIXEL_HEIGHT-16,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_WHITE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
memset(tempBuffer,0,sizeof(tempBuffer));
|
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||||
sprintf(tempBuffer,(char *)"%2.2f ",centerTemp);
|
sprintf(tempBuffer,(char *)"%2.2f ",centerTemp);
|
||||||
BSP_LCD_DisplayStringAt(60,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_RED);
|
BSP_LCD_DisplayStringAt(60,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_RED);
|
||||||
|
@ -159,6 +194,7 @@ static void drawMeasurement(void ) {
|
||||||
memset(tempBuffer,0,sizeof(tempBuffer));
|
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||||
sprintf(tempBuffer,(char *)"%2.2f ",averageTemp);
|
sprintf(tempBuffer,(char *)"%2.2f ",averageTemp);
|
||||||
BSP_LCD_DisplayStringAt(120,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_BLUE);
|
BSP_LCD_DisplayStringAt(120,260,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_BLUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,19 +205,19 @@ averageTemp = 0.0;
|
||||||
for (i=0; i<32*24; i++)
|
for (i=0; i<32*24; i++)
|
||||||
averageTemp += tempValues[i];
|
averageTemp += tempValues[i];
|
||||||
averageTemp /= 768;
|
averageTemp /= 768;
|
||||||
BSP_LCD_FillRect(0,0,240, 240, LCD_COLOR_BLACK);
|
BSP_LCD_FillRect(0,0,ST7789V_LCD_PIXEL_WIDTH, ST7789V_LCD_PIXEL_HEIGHT-16, LCD_COLOR_BLACK);
|
||||||
for (y=2; y<23; y++)
|
for (y=1; y<23; y++)
|
||||||
{
|
{
|
||||||
for (x=2; x<31; x++)
|
for (x=1; x<31; x++)
|
||||||
{
|
{
|
||||||
temp1 = tempValues[(x) + (y*32)];
|
temp1 = tempValues[(x) + (y*32)];
|
||||||
if ((temp1+ 1.5) > averageTemp )
|
if ((temp1+ 1.0) > averageTemp )
|
||||||
{
|
{
|
||||||
//BSP_LCD_FillRect(x*8, y*11, 7, 10, LCD_COLOR_BLACK);
|
//BSP_LCD_FillRect(x*8, y*11, 7, 10, LCD_COLOR_BLACK);
|
||||||
temp1=0.0;
|
temp1=0.0;
|
||||||
} else {
|
} else {
|
||||||
BSP_LCD_FillRect(x*8, y*11, 7, 11, LCD_COLOR_YELLOW);
|
BSP_LCD_FillRect(x*8, y*11, 4, 4, LCD_COLOR_GREEN);
|
||||||
BSP_LCD_DrawCircle(x*8, y*11, 20, LCD_COLOR_RED);
|
//BSP_LCD_DrawCircle((x)*8, (y-2)*11, 10, LCD_COLOR_BLUE);
|
||||||
zoneMask[y*32+x]=0x57;
|
zoneMask[y*32+x]=0x57;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,14 +254,25 @@ static void readTempValues(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
static uint8_t blackOutFilter(void)
|
||||||
void mlx90640_display_process(void){
|
{
|
||||||
|
if (maxTemp < normalPeopleTemp) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void mlx90640_display_process(void)
|
||||||
|
{
|
||||||
|
|
||||||
readTempValues();
|
readTempValues();
|
||||||
setTempScale();
|
setTempScale();
|
||||||
|
|
||||||
drawPicture();
|
if (blackOutTag == 0)
|
||||||
drawMeasurement();
|
{
|
||||||
|
drawPicture();
|
||||||
|
drawMeasurement();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1339,18 +1339,19 @@ void LCD_Delay(uint32_t Delay)
|
||||||
*/
|
*/
|
||||||
void BSP_LCD_Test(void)
|
void BSP_LCD_Test(void)
|
||||||
{
|
{
|
||||||
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Clear with rainbow...........\r\n");
|
APP_LOG(TS_OFF,VLEVEL_L,"\r\n Clear with rainbow...........\r\n");
|
||||||
BSP_LCD_FillRect(0,0,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_RED);
|
BSP_LCD_FillRect(0,0,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_RED);
|
||||||
BSP_LCD_FillRect(0,1*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_GREEN);
|
BSP_LCD_FillRect(0,1*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_GREEN);
|
||||||
BSP_LCD_FillRect(0,2*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_BLUE);
|
BSP_LCD_FillRect(0,2*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_BLUE);
|
||||||
BSP_LCD_FillRect(0,3*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_WHITE);
|
BSP_LCD_FillRect(0,3*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_WHITE);
|
||||||
BSP_LCD_FillRect(0,4*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_YELLOW);
|
BSP_LCD_FillRect(0,4*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_YELLOW);
|
||||||
BSP_LCD_FillRect(0,5*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_MAGENTA);
|
BSP_LCD_FillRect(0,5*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_MAGENTA);
|
||||||
BSP_LCD_FillRect(0,6*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_BLACK);
|
BSP_LCD_FillRect(0,6*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_LIGHTBLUE);
|
||||||
BSP_LCD_FillRect(0,7*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_LIGHTBLUE);
|
BSP_LCD_FillRect(0,7*ST7789V_LCD_PIXEL_HEIGHT/7,ST7789V_LCD_PIXEL_WIDTH,ST7789V_LCD_PIXEL_HEIGHT/7,LCD_COLOR_BLACK);
|
||||||
|
|
||||||
BSP_LCD_DisplayStringAt(10, 3*ST7789V_LCD_PIXEL_HEIGHT/7, "Yunhorn Technology", LEFT_MODE, LCD_COLOR_BLUE);
|
|
||||||
BSP_LCD_DisplayStringAt(10, 20+3*ST7789V_LCD_PIXEL_HEIGHT/7, "SmarToilets", LEFT_MODE, LCD_COLOR_BLUE);
|
BSP_LCD_DisplayStringAt(30, 3*ST7789V_LCD_PIXEL_HEIGHT/7, "SmarToilets", LEFT_MODE, LCD_COLOR_BLUE);
|
||||||
|
BSP_LCD_DisplayStringAt(10, 20+3*ST7789V_LCD_PIXEL_HEIGHT/7,"Yunhorn Technology", LEFT_MODE, LCD_COLOR_BLUE);
|
||||||
HAL_Delay(2500);
|
HAL_Delay(2500);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
Loading…
Reference in New Issue