try lowpower ,disable PME_OFF and GPIO_DeInit of A/B/C

This commit is contained in:
Yunhorn 2024-05-24 19:08:56 +08:00
parent de88ae61f7
commit 639b5df564
8 changed files with 4863 additions and 4858 deletions

View File

@ -146,7 +146,7 @@ void MX_GPIO_Init(void)
HAL_GPIO_Init(TOF_C_XSHUT_GPIO_Port, &GPIO_InitStruct);
#endif
/*Configure GPIO pins : TOF_L_XSHUT_Pin */
#if (defined(TOF_2)&&!defined(TOF_1))
#if (defined(TOF_2)&&defined(TOF_1))
GPIO_InitStruct.Pin = TOF_L_XSHUT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;

View File

@ -81,31 +81,34 @@ const struct UTIL_LPM_Driver_s UTIL_PowerDriver =
void PWR_EnterOffMode(void)
{
/* USER CODE BEGIN EnterOffMode_1 */
#if 0
PME_OFF;
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();
#endif
/* USER CODE END EnterOffMode_1 */
}
void PWR_ExitOffMode(void)
{
/* USER CODE BEGIN ExitOffMode_1 */
#if 0
HAL_ResumeTick();
return;
#endif
/* USER CODE END ExitOffMode_1 */
}
void PWR_EnterStopMode(void)
{
/* USER CODE BEGIN EnterStopMode_1 */
PME_OFF;
HAL_GPIO_DeInit(GPIOA,GPIO_PIN_All);
HAL_GPIO_DeInit(GPIOB,GPIO_PIN_All);
HAL_GPIO_DeInit(GPIOC,GPIO_PIN_All);
//PME_OFF;
//HAL_GPIO_DeInit(GPIOA,GPIO_PIN_All);
//HAL_GPIO_DeInit(GPIOB,GPIO_PIN_All);
//HAL_GPIO_DeInit(GPIOC,GPIO_PIN_All);
/* USER CODE END EnterStopMode_1 */
HAL_SuspendTick();

View File

@ -812,7 +812,7 @@ static void SendTxData(void)
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), CFG_SEQ_Prio_0);
#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0);
MX_TOF_Process();
STS_R0_SENSOR_Read(&r0_data);
//r0_data.battery_mV = batteryLevelmV;
r0_data.battery_Pct = (uint8_t)(99*batteryLevel/254);
@ -919,7 +919,7 @@ static void OnTxTimerEvent(void *context)
/* USER CODE END OnTxTimerEvent_1 */
//upload_message_timer =1U;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0);
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
/*Wait for next tx slot*/

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -5,14 +5,14 @@
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_certif_path" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_check_enable" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_key_path" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_permission" value="debug_non_secure_L3"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_permission" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.enabled" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.value" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;D:\\ONEDRIVE\\STM32WLV13\\Projects\\NUCLEO-WL55JC\\Applications\\LoRaWAN\\STS_RR_R125\\STM32CubeIDE\\Release\\STS_RR_R125.elf&quot;,&quot;fProjectName&quot;:&quot;STS_RR_R125&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;Release/STS_RR_R125.elf&quot;,&quot;fProjectName&quot;:&quot;STS_RR_R125&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
@ -67,7 +67,7 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="D:\ONEDRIVE\STM32WLV13\Projects\NUCLEO-WL55JC\Applications\LoRaWAN\STS_RR_R125\STM32CubeIDE\Release\STS_RR_R125.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Release/STS_RR_R125.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="STS_RR_R125"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>

View File

@ -127,7 +127,8 @@ void MX_TOF_Process(void)
#if defined(YUNHORN_STS_R0_ENABLED)
void STS_R0_SENSOR_Read(STS_R0_SensorDataTypeDef *r0_data)
{
r0_data->distance_mm =0;
r0_data->distance1_mm =0;
r0_data->distance_mm = (uint16_t)sts_tof_distance_data[0];
r0_data->distance1_mm = (uint16_t)sts_tof_distance_data[1];
// r0_data->distance2_mm = (uint16_t)sts_tof_distance_data[2];

View File

@ -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
@ -85,7 +92,7 @@ int nDevMask=0;
int nSensorPresent;
volatile int sts_tof_distance_data[MAX_TOF_COUNT]={0x0};
volatile int sts_tof_distance_data[MAX_TOF_COUNT]={0x0,0x0};
extern volatile uint8_t sensor_data_ready;
VL53L0X_Dev_t VL53L0XDevs[]={
@ -372,6 +379,9 @@ void STS_TOF250_Range_Process(void)
void STS_TOF_VL53L0X_Range_Process(void)
{
int status=0, i;
/* 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 = HIGH_ACCURACY; //HIGH_ACCURACY; //LONG_RANGE;
XWL55_WLE5_53L0X_Init();
if ((nDevMask ==0) || (nSensorPresent ==0))
@ -418,12 +428,12 @@ void STS_TOF_VL53L0X_Range_Process(void)
// ########## 1) return status ==0,
// ########## 2) and ranging status for valid ranging value !!!!!!!!!!!!!!!!!
}
HAL_Delay(30);
HAL_Delay(1);
} while ((RangingMeasurementData.RangeStatus != 0)&&(rep <10));
sts_tof_distance_data[i] = (RangingMeasurementData.RangeStatus!=0)?STS_MAX_L0_RANGE:VL53L0XDevs[i].LeakyRange;
}
HAL_Delay(30);
HAL_Delay(1);
} // for i < MAX_TOF_COUNT
if (sensor_data_ready != 0) {