add bitmap report and parse feature

This commit is contained in:
Yunhorn 2024-11-20 12:50:07 +08:00
parent 231f0fc2b2
commit e8c28bd51d
3 changed files with 14 additions and 4 deletions

View File

@ -52,6 +52,7 @@ extern volatile uint8_t sts_tof_presence_state_changed;
#elif defined(L8)
#include "app_tof.h"
extern volatile sts_fhmos_sensor_config_t sts_fhmos_cfg;
extern volatile uint8_t sts_mask_bitmap[8];
#endif
volatile sts_cfg_nvm_t sts_cfg_nvm = {
sts_mtmcode1,
@ -1876,11 +1877,20 @@ void STS_SENSOR_Function_Test_Process(void)
{
STS_SENSOR_Distance_Test_Process();
APP_LOG(TS_OFF, VLEVEL_M, "\nSensor Install Height =%4d mm\n", sts_sensor_install_height);
tstbuf[i++] = (uint8_t) (4)&0xff; //length of following data
tstbuf[i++] = (uint8_t) (12)&0xff; //length of following data
tstbuf[i++] = (uint8_t) (sensor_id >>8)&0xFF;
tstbuf[i++] = (uint8_t) (sensor_id) & 0xFF;
tstbuf[i++] = (uint8_t) (sts_sensor_install_height>>8)&0xff; // MSB of sensor height
tstbuf[i++] = (uint8_t) (sts_sensor_install_height)&0xff; // LSB of sensor height
// MASK OFF BITMAP
tstbuf[i++] = (uint8_t) (sts_mask_bitmap[0]);
tstbuf[i++] = (uint8_t) (sts_mask_bitmap[1]);
tstbuf[i++] = (uint8_t) (sts_mask_bitmap[2]);
tstbuf[i++] = (uint8_t) (sts_mask_bitmap[3]);
tstbuf[i++] = (uint8_t) (sts_mask_bitmap[4]);
tstbuf[i++] = (uint8_t) (sts_mask_bitmap[5]);
tstbuf[i++] = (uint8_t) (sts_mask_bitmap[6]);
tstbuf[i++] = (uint8_t) (sts_mask_bitmap[7]);
}
/* */
/* for STS_P2, set ppc_config -> door_jam_profile and distance threshold accordingly */

View File

@ -41,7 +41,7 @@ volatile uint32_t sts_low_threshold, sts_high_threshold;
volatile sts_fhmos_sensor_data_t sts_fhmos_data;
volatile sts_fhmos_sensor_config_t sts_fhmos_cfg;
volatile sts_fhmos_sensor_ambient_height_t sts_fhmos_bg={0x0};
volatile uint8_t mask_bitmap[8]={0x0};
volatile uint8_t sts_mask_bitmap[8]={0x0};
extern volatile uint16_t sts_sensor_install_height; //in mm
#endif
#include "stm32wlxx_nucleo.h"
@ -195,7 +195,7 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
sts_fhmos_bg.maskoff[i] = 0;
} else {
sts_fhmos_bg.maskoff[i] = 1;
mask_bitmap[i/8] |= 1<<(7-i%8);
sts_mask_bitmap[i/8] |= 1<<(7-i%8);
}
if (i%8==0) printf("\r\n");
@ -216,7 +216,7 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
printf("|%d ", (uint8_t)sts_fhmos_bg.maskoff[i]);
}
for (i=0; i<8; i++)
printf("%02X\r\n",mask_bitmap[i]);
printf("%02X\r\n",sts_mask_bitmap[i]);
}