long range config for WASTE-BIN and Max Distance to 2500mm
This commit is contained in:
parent
ed27f51410
commit
0b151464d6
|
@ -858,12 +858,12 @@ static void SendTxData(void)
|
|||
#elif defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R1_ENABLED)
|
||||
AppData.Buffer[i++] = (uint8_t)(0x02)&0xff; //#length of following bytes
|
||||
#ifdef TOF_1
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm >>8)&0xff; //#05
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm)&0xff; //#06
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm >>8)&0xff; //#05
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm)&0xff; //#06
|
||||
#endif
|
||||
#ifdef TOF_2
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm >>8)&0xff; //#07
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm)&0xff; //#08
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm >>8)&0xff; //#07
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm)&0xff; //#08
|
||||
#endif
|
||||
|
||||
#ifdef TOF_3
|
||||
|
|
|
@ -131,7 +131,7 @@ void STS_R0_SENSOR_Read(STS_R0_SensorDataTypeDef *r0_data)
|
|||
r0_data->distance_mm = sts_tof_distance_data[0];
|
||||
r0_data->distance1_mm = sts_tof_distance_data[1];
|
||||
r0_data->distance2_mm = sts_tof_distance_data[2];
|
||||
#if defined(ROCTEC_R5)||defined(TOF_2)
|
||||
#if defined(ROCTEC_R5)
|
||||
r0_data->distance1_mm = sts_tof_distance_data[0]+sts_tof_distance_data[1]+sts_tof_distance_data[2];
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
* @defgroup ErrCode Errors code shown on display
|
||||
* @{
|
||||
*/
|
||||
#define STS_MAX_L0_RANGE ((uint32_t) 2000)
|
||||
#define STS_MAX_L0_RANGE ((uint32_t) 2500)
|
||||
#define ERR_DETECT -1
|
||||
#define ERR_DEMO_RANGE_ONE 1
|
||||
#define ERR_DEMO_RANGE_MULTI 2
|
||||
|
@ -363,16 +363,16 @@ void STS_TOF250_Range_Process(void)
|
|||
void STS_TOF_VL53L0X_Range_Process(void)
|
||||
{
|
||||
int status=0, i;
|
||||
RangingConfig_e RangingConfig = HIGH_ACCURACY; //HIGH_ACCURACY; //LONG_RANGE;
|
||||
RangingConfig_e RangingConfig = LONG_RANGE; //HIGH_ACCURACY; //LONG_RANGE;
|
||||
XWL55_WLE5_53L0X_Init();
|
||||
if ((nDevMask ==0) || (nSensorPresent ==0))
|
||||
{
|
||||
nSensorPresent = sts_tof_vl53l0x_DetectSensors(); // confirm sensor online
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n %u pcs sensor(s) online \r\n", nSensorPresent);
|
||||
}
|
||||
sts_tof_distance_data[0] = STS_MAX_L0_RANGE;
|
||||
sts_tof_distance_data[1] = STS_MAX_L0_RANGE;
|
||||
sts_tof_distance_data[2] = STS_MAX_L0_RANGE;
|
||||
sts_tof_distance_data[0] = 0;
|
||||
sts_tof_distance_data[1] = 0;
|
||||
sts_tof_distance_data[2] = 0;
|
||||
|
||||
if (nSensorPresent > 0)
|
||||
{
|
||||
|
@ -384,28 +384,34 @@ void STS_TOF_VL53L0X_Range_Process(void)
|
|||
{
|
||||
if (VL53L0XDevs[i].Present ==1)
|
||||
{
|
||||
status = VL53L0X_PerformSingleRangingMeasurement(&VL53L0XDevs[i], &RangingMeasurementData);
|
||||
if( status ==0 )
|
||||
{
|
||||
sts_tof_vl53l0x_Sensor_SetNewRange(&VL53L0XDevs[i],&RangingMeasurementData);
|
||||
if( RangingMeasurementData.RangeStatus == 0 )
|
||||
uint8_t rep=0;
|
||||
do {
|
||||
rep++;
|
||||
status = VL53L0X_PerformSingleRangingMeasurement(&VL53L0XDevs[i], &RangingMeasurementData);
|
||||
if (status ==0)
|
||||
{
|
||||
sts_tof_distance_data[i] = (int)VL53L0XDevs[i].LeakyRange;
|
||||
if (sts_tof_distance_data[i] == 0) sts_tof_distance_data[i]+= STS_MAX_L0_RANGE;
|
||||
nDevMask |= (1 << i);
|
||||
sensor_data_ready |= 1;
|
||||
} else
|
||||
{
|
||||
//HandleError(ERR_DEMO_RANGE_ONE);
|
||||
APP_LOG(TS_OFF, VLEVEL_H,"\r\n#%u sensor ERR code = %04u\r\n",i, ERR_DEMO_RANGE_ONE);
|
||||
}
|
||||
// ########## two conditions
|
||||
// ########## 1) return status ==0,
|
||||
// ########## 2) and ranging status for valid ranging value !!!!!!!!!!!!!!!!!
|
||||
}
|
||||
sts_tof_vl53l0x_Sensor_SetNewRange(&VL53L0XDevs[i],&RangingMeasurementData);
|
||||
if( RangingMeasurementData.RangeStatus == 0 )
|
||||
{
|
||||
sts_tof_distance_data[i] = (int)VL53L0XDevs[i].LeakyRange;
|
||||
|
||||
nDevMask |= (1 << i);
|
||||
sensor_data_ready |= 1;
|
||||
} else
|
||||
{
|
||||
//HandleError(ERR_DEMO_RANGE_ONE);
|
||||
APP_LOG(TS_OFF, VLEVEL_H,"\r\n#%u sensor ERR code = %04u\r\n",i, ERR_DEMO_RANGE_ONE);
|
||||
}
|
||||
// ########## two conditions
|
||||
// ########## 1) return status ==0,
|
||||
// ########## 2) and ranging status for valid ranging value !!!!!!!!!!!!!!!!!
|
||||
}
|
||||
HAL_Delay(1);
|
||||
} while ((RangingMeasurementData.RangeStatus != 0)&&(rep <10));
|
||||
sts_tof_distance_data[i] = (int)VL53L0XDevs[i].LeakyRange ==0?STS_MAX_L0_RANGE:(int)VL53L0XDevs[i].LeakyRange;
|
||||
}
|
||||
|
||||
HAL_Delay(30);
|
||||
HAL_Delay(5);
|
||||
} // for i < MAX_TOF_COUNT
|
||||
if (sensor_data_ready != 0) {
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n## Measured Range: \r\nTOF #0 = %4u mm, \r\nTOF #1 = %4u mm, \r\nTOF #2 = %4u mm\r\n",
|
||||
|
|
Loading…
Reference in New Issue