no back/forth detection

This commit is contained in:
Yunhorn 2024-12-31 01:32:06 +08:00
parent 12f191f34b
commit 182e3a8186
2 changed files with 5 additions and 3 deletions
STM32CubeIDE/Release
STS/TOF/App

View File

@ -825,7 +825,7 @@ int sts_tof_vl53lx_presence_detection_start(void)
// 7 VL53L1_RANGESTATUS_WRAP_TARGET_ FAIL Wrapped target, not matching phases // 7 VL53L1_RANGESTATUS_WRAP_TARGET_ FAIL Wrapped target, not matching phases
// 8 VL53L1_RANGESTATUS_PROCESSING_ FAIL Internal algorithm underflow or overflow // 8 VL53L1_RANGESTATUS_PROCESSING_ FAIL Internal algorithm underflow or overflow
// 14 VL53L1_RANGESTATUS_RANGE_INVALID The reported range is invalid // 14 VL53L1_RANGESTATUS_RANGE_INVALID The reported range is invalid
#if 0 #if 1
if ((RangeStatus == 0) || (RangeStatus == 4) || (RangeStatus == 7)) { if ((RangeStatus == 0) || (RangeStatus == 4) || (RangeStatus == 7)) {
if (Distance <= ppc_cfg[sts_door_jam_profile].min_distance) //MIN_DISTANCE) // wraparound case see the explanation at the constants definition place if (Distance <= ppc_cfg[sts_door_jam_profile].min_distance) //MIN_DISTANCE) // wraparound case see the explanation at the constants definition place
Distance = ppc_cfg[sts_door_jam_profile].max_distance + ppc_cfg[sts_door_jam_profile].min_distance; //MAX_DISTANCE + MIN_DISTANCE; Distance = ppc_cfg[sts_door_jam_profile].max_distance + ppc_cfg[sts_door_jam_profile].min_distance; //MAX_DISTANCE + MIN_DISTANCE;
@ -836,6 +836,7 @@ int sts_tof_vl53lx_presence_detection_start(void)
#endif #endif
//if (Distance < ppc_cfg[sts_door_jam_profile].dist_threshold) //if (Distance < ppc_cfg[sts_door_jam_profile].dist_threshold)
#if 1
if ((Distance < ppc_cfg[sts_door_jam_profile].dist_threshold) && ((Distance > ppc_cfg[sts_door_jam_profile].min_distance))) if ((Distance < ppc_cfg[sts_door_jam_profile].dist_threshold) && ((Distance > ppc_cfg[sts_door_jam_profile].min_distance)))
{ {
PresenceState = 1; PresenceState = 1;
@ -843,8 +844,9 @@ int sts_tof_vl53lx_presence_detection_start(void)
} else { } else {
PresenceState = 0; PresenceState = 0;
} }
//PresenceState = ProcessPresenceDetectionData(Distance, Zone, RangeStatus); #endif
//printf("\nPresenceState =%d \n\r", PresenceState); //uint8_t PresenceState2 = ProcessPresenceDetectionData(Distance, Zone, RangeStatus);
//printf("\nPresenceState2 =%d \n\r", PresenceState2);
if (PresenceState == PrevPresenceState) if (PresenceState == PrevPresenceState)
{ {
sts_tof_presence_state_changed = 0; sts_tof_presence_state_changed = 0;