From bb20be347ed18508bbd745c22794a0c226bbabef Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Fri, 8 Mar 2024 11:10:28 +0800 Subject: [PATCH] minor improve --- Core/Inc/yunhorn_sts_prd_conf.h | 17 ++--------------- Core/Inc/yunhorn_sts_sensors.h | 4 ++-- Core/Src/sts_cmox_hmac_sha.c | 2 +- LoRaWAN/App/lora_app.c | 21 ++++++++------------- STM32CubeIDE/.cproject | 1 - TOF/App/app_tof.c | 8 ++++++-- 6 files changed, 19 insertions(+), 34 deletions(-) diff --git a/Core/Inc/yunhorn_sts_prd_conf.h b/Core/Inc/yunhorn_sts_prd_conf.h index 2667665..7764e47 100644 --- a/Core/Inc/yunhorn_sts_prd_conf.h +++ b/Core/Inc/yunhorn_sts_prd_conf.h @@ -44,12 +44,9 @@ //#define YUNHORN_STS_R1_ENABLED //#define YUNHORN_STS_R3_ENABLED #ifdef SOAP_LEVEL -#define YUNHORN_STS_R4_ENABLED 1U +#define YUNHORN_STS_R4_ENABLED #endif -// TOF VL53LX number -//#define USE_MEMS_ADXL345 -//#define USE_ACCONEER_A111 /* ########################## Product Selection ############################## */ /** * @brief This is the list of Yunhorn STS products to be used in ALL product config @@ -67,7 +64,7 @@ /*#define YUNHORN_STS_O9_ENABLED */ /*#define YUNHORN_STS_O10_ENABLED */ - /*#define YUNHORN_STS_O6_ENABLED */ +/*#define YUNHORN_STS_O6_ENABLED */ /** YUNHORN SMARTOILETS ENVIRONMENT PRODUCTS **/ /*#define YUNHORN_STS_E1_ENABLED */ @@ -87,16 +84,6 @@ /*#define YUNHORN_STS_P6_ENABLED */ /** YUNHORN SMARTOILETS CLEANSING RESOUCES LEVEL PRODUCTS **/ -//#define YUNHORN_STS_R0_ENABLED -//#define YUNHORN_STS_R0_ENABLED -//#define YUNHORN_STS_R2_ENABLED -/*#define YUNHORN_STS_R3_ENABLED */ -/*#define YUNHORN_STS_R4_ENABLED */ - -/*#define YUNHORN_STS_R6_ENABLED */ -/*#define YUNHORN_STS_R7_ENABLED */ -/*#define YUNHORN_STS_R8_ENABLED */ - /** YUNHORN SMARTOILETS MECHNICAL REACTURAL PRODUCTS **/ /*#define YUNHORN_STS_M1_ENABLED */ diff --git a/Core/Inc/yunhorn_sts_sensors.h b/Core/Inc/yunhorn_sts_sensors.h index 234dcbf..e31f297 100644 --- a/Core/Inc/yunhorn_sts_sensors.h +++ b/Core/Inc/yunhorn_sts_sensors.h @@ -196,7 +196,7 @@ typedef struct } STS_R0_SensorDataTypeDef; -#if (defined(YUNHORN_STS_O0_ENABLED) || defined(YUNHORN_STS_O1_ENABLED) || defined(YUNHORN_STS_O2_ENABLED) || defined(YUNHORN_STS_O3_ENABLED) || defined(YUNHORN_STS_O4_ENABLED) || defined(YUNHORN_STS_O5_ENABLED)|| defined(YUNHORN_STS_O6_ENABLED)) + typedef struct { uint8_t lamp_bar_color; /*measured color ID, 0,1,2,3,4,5,6,7,8,9 */ @@ -210,7 +210,7 @@ typedef struct uint8_t dutycycletimelevel; /* level=0,255 */ uint8_t sts_service_mask; /* sts service mask */ } STS_OO_SensorDataTypeDef; -#endif + #ifdef YUNHORN_STS_O6_ENABLED typedef struct diff --git a/Core/Src/sts_cmox_hmac_sha.c b/Core/Src/sts_cmox_hmac_sha.c index 91acbf9..f1e8d53 100644 --- a/Core/Src/sts_cmox_hmac_sha.c +++ b/Core/Src/sts_cmox_hmac_sha.c @@ -34,7 +34,7 @@ hmac_result_t hmac_result; uint32_t sts_hmac_verify(void) { - uint8_t i=0; + uint8_t uid[8]=""; uint32_t ret=0; hmac_result.ac_pass = 60; diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 7810a3d..de3598e 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -787,9 +787,7 @@ static void SendTxData(void) uint8_t batteryLevel = GetBatteryLevel(); //uint16_t batteryLevelmV = SYS_GetBatteryLevel(); //sensor_t sensor_data; -#if (defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)) - STS_R0_SensorDataTypeDef r0_data; -#endif + #if defined(SOAP_LEVEL) STS_R0_SensorDataTypeDef r4_data; #endif @@ -802,23 +800,18 @@ static void SendTxData(void) if (LmHandlerIsBusy() == false) { uint8_t i = 0; - //MX_TOF_Process(); + #ifdef YUNHORN_STS_O5_ENABLED STS_O5_SENSOR_Read(&oo_data); #endif #if defined(SOAP_LEVEL) - STS_YunhornSTSEventP6_Process(); - YUNHORN_STS_R4_SENSOR_Read(&r4_data); -#endif -#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED) - UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0); + //STS_YunhornSTSEventP6_Process(); + UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), CFG_SEQ_Prio_0); - STS_R0_SENSOR_Read(&r0_data); - //r0_data.battery_mV = batteryLevelmV; - r0_data.battery_Pct = (uint8_t)(99*batteryLevel/254); + YUNHORN_STS_R4_SENSOR_Read(&r4_data); + r4_data.battery_Pct = (uint8_t)(99*batteryLevel/254); #endif - //r0_data.battery_Pct = batteryLevel; //(uint8_t)(99*batteryLevel/254); //EnvSensors_Read(&sensor_data); @@ -1013,6 +1006,8 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams) APP_LOG(TS_OFF, VLEVEL_M, "###### U/L FRAME:JOIN | DR:%d | PWR:%d\r\n", joinParams->Datarate, joinParams->TxPower); } + + UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); /* USER CODE END OnJoinRequest_1 */ } diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index 0eb74c2..f27118a 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -40,7 +40,6 @@ diff --git a/TOF/App/app_tof.c b/TOF/App/app_tof.c index 1a1678e..c5c7a9f 100644 --- a/TOF/App/app_tof.c +++ b/TOF/App/app_tof.c @@ -75,10 +75,11 @@ void MX_TOF_Init(void) /* USER CODE END TOF_Init_PreTreatment */ /* Initialize the peripherals and the TOF components */ +#ifdef STS_USE_TOF_VL53L1X APP_LOG(TS_OFF,VLEVEL_L,"\r\n###################### MX TOF Init... \r\n"); XWL55_WLE5_53L0X_Init(); - +#endif //MX_53L1A2_SimpleRanging_Init(); /* USER CODE BEGIN TOF_Init_PostTreatment */ @@ -162,9 +163,10 @@ typedef enum { uint8_t STS_SENSOR_MEMS_Get_ID(uint8_t *mems_Dev_ID) { - uint16_t Id = 0xEEAA; //0xeeaa for VL53L0X uint8_t cnt =0; #if defined(TOF_1)||defined(TOF_2)||defined(TOF_3) + uint16_t Id = 0xEEAA; //0xeeaa for VL53L0X + cnt = sts_tof_vl53l0x_DetectSensors(); if (cnt > 0) @@ -172,6 +174,8 @@ uint8_t STS_SENSOR_MEMS_Get_ID(uint8_t *mems_Dev_ID) mems_Dev_ID[1] = (Id & 0xff); APP_LOG(TS_OFF, VLEVEL_L,"MEMS ID=%02x %02x \r\n", mems_Dev_ID[0],mems_Dev_ID[1]); + + #endif return cnt; }