diff --git a/Core/Src/main.c b/Core/Src/main.c
index 6f48d51..163a195 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -34,7 +34,7 @@
#include "bmp.h"
#include "st7789.h"
#endif
-#include "bmp.h"
+//#include "bmp.h"
#include "MLX90640_API.h"
#include "MLX90640_I2C_Driver.h"
#include "stm32_hx8347d_lcd.h"
diff --git a/STM32CubeIDE/.project b/STM32CubeIDE/.project
index 03a4c94..446c3f8 100644
--- a/STM32CubeIDE/.project
+++ b/STM32CubeIDE/.project
@@ -497,11 +497,6 @@
1
copy_PARENT/Core/Src/usart_if.c
-
- Application/User/mlx90640/bmp.c
- 1
- copy_PARENT/ST7789/bmp.c
-
Application/User/mlx90640/fonts.c
1
diff --git a/STM32CubeIDE/Release/objects.list b/STM32CubeIDE/Release/objects.list
index 26fc520..780870d 100644
--- a/STM32CubeIDE/Release/objects.list
+++ b/STM32CubeIDE/Release/objects.list
@@ -27,7 +27,6 @@
"./Application/User/Startup/startup_stm32wl55jcix.o"
"./Application/User/mlx90640/MLX90640_API.o"
"./Application/User/mlx90640/MLX90640_I2C_Driver.o"
-"./Application/User/mlx90640/bmp.o"
"./Application/User/mlx90640/fonts.o"
"./Application/User/mlx90640/hx8347d.o"
"./Application/User/mlx90640/mlx90640_lcd_display.o"
diff --git a/mlx90640/mlx90640_lcd_display.c b/mlx90640/mlx90640_lcd_display.c
index 67aa101..4b5be32 100644
--- a/mlx90640/mlx90640_lcd_display.c
+++ b/mlx90640/mlx90640_lcd_display.c
@@ -4,7 +4,7 @@
#include "MLX90640_API.h"
#include "MLX90640_I2C_Driver.h"
#include "sys_app.h"
-#include "bmp.h"
+//#include "bmp.h"
#define FPS2HZ 0x02
#define FPS4HZ 0x03
#define FPS8HZ 0x04
@@ -23,8 +23,8 @@ volatile uint8_t draw_legend_once=0, normalPeopleTemp=30, blackOutTag=0, waterTe
// start with some initial colors
float minTemp = 1.0f;
float maxTemp = 60.0f;
-float centerTemp;
-float averageTemp;
+float centerTemp=0.0f;
+float averageTemp=0.0f;
char tempBuffer[128];
// variables for interpolated colors
@@ -47,7 +47,8 @@ static void drawMeasurement(void);
static void drawPicture(void);
static void readTempValues(void);
extern LCD_DrawPropTypeDef DrawProp;
-static uint16_t TempToColor(float val){
+static uint16_t TempToColor(float val)
+{
/*
pass in value and figure out R G B
several published ways to do this I basically graphed R G B and developed simple linear equations
@@ -83,18 +84,23 @@ static uint16_t TempToColor(float val){
blue = constrain(240.0f / (maxTemp - d) * val - (d * 240.0f) / (maxTemp - d), 0, 240);
}
- // use the displays color mapping function to get 5-6-5 color palet (R=5 bits, G=6 bits, B-5 bits)
+ // use the displays color mapping function to get 5-6-5 color palette (R=5 bits, G=6 bits, B-5 bits)
return BSP_LCD_GetColor565(red, green, blue);
}
static void setTempScale(void) {
minTemp = 255;
maxTemp = 0;
+ averageTemp =0.0;
- for (i = 0; i < 768; i++) {
+ for (i = 0; i < 768; i++)
+ {
+ averageTemp += tempValues[i];
minTemp = min(minTemp, tempValues[i]);
maxTemp = max(maxTemp, tempValues[i]);
}
+ averageTemp /= 768;
+
if (maxTemp > normalPeopleTemp)
{
blackOutTag = 1;
@@ -143,7 +149,7 @@ static void drawLegend(void)
BSP_LCD_DisplayStringAt(20,ST7789V_LCD_PIXEL_HEIGHT,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_DARKBLUE);
memset(tempBuffer,0,sizeof(tempBuffer));
- sprintf(tempBuffer,(char *)"F10.Male#1.WashBasin",centerTemp);
+ sprintf(tempBuffer,(char *)"F10.Male#1.WashBasin");
BSP_LCD_DisplayStringAt(8, 15,(uint8_t *)tempBuffer,LEFT_MODE,LCD_COLOR_WHITE);
}
#if 0
@@ -168,10 +174,6 @@ static void drawMeasurement(void ) {
// Measure and print center temperature
centerTemp = (tempValues[383 - 16] + tempValues[383 - 15] + tempValues[384 + 15] + tempValues[384 + 16]) / 4;
- averageTemp = 0.0;
- for (i=0; i<32*24; i++)
- averageTemp += tempValues[i];
- averageTemp /= 768;
#if 0
BSP_LCD_DrawHLine(0,246,ST7789V_LCD_PIXEL_WIDTH, LCD_COLOR_LIGHTBLUE);
@@ -259,11 +261,7 @@ static void readTempValues(void)
}
void blackOutFilter(void)
{
- float averageTemp = 0.0, temp1=0.0;
- for (i=0; i<32*24; i++) {
- averageTemp += tempValues[i];
- }
- averageTemp /= 768;
+ float temp1=0.0;
if (maxTemp < normalPeopleTemp)
{
@@ -291,7 +289,7 @@ void blackOutFilter(void)
if (detectCycle ++ > 20)
{
detectCycle = 0;
- memset(zoneMask,0,sizeof(zoneMask));
+ memset((void *)zoneMask,0,sizeof(zoneMask));
}
}
diff --git a/mlx90640/st7789.c b/mlx90640/st7789.c
index 2c3b667..b9a900a 100644
--- a/mlx90640/st7789.c
+++ b/mlx90640/st7789.c
@@ -212,7 +212,7 @@ void st7789v_Init(void)
*/
void st7789v_DisplayOn(void)
{
- uint8_t data = 0;
+ //uint8_t data = 0;
LCD_IO_WriteReg(0x13);/* Partial off (Normal): NORON */
LCD_Delay(10);
LCD_IO_WriteReg(0x29);/* Display on: DISPON */