minor improve

This commit is contained in:
Yunhorn 2024-03-08 11:10:28 +08:00
parent 1e9ec8d4d2
commit bb20be347e
6 changed files with 19 additions and 34 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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;

View File

@ -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 */
}

View File

@ -40,7 +40,6 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.2089215826" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="CORE_CM4"/>
<listOptionValue builtIn="false" value="YUNHORN_STS_RANDOM"/>
<listOptionValue builtIn="false" value="TOF_1"/>
<listOptionValue builtIn="false" value="STM32WLE5xx"/>
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
</option>

View File

@ -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;
}