revised for correct upload message of Self-testing of Thermal Graph
centerTemp, averageTemp, minTemp, maxTemp
This commit is contained in:
parent
369eff1fde
commit
7783576405
|
@ -47,7 +47,7 @@ extern "C" {
|
|||
/**
|
||||
* @brief Verbose level for all trace logs
|
||||
*/
|
||||
#define VERBOSE_LEVEL VLEVEL_L
|
||||
#define VERBOSE_LEVEL VLEVEL_H
|
||||
|
||||
/**
|
||||
* @brief Enable trace logs
|
||||
|
|
|
@ -667,6 +667,8 @@ void STS_PRESENCE_SENSOR_Function_Test_Process(uint8_t *self_test_result, uint8_
|
|||
void STS_PRESENCE_SENSOR_Distance_Measure_Process(void);
|
||||
|
||||
|
||||
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
/*
|
||||
In this example TIM2 input clock (TIM2CLK) is set to APB1 clock (PCLK1),
|
||||
|
|
|
@ -129,7 +129,6 @@ int main(void)
|
|||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE END WHILE */
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "yunhorn_sts_prd_conf.h"
|
||||
#include "sts_cmox_hmac_sha.h"
|
||||
#include "X-WL55_WLE5_53L0X.h"
|
||||
#include "mlx90640_lcd_display.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* External variables ---------------------------------------------------------*/
|
||||
|
@ -1527,7 +1528,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
|
||||
} else if ((char)tlv_buf[CFG_CMD3] == 'S') { // Self Function Testing "YZS"
|
||||
i=0;
|
||||
memset(outbuf,sizeof(outbuf),0x30);
|
||||
memset(outbuf,0x30,sizeof(outbuf));
|
||||
|
||||
STS_SENSOR_Function_Test_Process();
|
||||
|
||||
|
@ -1556,7 +1557,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
STS_SENSOR_Distance_Test_Process();
|
||||
|
||||
i=0;
|
||||
memset(outbuf,sizeof(outbuf),0x30);
|
||||
memset(outbuf,0x30, sizeof(outbuf));
|
||||
outbuf[i++] = (uint8_t)'D';
|
||||
outbuf[i++] = (uint8_t)sts_mtmcode1;
|
||||
outbuf[i++] = (uint8_t)sts_mtmcode2;
|
||||
|
@ -1629,7 +1630,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
uint8_t cfg_in_nvm[YUNHORN_STS_MAX_NVM_CFG_SIZE]="";
|
||||
OnRestoreSTSCFGContextRequest((uint8_t *)cfg_in_nvm);
|
||||
i=0;
|
||||
memset(outbuf,sizeof(outbuf),0x30);
|
||||
memset(outbuf,0x30, sizeof(outbuf));
|
||||
|
||||
outbuf[i++] = (uint8_t) 'C';
|
||||
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_MTM1]; //MTM Code
|
||||
|
@ -2184,9 +2185,9 @@ void STS_SENSOR_Distance_Test_Process(void)
|
|||
|
||||
void STS_SENSOR_Function_Test_Process(void)
|
||||
{
|
||||
char tstbuf[128] =""; uint8_t i=0;
|
||||
uint8_t tstbuf[128] ={0x0}; uint8_t i=0;
|
||||
uint8_t count = 0;
|
||||
uint8_t mems_Dev_ID[2] = {0x0,0x0};
|
||||
uint8_t mems_Dev_ID[2] = {0x0};
|
||||
|
||||
tstbuf[i++] = (uint8_t) 'S';
|
||||
tstbuf[i++] = (uint8_t) sts_mtmcode1;
|
||||
|
@ -2194,9 +2195,16 @@ void STS_SENSOR_Function_Test_Process(void)
|
|||
tstbuf[i++] = (uint8_t) sts_version;
|
||||
tstbuf[i++] = (uint8_t) sts_hardware_ver;
|
||||
tstbuf[i++] = (uint8_t) (99*GetBatteryLevel()/254)&0xff;
|
||||
#ifdef STS_TMG
|
||||
count = mlx90640_bringup_test();
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "Thermal Graph Sensor count =%d \r\n", count);
|
||||
|
||||
#endif
|
||||
#if (defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R1_ENABLED))
|
||||
count = STS_SENSOR_MEMS_Get_ID(mems_Dev_ID);
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "count =%d \r\n", count);
|
||||
#endif
|
||||
|
||||
// if ((mems_Dev_ID[0]==0X0) && (mems_Dev_ID[1]==0x0))
|
||||
if (count ==0)
|
||||
|
@ -2205,7 +2213,7 @@ void STS_SENSOR_Function_Test_Process(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
tstbuf[i++] = (uint8_t) (6+1)&0xff; //length of following data
|
||||
//tstbuf[i++] = (uint8_t) (6+1)&0xff; //length of following data
|
||||
#ifdef YUNHORN_STS_O6_ENABLED
|
||||
tstbuf[i++] = (uint8_t)20; //length of following data
|
||||
uint8_t self_test_result[10]={0,0,0,0,0, 0,0,0,0,0};
|
||||
|
@ -2224,7 +2232,7 @@ void STS_SENSOR_Function_Test_Process(void)
|
|||
#endif
|
||||
|
||||
#if (defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R1_ENABLED))
|
||||
tstbuf[i++] = (uint8_t) (count)&0xff;
|
||||
tstbuf[i++] = (uint8_t) (6)&0xff;
|
||||
//MX_TOF_Process();
|
||||
STS_TOF_VL53L0X_Range_Process();
|
||||
tstbuf[i++] = (uint8_t) ((sts_tof_distance_data[0] >>8 ) &0xff);
|
||||
|
@ -2234,12 +2242,46 @@ void STS_SENSOR_Function_Test_Process(void)
|
|||
tstbuf[i++] = (uint8_t) ((sts_tof_distance_data[2] >>8 ) &0xff);
|
||||
tstbuf[i++] = (uint8_t) (sts_tof_distance_data[2] &0xff);
|
||||
#endif
|
||||
|
||||
#if (defined(YUNHORN_STS_M1A_ENABLED))
|
||||
tstbuf[i++] = (uint8_t) (8)&0xff; //length of following data
|
||||
|
||||
float self_test_result[4]={0x0};
|
||||
|
||||
STS_SENSOR_Thermal_Graph_Test_Process(self_test_result, count);
|
||||
#if 0
|
||||
memset(outbuf,0,sizeof(outbuf));
|
||||
sprintf(outbuf,(char *)" ============ Calibrated Temp Average=%2.2fC Center=%2.2fC Min=%2.2fC Max=%2.2fC \r\n",
|
||||
(float)self_test_result[0], (float)self_test_result[1], (float)self_test_result[2], (float)self_test_result[3]);
|
||||
APP_LOG(TS_OFF, VLEVEL_L,(char *)outbuf);
|
||||
#endif
|
||||
|
||||
tstbuf[i++] = ((int)self_test_result[0])&0xff; //AverageTemp
|
||||
tstbuf[i++] = ((int)((self_test_result[0])*100)%100)&0xff;
|
||||
|
||||
tstbuf[i++] = ((int)self_test_result[1])&0xff; //centerTemp
|
||||
tstbuf[i++] = ((int)((self_test_result[1])*100)%100)&0xff;
|
||||
|
||||
tstbuf[i++] = ((int)self_test_result[2])&0xff; //minTemp
|
||||
tstbuf[i++] = ((int)((self_test_result[2])*100)%100)&0xff;
|
||||
|
||||
tstbuf[i++] = ((int)self_test_result[3])&0xff; //maxTemp
|
||||
tstbuf[i++] = ((int)((self_test_result[3])*100)%100)&0xff;
|
||||
#if 0
|
||||
for (uint8_t jj=0;jj<8;jj++) {
|
||||
APP_LOG(TS_OFF,VLEVEL_L, "tstbuf[%02d] = %02d \r\n", jj, tstbuf[7+jj]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
memset((void*)outbuf,sizeof(outbuf),0x30);
|
||||
|
||||
memset((void*)outbuf, 0x0, sizeof(outbuf));
|
||||
memcpy((void*)outbuf, tstbuf, i);
|
||||
|
||||
//APP_LOG(TS_OFF, VLEVEL_L, "Ready to upload\r\n");
|
||||
|
||||
|
||||
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, outbuf);
|
||||
//STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, outbuf);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1256335571977009047" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1435577628396038727" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1256335571977009047" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1435577628396038727" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
|
@ -40,6 +40,9 @@ extern "C" {
|
|||
#include "X-WL55_WLE5_53L0X.h"
|
||||
#endif
|
||||
|
||||
#ifdef STS_TMG
|
||||
#include "mlx90640_lcd_display.h"
|
||||
#endif
|
||||
|
||||
#include "stm32wlxx_nucleo.h"
|
||||
|
||||
|
@ -166,7 +169,9 @@ uint8_t STS_SENSOR_MEMS_Get_ID(uint8_t *mems_Dev_ID)
|
|||
#ifdef STS_USE_TOF_VL53L0X
|
||||
cnt = sts_tof_vl53l0x_DetectSensors();
|
||||
#endif
|
||||
if (cnt > 0){
|
||||
|
||||
if (cnt > 0)
|
||||
{
|
||||
mems_Dev_ID[0] = (Id >>8)&0xff;
|
||||
mems_Dev_ID[1] = (Id & 0xff);
|
||||
}
|
||||
|
|
|
@ -428,6 +428,15 @@ void mlx90640_display_process(void)
|
|||
APP_LOG(TS_OFF, VLEVEL_L, "Water Spill Detected Level = %d of 768 \r\n", waterSpillCount);
|
||||
}
|
||||
|
||||
uint8_t mlx90640_bringup_test(void)
|
||||
{
|
||||
|
||||
status = MLX90640_DumpEE(MLX90640_ADDR, eeMLX90640);
|
||||
|
||||
return (status==0?1:0);
|
||||
|
||||
}
|
||||
|
||||
void mlx90640_display_init(void){
|
||||
MLX90640_SetRefreshRate(MLX90640_ADDR, RefreshRate);
|
||||
MLX90640_SetChessMode(MLX90640_ADDR);
|
||||
|
@ -438,6 +447,26 @@ void mlx90640_display_init(void){
|
|||
if (status != 0) APP_LOG(TS_OFF, VLEVEL_L, "\r\nParameter extraction failed with error code:%d\r\n",status);
|
||||
}
|
||||
|
||||
void STS_SENSOR_Thermal_Graph_Test_Process(float *self_test_result, uint8_t count)
|
||||
{
|
||||
|
||||
mlx90640_display_init();
|
||||
readTempValues();
|
||||
setTempScale();
|
||||
|
||||
self_test_result[0] = averageTemp;
|
||||
self_test_result[1] = centerTemp;
|
||||
self_test_result[2] = minTemp;
|
||||
self_test_result[3] = maxTemp;
|
||||
#if 0
|
||||
memset(tempBuffer,0,sizeof(tempBuffer));
|
||||
sprintf(tempBuffer,(char *)"Upload ============ Calibrated Temp Average=%2.2fC Center=%2.2fC Min=%2.2fC Max=%2.2fC \r\n",
|
||||
(float)self_test_result[0], (float)self_test_result[1], (float)self_test_result[2], (float)self_test_result[3]);
|
||||
APP_LOG(TS_OFF, VLEVEL_L,(char *)tempBuffer);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void bubbleSort(uint8_t arr[], uint8_t len, uint8_t order[])
|
||||
{
|
||||
|
|
|
@ -41,9 +41,12 @@ SOFTWARE.
|
|||
|
||||
#define abs(x) ((x)>0?(x):(-x))
|
||||
|
||||
//void mlx90640_display_init(void);
|
||||
void mlx90640_display_init(void);
|
||||
void mlx90640_display_process(void);
|
||||
uint8_t mlx90640_bringup_test(void);
|
||||
|
||||
void STS_SENSOR_Thermal_Graph_Test_Process(float *self_test_result, uint8_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue