-- remove unused debug messages

This commit is contained in:
Yunhorn 2024-09-24 19:21:40 +08:00
parent a1ac02fa7b
commit 7293a267be
2 changed files with 17 additions and 19 deletions

View File

@ -379,7 +379,7 @@ void STS_YunhornSTSEventP4_Process(void)
LED_OFF;
#endif
#if defined(TOF_1)||defined(TOF_2)||defined(VL53L0)
APP_LOG(TS_OFF, VLEVEL_M, "\r\n TOF_1, TOF_2 RANGING Process\r\n");
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n TOF_1, TOF_2 RANGING Process\r\n");
PME_ON;
STS_TOF_VL53L0X_Range_Process();
PME_OFF;

View File

@ -121,7 +121,7 @@ void sts_tof_vl53l0x_SetupSingleShot(RangingConfig_e rangingConfig);
void HandleError(int err){
//char msg[16];
//sprintf(msg,"Er%d", err);
APP_LOG(TS_OFF, VLEVEL_L,"Er %04u\r\n",err);
APP_LOG(TS_OFF, VLEVEL_H,"Er %04u\r\n",err);
//while(1){};
}
@ -166,44 +166,42 @@ int sts_tof_vl53l0x_DetectSensors(void)
/* Try to read one register using default 0x52 address */
status = VL53L0X_RdWord(pDev, VL53L0X_REG_IDENTIFICATION_MODEL_ID, &Id);
APP_LOG(TS_OFF, VLEVEL_M, "#%u read id = %04X I2C ADDR=0x%2X\r\n",i, Id, pDev->I2cDevAddr);
//APP_LOG(TS_OFF, VLEVEL_H, "#%u read id = %04X I2C ADDR=0x%2X\r\n",i, Id, pDev->I2cDevAddr);
if (status) {
APP_LOG(TS_OFF, VLEVEL_M, "# Read id fail \r\n");
APP_LOG(TS_OFF, VLEVEL_H, "# Read id fail \r\n");
break;
}
if (Id == 0xEEAA) {
/* Sensor is found => Change its I2C address to final one */
APP_LOG(TS_OFF, VLEVEL_M, "\n Set Final i2c addr to %02X \r\n", FinalAddress);
//APP_LOG(TS_OFF, VLEVEL_H, "\n Set Final i2c addr to %02X \r\n", FinalAddress);
status = VL53L0X_SetDeviceAddress(pDev,FinalAddress);
if (status != 0) {
APP_LOG(TS_OFF, VLEVEL_M, "#i VL53L0X_SetDeviceAddress fail\r\n");
APP_LOG(TS_OFF, VLEVEL_H, "#i VL53L0X_SetDeviceAddress fail\r\n");
break;
}
pDev->I2cDevAddr = FinalAddress;
APP_LOG(TS_OFF, VLEVEL_M, "\n pDev->I2CDevAddr set to: %02X \r\n", pDev->I2cDevAddr);
//APP_LOG(TS_OFF, VLEVEL_H, "\n pDev->I2CDevAddr set to: %02X \r\n", pDev->I2cDevAddr);
/* Check all is OK with the new I2C address and initialize the sensor */
status = VL53L0X_RdWord(pDev, VL53L0X_REG_IDENTIFICATION_MODEL_ID, &Id);
if (status !=0)
{
APP_LOG(TS_OFF, VLEVEL_M, "#i VL53L0X_RdWord fail\r\n");
APP_LOG(TS_OFF, VLEVEL_H, "#i VL53L0X_RdWord fail\r\n");
break;
}
status = VL53L0X_DataInit(pDev);
if( status == 0 ){
pDev->Present = 1;
APP_LOG(TS_OFF, VLEVEL_M, "#%u VL53L0X_SetDeviceAddress to 0x%02x\r\n",i, pDev->I2cDevAddr);
nDevPresent++;
nDevMask |= 1 << i;
pDev->Present = 1;
APP_LOG(TS_OFF, VLEVEL_M, "VL53L0X %d Present and initiated to final 0x%2x, Position Mask=0x%02x\r\n", pDev->Id, pDev->I2cDevAddr, nDevMask);
}
else{
APP_LOG(TS_OFF, VLEVEL_M, "VL53L0X_DataInit %d fail\r\n", Id);
APP_LOG(TS_OFF, VLEVEL_H, "VL53L0X_DataInit %d fail\r\n", Id);
break;
}
} else {
APP_LOG(TS_OFF, VLEVEL_M, "# unknown ID %x\r\n", Id);
APP_LOG(TS_OFF, VLEVEL_H, "# unknown ID %x\r\n", Id);
status = 1;
}
} while(0);
@ -236,7 +234,7 @@ void sts_tof_vl53l0x_SetupSingleShot(RangingConfig_e rangingConfig)
if( VL53L0XDevs[i].Present){
APP_LOG(TS_OFF, VLEVEL_M, "\r\n ###### Starting Range #%u sensor \r\n",i);
//APP_LOG(TS_OFF, VLEVEL_H, "\r\n ###### Starting Range #%u sensor \r\n",i);
status=VL53L0X_StaticInit(&VL53L0XDevs[i]);
@ -355,10 +353,10 @@ void STS_TOF_VL53L0X_Range_Process(void)
if ((nDevMask ==0) || (nSensorPresent ==0))
{
nSensorPresent = sts_tof_vl53l0x_DetectSensors(); // confirm sensor online
APP_LOG(TS_OFF, VLEVEL_M, "\r\n %u pcs sensor(s) online \r\n", nSensorPresent);
APP_LOG(TS_OFF, VLEVEL_H, "\r\n %u pcs sensor(s) online \r\n", nSensorPresent);
}
APP_LOG(TS_OFF, VLEVEL_M, "\n\n nDevMask=%02X nSensorPresent = %02x \n\n", nDevMask, nSensorPresent);
//APP_LOG(TS_OFF, VLEVEL_H, "\n\n nDevMask=%02X nSensorPresent = %02x \n\n", nDevMask, nSensorPresent);
#ifdef TOF_3
sts_tof_distance_data[2] = 0;
@ -373,7 +371,7 @@ void STS_TOF_VL53L0X_Range_Process(void)
//for (i=0; i< MAX_TOF_COUNT; i++)
for (i=0; i< nSensorPresent; i++)
{
APP_LOG(TS_OFF, VLEVEL_M, "\n\n i=%u Present=%u DevAdd=%02x \n", i, VL53L0XDevs[i].Present, VL53L0XDevs[i].I2cDevAddr);
//APP_LOG(TS_OFF, VLEVEL_H, "\n\n i=%u Present=%u DevAdd=%02x \n", i, VL53L0XDevs[i].Present, VL53L0XDevs[i].I2cDevAddr);
if (VL53L0XDevs[i].Present ==1)
{
uint8_t rep=0;
@ -391,7 +389,7 @@ void STS_TOF_VL53L0X_Range_Process(void)
} else
{
//HandleError(ERR_DEMO_RANGE_ONE);
APP_LOG(TS_OFF, VLEVEL_M,"\r\n#%u sensor ERR code = %04u\r\n",i, 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,
@ -409,7 +407,7 @@ void STS_TOF_VL53L0X_Range_Process(void)
if (sensor_data_ready != 0)
{
APP_LOG(TS_OFF, VLEVEL_M, "\r\n## Measured Range: \r\nTOF #0 = %4u mm, \r\nTOF #1 = %4u mm, \r\nTOF #2 = %4u mm\r\n",
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",
(int)sts_tof_distance_data[0],(int)sts_tof_distance_data[1],(int)sts_tof_distance_data[2]);
}
@ -418,7 +416,7 @@ void STS_TOF_VL53L0X_Range_Process(void)
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;
APP_LOG(TS_OFF, VLEVEL_M, "\n\n APP_LOG no ToF sensor online \n\n");
APP_LOG(TS_OFF, VLEVEL_H, "\n\n APP_LOG no ToF sensor online \n\n");
}
// reset for next ranging