low power improvement
This commit is contained in:
parent
e75eea330c
commit
516786360c
|
@ -114,8 +114,8 @@ void MX_TOF_Init(void);
|
||||||
|
|
||||||
#define MEMS_RESET_Pin GPIO_PIN_4
|
#define MEMS_RESET_Pin GPIO_PIN_4
|
||||||
#define MEMS_RESET_GPIO_Port GPIOB
|
#define MEMS_RESET_GPIO_Port GPIOB
|
||||||
#define POWER_OFF HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET)
|
#define PME_OFF HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET)
|
||||||
#define POWER_ON HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET)
|
#define PME_ON HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET)
|
||||||
#define TOF250_I2C_ADDR (0x52<<1)
|
#define TOF250_I2C_ADDR (0x52<<1)
|
||||||
|
|
||||||
#if defined(STM32WLE5xx) || defined(STM32WL55xx)
|
#if defined(STM32WLE5xx) || defined(STM32WL55xx)
|
||||||
|
|
|
@ -105,8 +105,8 @@
|
||||||
|
|
||||||
|
|
||||||
#define MajorVer 24U
|
#define MajorVer 24U
|
||||||
#define MinorVer 03U
|
#define MinorVer 05U
|
||||||
#define SubMinorVer 07U
|
#define SubMinorVer 22U
|
||||||
#define FirmwareVersion 3U
|
#define FirmwareVersion 3U
|
||||||
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U
|
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U
|
||||||
#define YUNHORN_STS_AC_CODE_SIZE 20U
|
#define YUNHORN_STS_AC_CODE_SIZE 20U
|
||||||
|
|
|
@ -111,7 +111,7 @@ void MX_GPIO_Init(void)
|
||||||
#endif
|
#endif
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
/*Configure GPIO pins : TOF_C_INT_Pin */
|
/*Configure GPIO pins : TOF_C_INT_Pin */
|
||||||
#if defined(TOF_1)
|
#if (defined(TOF_1) && defined(TOF_2))
|
||||||
GPIO_InitStruct.Pin = TOF_C_INT_Pin;
|
GPIO_InitStruct.Pin = TOF_C_INT_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
@ -119,7 +119,7 @@ void MX_GPIO_Init(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Configure GPIO pins : TOF_L_INT_Pin */
|
/*Configure GPIO pins : TOF_L_INT_Pin */
|
||||||
#if defined(TOF_2)
|
#if (defined(TOF_2)&&!defined(TOF_1))
|
||||||
GPIO_InitStruct.Pin = TOF_L_INT_Pin;
|
GPIO_InitStruct.Pin = TOF_L_INT_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
@ -134,7 +134,7 @@ void MX_GPIO_Init(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Configure GPIO pins : TOF_C_XSHUT_Pin */
|
/*Configure GPIO pins : TOF_C_XSHUT_Pin */
|
||||||
#if defined(TOF_1)
|
#if (defined(TOF_1) && defined(TOF_2))
|
||||||
GPIO_InitStruct.Pin = TOF_C_XSHUT_Pin;
|
GPIO_InitStruct.Pin = TOF_C_XSHUT_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
|
@ -142,7 +142,7 @@ void MX_GPIO_Init(void)
|
||||||
HAL_GPIO_Init(TOF_C_XSHUT_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(TOF_C_XSHUT_GPIO_Port, &GPIO_InitStruct);
|
||||||
#endif
|
#endif
|
||||||
/*Configure GPIO pins : TOF_L_XSHUT_Pin */
|
/*Configure GPIO pins : TOF_L_XSHUT_Pin */
|
||||||
#if defined(TOF_2)
|
#if (defined(TOF_2)&&!defined(TOF_1))
|
||||||
GPIO_InitStruct.Pin = TOF_L_XSHUT_Pin;
|
GPIO_InitStruct.Pin = TOF_L_XSHUT_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
|
@ -169,7 +169,7 @@ void MX_GPIO_Init(void)
|
||||||
|
|
||||||
GPIO_InitStruct.Pin = MEMS_POWER_Pin;
|
GPIO_InitStruct.Pin = MEMS_POWER_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN; // PULL DOWN TO DISABLE TPS
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(MEMS_POWER_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(MEMS_POWER_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
@ -202,12 +202,12 @@ HAL_GPIO_Init(SOAP_SWITCH_GPIO_Port, &GPIO_InitStruct);
|
||||||
HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0);
|
HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0);
|
||||||
HAL_NVIC_EnableIRQ(EXTI1_IRQn);
|
HAL_NVIC_EnableIRQ(EXTI1_IRQn);
|
||||||
#endif
|
#endif
|
||||||
#if defined(TOF_1)
|
#if (defined(TOF_1) && defined(TOF_2))
|
||||||
HAL_NVIC_SetPriority(TOF_C_INT_EXTI_IRQn, 0, 0);
|
HAL_NVIC_SetPriority(TOF_C_INT_EXTI_IRQn, 0, 0);
|
||||||
HAL_NVIC_EnableIRQ(TOF_C_INT_EXTI_IRQn);
|
HAL_NVIC_EnableIRQ(TOF_C_INT_EXTI_IRQn);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TOF_2)
|
#if (defined(TOF_2)&&!defined(TOF_1))
|
||||||
HAL_NVIC_SetPriority(TOF_L_INT_EXTI_IRQn, 0, 0);
|
HAL_NVIC_SetPriority(TOF_L_INT_EXTI_IRQn, 0, 0);
|
||||||
HAL_NVIC_EnableIRQ(TOF_L_INT_EXTI_IRQn);
|
HAL_NVIC_EnableIRQ(TOF_L_INT_EXTI_IRQn);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -80,67 +80,26 @@ const struct UTIL_LPM_Driver_s UTIL_PowerDriver =
|
||||||
|
|
||||||
void PWR_EnterOffMode(void)
|
void PWR_EnterOffMode(void)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
//HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_RESET); /* LED OFF */
|
|
||||||
HAL_SuspendTick();
|
|
||||||
HAL_UART_DeInit(&huart2);
|
|
||||||
//LL_PWR_ClearFlag_WU();
|
|
||||||
//__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
|
|
||||||
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
|
|
||||||
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_LPMODES);
|
|
||||||
//LL_PWR_ClearFlag_WU();
|
|
||||||
HAL_PWR_EnterSTANDBYMode();
|
|
||||||
#endif
|
|
||||||
POWER_OFF;
|
|
||||||
//HAL_UART_DeInit(&huart2);
|
|
||||||
//vcom_DeInit();
|
|
||||||
HAL_GPIO_DeInit(GPIOA,GPIO_PIN_All);
|
|
||||||
HAL_GPIO_DeInit(GPIOB,GPIO_PIN_All);
|
|
||||||
HAL_GPIO_DeInit(GPIOC,GPIO_PIN_All);
|
|
||||||
HAL_SuspendTick();
|
|
||||||
HAL_PWR_EnterSTANDBYMode();
|
|
||||||
#if 0
|
|
||||||
LED_OFF;
|
|
||||||
HAL_UART_DeInit(&huart2);
|
|
||||||
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);//禁用所有使用的唤醒源:PWR_WAKEUP_PIN1 connected to PA.00
|
|
||||||
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);//清除所有相关的唤醒标志
|
|
||||||
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);//启用连接到PA.00的WakeUp Pin
|
|
||||||
HAL_PWR_EnterSTANDBYMode();//进入待机模式
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EnterOffMode_1 */
|
/* USER CODE BEGIN EnterOffMode_1 */
|
||||||
HAL_PWR_EnterSTANDBYMode();
|
|
||||||
/* USER CODE END EnterOffMode_1 */
|
/* USER CODE END EnterOffMode_1 */
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PWR_ExitOffMode(void)
|
void PWR_ExitOffMode(void)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN ExitOffMode_1 */
|
/* USER CODE BEGIN ExitOffMode_1 */
|
||||||
#if 1
|
|
||||||
POWER_ON;
|
|
||||||
HAL_ResumeTick();
|
|
||||||
//__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
|
|
||||||
//HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET); /* LED ON */
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
|
|
||||||
LED_ON;
|
|
||||||
HAL_Delay(200);
|
|
||||||
#endif
|
|
||||||
/* USER CODE END ExitOffMode_1 */
|
/* USER CODE END ExitOffMode_1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void PWR_EnterStopMode(void)
|
void PWR_EnterStopMode(void)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN EnterStopMode_1 */
|
/* USER CODE BEGIN EnterStopMode_1 */
|
||||||
POWER_OFF;
|
PME_OFF;
|
||||||
//HAL_UART_DeInit(&huart2);
|
|
||||||
//vcom_DeInit();
|
|
||||||
HAL_GPIO_DeInit(GPIOA,GPIO_PIN_All);
|
HAL_GPIO_DeInit(GPIOA,GPIO_PIN_All);
|
||||||
HAL_GPIO_DeInit(GPIOB,GPIO_PIN_All);
|
HAL_GPIO_DeInit(GPIOB,GPIO_PIN_All);
|
||||||
HAL_GPIO_DeInit(GPIOC,GPIO_PIN_All);
|
HAL_GPIO_DeInit(GPIOC,GPIO_PIN_All);
|
||||||
|
|
||||||
/* USER CODE END EnterStopMode_1 */
|
/* USER CODE END EnterStopMode_1 */
|
||||||
HAL_SuspendTick();
|
HAL_SuspendTick();
|
||||||
/* Clear Status Flag before entering STOP/STANDBY Mode */
|
/* Clear Status Flag before entering STOP/STANDBY Mode */
|
||||||
|
@ -163,19 +122,19 @@ void PWR_ExitStopMode(void)
|
||||||
/* Resume sysTick : work around for debugger problem in dual core */
|
/* Resume sysTick : work around for debugger problem in dual core */
|
||||||
|
|
||||||
HAL_ResumeTick();
|
HAL_ResumeTick();
|
||||||
POWER_ON;
|
|
||||||
/*Not retained periph:
|
/*Not retained periph:
|
||||||
ADC interface
|
ADC interface
|
||||||
DAC interface USARTx, TIMx, i2Cx, SPIx
|
DAC interface USARTx, TIMx, i2Cx, SPIx
|
||||||
SRAM ctrls, DMAx, DMAMux, AES, RNG, HSEM */
|
SRAM ctrls, DMAx, DMAMux, AES, RNG, HSEM */
|
||||||
|
|
||||||
/* Resume not retained USARTx and DMA */
|
/* Resume not retained USARTx and DMA */
|
||||||
//vcom_Resume();
|
vcom_Resume(); //DON'T REMOVE THIS, KKEP LOW POWER
|
||||||
/* USER CODE BEGIN ExitStopMode_2 */
|
/* USER CODE BEGIN ExitStopMode_2 */
|
||||||
MX_GPIO_Init();
|
MX_GPIO_Init();
|
||||||
MX_DMA_Init();
|
MX_DMA_Init();
|
||||||
MX_I2C2_Init();
|
MX_I2C2_Init();
|
||||||
|
PME_ON;
|
||||||
/* USER CODE END ExitStopMode_2 */
|
/* USER CODE END ExitStopMode_2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,6 +343,7 @@ void STS_YunhornSTSEventP6_Process(void)
|
||||||
{
|
{
|
||||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n P6 Testing Process\r\n");
|
APP_LOG(TS_OFF, VLEVEL_L, "\r\n P6 Testing Process\r\n");
|
||||||
STS_SENSOR_Power_ON(0);
|
STS_SENSOR_Power_ON(0);
|
||||||
|
HAL_Delay(50);
|
||||||
#ifdef LED_ONBOARD
|
#ifdef LED_ONBOARD
|
||||||
LED_ON;
|
LED_ON;
|
||||||
HAL_Delay(20);
|
HAL_Delay(20);
|
||||||
|
@ -352,7 +353,7 @@ void STS_YunhornSTSEventP6_Process(void)
|
||||||
#if defined(SOAP_LEVEL_SENSOR)
|
#if defined(SOAP_LEVEL_SENSOR)
|
||||||
HAL_GPIO_WritePin(SOAP_SWITCH_GPIO_Port, SOAP_SWITCH_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(SOAP_SWITCH_GPIO_Port, SOAP_SWITCH_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
HAL_Delay(5000);
|
HAL_Delay(1000);
|
||||||
/* 2. Read sensor state */
|
/* 2. Read sensor state */
|
||||||
sts_soap_level_state = 0;
|
sts_soap_level_state = 0;
|
||||||
sts_soap_level_state = HAL_GPIO_ReadPin(SOAP_STATUS_GPIO_Port,SOAP_STATUS_Pin);
|
sts_soap_level_state = HAL_GPIO_ReadPin(SOAP_STATUS_GPIO_Port,SOAP_STATUS_Pin);
|
||||||
|
@ -519,11 +520,7 @@ void STS_SENSOR_Power_ON(uint8_t cnt)
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
//#if (defined(YUNHORN_STS_M7_ENABLED) || defined(YUNHORN_STS_R0_ENABLED))
|
PME_ON;
|
||||||
HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -536,10 +533,7 @@ void STS_SENSOR_Power_OFF(uint8_t cnt)
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
//#if (defined(YUNHORN_STS_M7_ENABLED) || defined(YUNHORN_STS_R0_ENABLED))
|
PME_OFF;
|
||||||
HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -552,14 +546,8 @@ void STS_SENSOR_MEMS_Reset(uint8_t cnt)
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
#if (defined(YUNHORN_STS_M7_ENABLED) || defined(YUNHORN_STS_R0_ENABLED))
|
HAL_GPIO_TogglePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin);
|
||||||
HAL_GPIO_WritePin(MEMS_RESET_GPIO_Port, MEMS_RESET_Pin, GPIO_PIN_SET);
|
|
||||||
HAL_Delay(50);
|
|
||||||
HAL_GPIO_WritePin(MEMS_RESET_GPIO_Port, MEMS_RESET_Pin, GPIO_PIN_RESET);
|
|
||||||
#endif
|
|
||||||
HAL_GPIO_WritePin(MEMS_RESET_GPIO_Port, MEMS_RESET_Pin, GPIO_PIN_SET);
|
|
||||||
HAL_Delay(50);
|
|
||||||
HAL_GPIO_WritePin(MEMS_RESET_GPIO_Port, MEMS_RESET_Pin, GPIO_PIN_RESET);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -857,15 +857,15 @@ static void SendTxData(void)
|
||||||
AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff;
|
AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff;
|
||||||
|
|
||||||
#elif defined(YUNHORN_STS_R0_ENABLED)
|
#elif defined(YUNHORN_STS_R0_ENABLED)
|
||||||
AppData.Buffer[i++] = (uint8_t)(0x04)&0xff; //#length of following bytes
|
AppData.Buffer[i++] = (uint8_t)(0x06)&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 >>8)&0xff; //#05
|
||||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm)&0xff; //#06
|
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 >>8)&0xff; //#07
|
||||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm)&0xff; //#08
|
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm)&0xff; //#08
|
||||||
#ifdef TOF_3
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance2_mm >>8)&0xff; //#09
|
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.distance2_mm)&0xff; //#10
|
||||||
#endif
|
|
||||||
#ifdef SOAP_LEVEL
|
#ifdef SOAP_LEVEL
|
||||||
AppData.Buffer[i++] = (uint8_t)(sts_soap_level_state)&0xff; //#11
|
AppData.Buffer[i++] = (uint8_t)(sts_soap_level_state)&0xff; //#11
|
||||||
#endif
|
#endif
|
||||||
|
@ -1636,7 +1636,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
||||||
periodicity_length *= 3600;
|
periodicity_length *= 3600;
|
||||||
}
|
}
|
||||||
TxPeriodicity = periodicity_length*1000; //translate to 1000ms=1s
|
TxPeriodicity = periodicity_length*1000; //translate to 1000ms=1s
|
||||||
HeartBeatPeriodicity = TxPeriodicity;
|
//HeartBeatPeriodicity = TxPeriodicity; 2024-05-22, fix issue of heart-beat interval mis-changed by Tx Interval
|
||||||
|
|
||||||
OnTxPeriodicityChanged(TxPeriodicity);
|
OnTxPeriodicityChanged(TxPeriodicity);
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -128,9 +128,9 @@ void MX_TOF_Process(void)
|
||||||
void STS_R0_SENSOR_Read(STS_R0_SensorDataTypeDef *r0_data)
|
void STS_R0_SENSOR_Read(STS_R0_SensorDataTypeDef *r0_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
r0_data->distance_mm = sts_tof_distance_data[0];
|
r0_data->distance_mm = (uint16_t)sts_tof_distance_data[0];
|
||||||
r0_data->distance1_mm = sts_tof_distance_data[1];
|
r0_data->distance1_mm = (uint16_t)sts_tof_distance_data[1];
|
||||||
r0_data->distance2_mm = sts_tof_distance_data[2];
|
r0_data->distance2_mm = (uint16_t)sts_tof_distance_data[2];
|
||||||
#ifdef ROCTEC_R5
|
#ifdef ROCTEC_R5
|
||||||
r0_data->distance1_mm = sts_tof_distance_data[0]+sts_tof_distance_data[1]+sts_tof_distance_data[2];
|
r0_data->distance1_mm = sts_tof_distance_data[0]+sts_tof_distance_data[1]+sts_tof_distance_data[2];
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -357,7 +357,7 @@ void STS_TOF250_Range_Process(void)
|
||||||
status = HAL_I2C_Master_Receive(&hi2c2, TOF250_I2C_ADDR, pdata, count, i2c_time_out);
|
status = HAL_I2C_Master_Receive(&hi2c2, TOF250_I2C_ADDR, pdata, count, i2c_time_out);
|
||||||
if (status == HAL_OK) {
|
if (status == HAL_OK) {
|
||||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n## TOF250 ranging value %02x %02x %4d ",pdata[0],pdata[1], *pdata);
|
APP_LOG(TS_OFF, VLEVEL_H, "\r\n## TOF250 ranging value %02x %02x %4d ",pdata[0],pdata[1], *pdata);
|
||||||
sts_tof_distance_data[2] = pdata[0]*255+pdata[1];
|
sts_tof_distance_data[2] = pdata[0]<<8|pdata[1];
|
||||||
sensor_data_ready = 1;
|
sensor_data_ready = 1;
|
||||||
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",
|
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]);
|
(int)sts_tof_distance_data[0],(int)sts_tof_distance_data[1],(int)sts_tof_distance_data[2]);
|
||||||
|
@ -366,7 +366,7 @@ void STS_TOF250_Range_Process(void)
|
||||||
void STS_TOF_VL53L0X_Range_Process(void)
|
void STS_TOF_VL53L0X_Range_Process(void)
|
||||||
{
|
{
|
||||||
int status=0, i;
|
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();
|
XWL55_WLE5_53L0X_Init();
|
||||||
if ((nDevMask ==0) || (nSensorPresent ==0))
|
if ((nDevMask ==0) || (nSensorPresent ==0))
|
||||||
{
|
{
|
||||||
|
@ -411,10 +411,10 @@ void STS_TOF_VL53L0X_Range_Process(void)
|
||||||
}
|
}
|
||||||
HAL_Delay(1);
|
HAL_Delay(1);
|
||||||
} while ((RangingMeasurementData.RangeStatus != 0)&&(rep <10));
|
} while ((RangingMeasurementData.RangeStatus != 0)&&(rep <10));
|
||||||
sts_tof_distance_data[i] = (RangingMeasurementData.RangeStatus!=0)?STS_MAX_L0_RANGE:VL53L0XDevs[i].LeakyRange;
|
//sts_tof_distance_data[i] = (RangingMeasurementData.RangeStatus!=0)?STS_MAX_L0_RANGE:VL53L0XDevs[i].LeakyRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
HAL_Delay(1);
|
HAL_Delay(5);
|
||||||
} // for i < MAX_TOF_COUNT
|
} // for i < MAX_TOF_COUNT
|
||||||
|
|
||||||
if (sensor_data_ready != 0) {
|
if (sensor_data_ready != 0) {
|
||||||
|
|
Loading…
Reference in New Issue