update with good startup updown value

This commit is contained in:
Yunhorn 2025-04-07 20:57:39 +08:00
parent cda4490d24
commit a13fdfafc9
24 changed files with 67 additions and 33 deletions

View File

@ -47,7 +47,7 @@ extern "C" {
/**
* @brief Verbose level for all trace logs
*/
#define VERBOSE_LEVEL VLEVEL_L
#define VERBOSE_LEVEL VLEVEL_M
/**
* @brief Enable trace logs

View File

@ -1405,6 +1405,9 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
LmHandlerParams.IsTxConfirmed = true;
LmHandlerErrorStatus_t status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
if (status ==LORAMAC_HANDLER_SUCCESS ) LmHandlerParams.IsTxConfirmed = false;
STS_SENSOR_Function_Test_Process();
}
else
{
@ -1414,6 +1417,7 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
APP_LOG(TS_OFF, VLEVEL_H, "###### U/L FRAME:JOIN | DR:%d | PWR:%d\r\n", joinParams->Datarate, joinParams->TxPower);
}
// UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer);
/* USER CODE END OnJoinRequest_1 */
}

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1759988577722177836" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-859626784961551925" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1759988577722177836" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-859626784961551925" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
# Add inputs and outputs from these tool invocations to the build variables

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
-include ../makefile.init

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
USER_OBJS :=

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
ELF_SRCS :=

View File

@ -2050,6 +2050,7 @@ void STS_SENSOR_Distance_Test_Process(void)
do
{
range_once = (uint16_t)MX_TOF_Ranging_Process();
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Repeat=%d Distance=%d \r\n", rpt, range_once);
if (range_once > 0)
{
rpt++;

View File

@ -184,6 +184,10 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
#if 1
uint8_t i=0;
uint32_t range_distance =0;
uint8_t j=0;
uint32_t bg_distance[64]={0};
uint8_t idx[64]={0};
uint8_t IDX_LEN=10;
for (i=0; i<64; i++)
{
@ -203,7 +207,7 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
//APP_LOG(TS_OFF, VLEVEL_M, "\r\nReconfig ----> Threshold High=%d mm, Low=%d mm \r\n", sts_high_threshold, sts_low_threshold);
STS_TOF_L8_Reconfig();
#if 1
status = VL53L8A1_RANGING_SENSOR_Start(VL53L8A1_DEV_CENTER, RS_MODE_ASYNC_CONTINUOUS);
if (status != BSP_ERROR_NONE)
@ -211,16 +215,40 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
printf("VL53L8A1_RANGING_SENSOR_Start failed\n");
while (1);
}
#endif
if (ToF_EventDetected != 0)
for (j=0; j < IDX_LEN; j++)
{
ToF_EventDetected = 0;
status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result);
if (status != BSP_ERROR_NONE)
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n Cycle:%d \r\n", j);
MX_53L8A1_ThresholdDetection_Process();
//if (ToF_EventDetected != 0)
{
APP_LOG(TS_OFF, VLEVEL_M, "\r\n x \r\n");
// ToF_EventDetected = 0;
// status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result);
//if (status != BSP_ERROR_NONE)
//{
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n x \r\n");
//} else {
for (i = 0; i < 64; i++)
{
if (i % 8 ==0) APP_LOG(TS_OFF, VLEVEL_H, "\r\n[cm] ");
if ((Result.ZoneResult[i].NumberOfTargets > 0))
{
bg_distance[i] += (uint32_t) Result.ZoneResult[i].Distance[0];
idx[i] ++;
APP_LOG(TS_OFF, VLEVEL_H, "|%3d ", Result.ZoneResult[i].Distance[0]/10);
} else APP_LOG(TS_OFF, VLEVEL_H, "|%3d ", 0);
}
//}
}
HAL_Delay(50);
}
for (i=0; i< 64; i++)
bg_distance[i] /= idx[i];
//STS_TOF_L8_Process();
@ -231,10 +259,11 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
{
/* Print distance and status */
if (i%8==0) APP_LOG(TS_OFF, VLEVEL_L, "\r\n[cm]|");
if ((Result.ZoneResult[i].NumberOfTargets > 0))
// if ((Result.ZoneResult[i].NumberOfTargets > 0))
if (1)
{
range_distance = (uint32_t)Result.ZoneResult[i].Distance[0];
// range_distance = (uint32_t)Result.ZoneResult[i].Distance[0];
range_distance = (uint32_t)bg_distance[i];
fhmos_bg.h2cm[i] = abs(sts_sensor_install_height - range_distance)/20; // in 2 cm
if (2*fhmos_bg.h2cm[i] < fhmos_cfg.th_gesture_mask_off_height_cm)
@ -545,9 +574,9 @@ static void MX_53L8A1_ThresholdDetection_Process(void)
//ITConfig.LowThreshold = LOW_THRESHOLD; /* mm */
//ITConfig.HighThreshold = HIGH_THRESHOLD; /* mm */
sts_high_threshold = sts_sensor_install_height;
sts_high_threshold = sts_sensor_install_height+ 400;
sts_low_threshold = sts_high_threshold - 1400;
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Threshold High=%4d, Low=%4d \r\n", sts_high_threshold, sts_low_threshold);
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Threshold High=%4d, Low=%4d \r\n", sts_high_threshold, sts_low_threshold);
ITConfig.LowThreshold = sts_low_threshold;
ITConfig.HighThreshold = sts_high_threshold;