This commit is contained in:
Yunhorn 2025-01-07 19:44:19 +08:00
parent c8459207ad
commit 9409d1b51e
4 changed files with 27 additions and 24 deletions

View File

@ -47,12 +47,12 @@ extern "C" {
/**
* @brief Verbose level for all trace logs
*/
#define VERBOSE_LEVEL VLEVEL_OFF
#define VERBOSE_LEVEL VLEVEL_L
/**
* @brief Enable trace logs
*/
#define APP_LOG_ENABLED 0
#define APP_LOG_ENABLED 1
/**
* @brief Activate monitoring (probes) of some internal RF signals for debug purpose
@ -75,7 +75,7 @@ extern "C" {
* @brief Enable/Disable MCU Debugger pins (dbg serial wires)
* @note by HW serial wires are ON by default, need to put them OFF to save power
*/
#define DEBUGGER_ENABLED 0
#define DEBUGGER_ENABLED 1
/**
* @brief Disable Low Power mode

View File

@ -42,7 +42,7 @@ volatile uint32_t sts_low_threshold=1500, sts_high_threshold=2800, sts_occupancy
extern volatile uint8_t sts_head_level_low;
volatile sts_fhmos_sensor_config_t fhmos_cfg={70,4,4,8,20,80,20,25};
volatile sts_fhmos_sensor_cmd_t fhmos_cmd={0x0};
volatile sts_fhmos_sensor_ambient_height_t fhmos_bg={0x0}, fhmos_gesture={0x0}, fhmos_net={0x0};
volatile sts_fhmos_sensor_ambient_height_t fhmos_bg, fhmos_gesture, fhmos_net;
volatile sts_fhmos_sensor_data_t fhmos_data={0};
extern volatile uint8_t sts_fhmos_result;
volatile uint8_t sts_mask_bitmap[8]={0x0}, fhmos_gesture_bitmap[8]={0x0};
@ -193,6 +193,8 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
for (i=0;i<8;i++)
sts_mask_bitmap[i] =0x0;
uint8_t rio_edge[34]={0,1,2,3,4,5,6,7,8,15,16,23,24,31,32,39,40,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
// printf("sts sensor install height = %4d \r\n", (int)sts_sensor_install_height);
@ -223,12 +225,12 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
APP_LOG(TS_OFF, VLEVEL_L, "\r\n ----------------------"
"\r\n------Threshold %d cm--\r\n", fhmos_cfg.th_gesture_mask_off_height_cm);
"\r\n------Gesture Mask off above Threshold %d cm--\r\n", fhmos_cfg.th_gesture_mask_off_height_cm);
for (uint8_t i = 0; i < 64; i++)
{
/* Print distance and status */
if (i%8==0) APP_LOG(TS_OFF, VLEVEL_L, "\r\nPosition from Floor [cm]| ");
if (i%8==0) APP_LOG(TS_OFF, VLEVEL_L, "\r\n[cm]|");
if ((Result.ZoneResult[i].NumberOfTargets > 0))
{
range_distance = (uint32_t)Result.ZoneResult[i].Distance[0];
@ -242,8 +244,9 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
{
fhmos_bg.maskoff[i] = 1;
}
//sts_mask_bitmap[(uint8_t)(i/8)] |= (fhmos_bg.maskoff[i])<<(7-i%8);
sts_mask_bitmap[(uint8_t)(i/8)] |= (fhmos_bg.maskoff[i])<<(7-i%8); // 2025-JAN-03 update
// sts_mask_bitmap[(uint8_t)(i/8)] |= (fhmos_bg.maskoff[i])<<(7-i%8); // 2025-JAN-03 update
// if (i%8==0) APP_LOG(TS_OFF, VLEVEL_M, "\r\n");
APP_LOG(TS_OFF, VLEVEL_L, "|%3d ", fhmos_bg.h2cm[i]*2);
@ -257,28 +260,28 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
APP_LOG(TS_OFF, VLEVEL_L, "\r\n Thresholds: Headlevel=%4d cm, Gesture Mask off=%d cm, Min body height=%d cm\r\n",
(uint8_t)fhmos_cfg.th_head_level_height_cm, (uint8_t)fhmos_cfg.th_gesture_mask_off_height_cm, (uint8_t)(fhmos_cfg.th_fall_body_min_height_cm));
APP_LOG(TS_OFF, VLEVEL_L, "\r\n\n ------- Mask off matrix \r\n");
/*
for (i=0; i<64; i++)
{
APP_LOG(TS_OFF, VLEVEL_L, "\r\n\n ------- Mask off matrix before remove edge \r\n");
for (i=0; i<64; i++)
{
sts_mask_bitmap[(uint8_t)(i/8)] |= (fhmos_bg.maskoff[i])<<(7-i%8); // 2025-JAN-03 update
if (i%8==0) APP_LOG(TS_OFF, VLEVEL_L, "\r\n");
APP_LOG(TS_OFF, VLEVEL_L, "|%d ", (uint8_t)fhmos_bg.maskoff[i]);
}
*/
APP_LOG(TS_OFF, VLEVEL_L, "\r\n\n ------- Remove Edge \r\n");
}
uint8_t rio_edge[34]={0,1,2,3,4,5,6,7,8,15,16,23,24,31,32,39,40,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
for (i=0; i<sizeof(rio_edge); i++)
for (i=0; i<34; i++)
{
fhmos_bg.maskoff[rio_edge[i]] = 1;
}
APP_LOG(TS_OFF, VLEVEL_L, "\r\n\n ------- After Remove Edge \r\n");
for (i=0; i<64; i++)
{
if (i%8==0) APP_LOG(TS_OFF, VLEVEL_L, "\r\n");
APP_LOG(TS_OFF, VLEVEL_L, "|%d ", (uint8_t)fhmos_bg.maskoff[i]);
}
for (i=0; i<64; i++)
{
sts_mask_bitmap[(uint8_t)(i/8)] |= (fhmos_bg.maskoff[i])<<(7-i%8); // 2025-JAN-03 update
if (i%8==0) APP_LOG(TS_OFF, VLEVEL_L, "\r\n");
APP_LOG(TS_OFF, VLEVEL_L, "|%d ",(uint8_t)fhmos_bg.maskoff[i]);
}
APP_LOG(TS_OFF, VLEVEL_L, "\r\n");
APP_LOG(TS_OFF, VLEVEL_M, "\r\nmask bitmap \r\n");
@ -642,7 +645,7 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
head_height_level_from_floor = MIN(1400, abs(sts_sensor_install_height - head_distance_from_ceiling));
APP_LOG(TS_OFF, VLEVEL_L, "\r\n Raw Head height=%d cm Calculated head level=%d cm\r\n", head_distance_from_ceiling, head_height_level_from_floor );
APP_LOG(TS_OFF, VLEVEL_L, "\r\n Raw Head height=%d cm Calculated head level=%d cm\r\n", head_distance_from_ceiling/10, head_height_level_from_floor/10);
/* state tree */