improved code of uplink format, single distance report only
This commit is contained in:
parent
98af6468f6
commit
1e87ff9b27
|
@ -857,13 +857,14 @@ static void SendTxData(void)
|
|||
AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff;
|
||||
|
||||
#elif defined(STS_R5)
|
||||
AppData.Buffer[i++] = (uint8_t)(0x06)&0xff; //#length of following bytes
|
||||
AppData.Buffer[i++] = (uint8_t)(0x02)&0xff; //#length of following bytes
|
||||
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; //#07
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm)&0xff; //#08
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance2_mm >>8)&0xff; //#09
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance2_mm)&0xff; //#10
|
||||
|
||||
// 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.distance2_mm >>8)&0xff; //#09
|
||||
// AppData.Buffer[i++] = (uint8_t)(r0_data.distance2_mm)&0xff; //#10
|
||||
|
||||
#ifdef TOF_3
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance2_mm >>8)&0xff; //#09
|
||||
|
@ -1502,15 +1503,16 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
outbuf[i++] = (uint8_t) (((uint16_t)sts_distance_rss_distance)%10+0x30)&0xff;
|
||||
#endif
|
||||
#if (defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R1_ENABLED))
|
||||
#ifdef TOF_1
|
||||
#if defined(STS_R1D)
|
||||
outbuf[i++] = (uint8_t) (((uint16_t)sts_tof_distance_data[0])/100)&0xff;
|
||||
outbuf[i++] = (uint8_t) (((uint16_t)sts_tof_distance_data[0])%100)&0xff;
|
||||
#endif
|
||||
#ifdef TOF_2
|
||||
outbuf[i++] = (uint8_t) (((uint16_t)sts_tof_distance_data[1])/100)&0xff;
|
||||
outbuf[i++] = (uint8_t) (((uint16_t)sts_tof_distance_data[1])%100)&0xff;
|
||||
#endif
|
||||
|
||||
#if defined(STS_R5)
|
||||
outbuf[i++] = (uint8_t) (((uint16_t)sts_tof_distance_data[0])/100)&0xff;
|
||||
outbuf[i++] = (uint8_t) (((uint16_t)sts_tof_distance_data[0])%100)&0xff;
|
||||
#endif
|
||||
#ifdef TOF_3
|
||||
outbuf[i++] = (uint8_t) (((uint16_t)sts_tof_distance_data[2])/100)&0xff;
|
||||
outbuf[i++] = (uint8_t) (((uint16_t)sts_tof_distance_data[2])%100)&0xff;
|
||||
|
@ -2153,14 +2155,16 @@ void STS_SENSOR_Function_Test_Process(void)
|
|||
//MX_TOF_Process();
|
||||
STS_TOF_VL53L0X_Range_Process();
|
||||
|
||||
#ifdef TOF_1
|
||||
#if defined(TOF_1)&&defined(TOF_2)
|
||||
tstbuf[i++] = (uint8_t) ((sts_tof_distance_data[0] >>8 ) &0xff);
|
||||
tstbuf[i++] = (uint8_t) (sts_tof_distance_data[0] &0xff);
|
||||
#endif
|
||||
#ifdef TOF_2
|
||||
tstbuf[i++] = (uint8_t) ((sts_tof_distance_data[1] >>8 ) &0xff);
|
||||
tstbuf[i++] = (uint8_t) (sts_tof_distance_data[1] &0xff);
|
||||
#endif
|
||||
#if defined(STS_R5)
|
||||
tstbuf[i++] = (uint8_t) ((sts_tof_distance_data[0] >>8 ) &0xff);
|
||||
tstbuf[i++] = (uint8_t) (sts_tof_distance_data[0] &0xff);
|
||||
#endif
|
||||
#ifdef TOF_3
|
||||
tstbuf[i++] = (uint8_t) ((sts_tof_distance_data[2] >>8 ) &0xff);
|
||||
tstbuf[i++] = (uint8_t) (sts_tof_distance_data[2] &0xff);
|
||||
|
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -44,7 +44,14 @@
|
|||
* @defgroup ErrCode Errors code shown on display
|
||||
* @{
|
||||
*/
|
||||
#ifdef STS_R1D //short, accuracy ranging for jumbo sensors
|
||||
#define STS_MAX_L0_RANGE ((uint32_t) 1000)
|
||||
#endif
|
||||
|
||||
#ifdef STS_R5 //long distance for waste bin sensor
|
||||
#define STS_MAX_L0_RANGE ((uint32_t) 2500)
|
||||
#endif
|
||||
|
||||
#define ERR_DETECT -1
|
||||
#define ERR_DEMO_RANGE_ONE 1
|
||||
#define ERR_DEMO_RANGE_MULTI 2
|
||||
|
@ -147,8 +154,10 @@ int sts_tof_vl53l0x_DetectSensors(void)
|
|||
pDev->Present = 0;
|
||||
XWL55_WLE5_53L0X_ResetId(pDev->Id, 1);
|
||||
HAL_Delay(3);
|
||||
FinalAddress = 0x52+(i+1)*2;
|
||||
|
||||
//FinalAddress = 0x52+(i+1)*2;
|
||||
#ifdef STS_R5
|
||||
FinalAddress = 0x52;
|
||||
#endif
|
||||
//APP_LOG(TS_OFF, VLEVEL_H, "\r\n Detect TOF sensors #%u with I2CDevAddr=0x%02x \r\n", i, pDev->I2cDevAddr);
|
||||
|
||||
do {
|
||||
|
@ -366,7 +375,9 @@ 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;
|
||||
/* HIGH_ACCURACY for STS_R1/R2/R3 short distance less than 1000mm */
|
||||
/* LONG_RANGE for STS_R5 long distance less than 2500mm */
|
||||
RangingConfig_e RangingConfig = LONG_RANGE; //STS_R1/R2 accuracy, STS_R5 long range waste-bin sensor
|
||||
XWL55_WLE5_53L0X_Init();
|
||||
if ((nDevMask ==0) || (nSensorPresent ==0))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue