compact reduce useless code

This commit is contained in:
Yunhorn 2023-06-20 10:29:52 +08:00
parent 014f3ab812
commit dfb3f6b33e
3 changed files with 10 additions and 93 deletions

View File

@ -124,10 +124,10 @@ typedef struct
/* STS_MM operation functions *****************************************************/ /* STS_MM operation functions *****************************************************/
void STS_MOTION_SENSOR_GetValue(void);
void STS_MOTION_SENSOR_SineWaveTest(uint16_t cycles);
void STS_MOTION_SENSOR_Motion_INT(void);
void STS_MOTION_SENSOR_Init(void);
void STS_MOTION_SENSOR_Function_Test_Process(int16_t *sampled_freq, uint8_t count); void STS_MOTION_SENSOR_Function_Test_Process(int16_t *sampled_freq, uint8_t count);
void STS_MOTION_SENSOR_WakeUp_Process(void); void STS_MOTION_SENSOR_WakeUp_Process(void);
void STS_MOTION_SENSOR_WakeUp_Process_Sampling(void); void STS_MOTION_SENSOR_WakeUp_Process_Sampling(void);
@ -144,12 +144,15 @@ int32_t STS_MOTION_SENSOR_Set_Sleep_Duration(uint8_t Duration);
void STS_MOTION_SENSOR_Enable_Wake_Up_Detection(void); void STS_MOTION_SENSOR_Enable_Wake_Up_Detection(void);
void STS_MOTION_SENSOR_Disable_Wake_Up_Detection(void); void STS_MOTION_SENSOR_Disable_Wake_Up_Detection(void);
void STS_MOTION_SENSOR_ACT_INACT_DURATION_Init(); void STS_MOTION_SENSOR_ACT_INACT_DURATION_Init();
void STS_M7_GetValue(void);
void STS_MOTION_SENSOR_Motion_INT(void);
void STS_MOTION_SENSOR_Init(void);
void STS_MOTION_SENSOR_GetValue(void);
void STS_SENSOR_Power_ON(uint8_t cnt); void STS_SENSOR_Power_ON(uint8_t cnt);
void STS_SENSOR_Power_OFF(uint8_t cnt); void STS_SENSOR_Power_OFF(uint8_t cnt);
void STS_SENSOR_MEMS_Reset(uint8_t cnt); void STS_SENSOR_MEMS_Reset(uint8_t cnt);
uint8_t STS_SENSOR_MEMS_Get_ID(uint8_t *devID);
/** /**
* @} * @}

View File

@ -54,63 +54,6 @@ enum {
}; };
#endif #endif
#if (defined(YUNHORN_STS_M0_ENABLED) || defined(YUNHORN_STS_M1_ENABLED) || defined(YUNHORN_STS_M2_ENABLED) || defined(YUNHORN_STS_M5_ENABLED))
typedef struct
{
uint16_t distance_mm; /*measured distance in mm, min=0mm, max=2500mm. */
uint16_t battery_mV; /*mV, 1000mv-5000mv, regular 3300mV - 3600mV --4200mV */
/* leakage detection */
uint8_t leakage_event; /* 1: leakage detected, 0: no leakage detected */
uint8_t leakage_cable_position; /* distance level 0-255 from starting point to length of cable */
uint8_t leakage_measure_mode; /* 0: point, 1: cable/distance/level */
/* closestool clogging detection */
uint8_t clogging_state; /* 0: no clogging, 1: clogging */
uint8_t clogging_duration_level; /* 0-255 duration level time in min. */
uint16_t clogging_level_distance_mm; /* from measure point to measured clogging level, in mm*/
/* water flow measure */
uint16_t water_pulse_count; /* water flow count within counting interval 0-255 */
uint8_t water_pipe_diameter_dn; /* DN number DN20--4", DN25--6", DN30--8" */
uint8_t water_count_interval; /* in minutes 10 min by default */
/* power relay */
uint8_t break_on_off; /* 0: off, 1: on */
uint8_t channel_num_mask; /* 0000 0000 = 0x00, 0xff, 0-7, 8 channels max */
/* DI, DO digital input output */
uint8_t di_do_channel_mask; /* 0000 0000 = 0x00, 0xff, 0-7, 8 channels max */
/* Vibration sensor */
uint8_t vibration_on_off; /* 0: off, 1: on */
uint8_t vibration_threshold_level; /* 0 -255 */
uint16_t vb_x_freq; /* max vibration freq in x axis */
uint16_t vb_y_freq; /* max vibration freq in y axis */
uint16_t vb_z_freq; /* max vibration freq in z axis */
uint16_t vb_x_rms; /* max vibration rms in x axis */
uint16_t vb_y_rms; /* max vibration rms in y axis */
uint16_t vb_z_rms; /* max vibration rms in z axis */
/* ventilation fan */
uint8_t swing_state; /* 1: swing, 0: no swing */
uint8_t speed_level; /* 0: off, speed 1, 2, 3 min max , 4:local remote control released */
uint8_t distance_mm_h; /*MSB */
uint8_t distance_mm_l; /*LSB max=255 mm for short range measure */
uint8_t battery_Pct; /* % of battery two digits, 88% (00-99)% */
uint8_t dutycycletimelevel; /* level=0,255 */
} STS_M0_SensorDataTypeDef;
#endif
/* USER CODE BEGIN ET */ /* USER CODE BEGIN ET */
@ -174,39 +117,10 @@ void STS_REBOOT_CONFIG_Init(void);
*/ */
void OnRestoreSTSCFGContextProcess(void); void OnRestoreSTSCFGContextProcess(void);
/**
* @brief Read duty cycle level count from flash
*/
//uint8_t * read_duty_cycle_level_from_flash(uint8_t *flash_code_duty_cycle_level, uint32_t Save_Config_Flash_Addr);
#ifdef USE_OLED_SSD1306
void yunhorn_smartoilets_mini_display_splash(char *prd_name);
void yunhorn_banner(char *s1, char *s2, char *s3);
#endif
void STS_MOTION_SENSOR_Power_ON(void);
void STS_MOTION_SENSOR_Power_OFF(void);
void STS_SENSOR_Upload_Config_Invalid_Message(void); void STS_SENSOR_Upload_Config_Invalid_Message(void);
void STS_SENSOR_Upload_Message(uint8_t appDataPort, uint8_t appBufferSize, char *appDataBuffer); void STS_SENSOR_Upload_Message(uint8_t appDataPort, uint8_t appBufferSize, char *appDataBuffer);
void STS_SENSOR_Auto_Responder_Process(uint8_t tlv_ver,uint8_t tlv_type, uint8_t tlv_length, uint8_t *tlv_content); void STS_SENSOR_Auto_Responder_Process(uint8_t tlv_ver,uint8_t tlv_type, uint8_t tlv_length, uint8_t *tlv_content);
uint8_t STS_SENSOR_MEMS_Get_ID(uint8_t *devID);
void STS_M7_GetValue(void);
void STS_M7_SineWaveTest(uint16_t cycles);
void STS_M7_Motion_INT(void);
void STS_MOTION_SENSOR_Init(void);
void STS_MOTION_SENSOR_Disable_Wake_Up_Detection(void);
int32_t STS_MOTION_SENSOR_Set_Wake_Up_Threshold(uint8_t Threshold);
int32_t STS_MOTION_SENSOR_Set_Wake_Up_Duration(uint8_t Duration);
int32_t STS_MOTION_SENSOR_Enable_Inactivity_Detection(STS_MOTION_SENSOR_IntPin_t IntPin);
int32_t STS_MOTION_SENSOR_Disable_Inactivity_Detection(void);
int32_t STS_MOTION_SENSOR_Set_Sleep_Duration(uint8_t Duration);
void STS_MOTION_SENSOR_Get_Event_Status(STS_MOTION_SENSOR_Event_Status_t *Status);
void STS_MOTION_SENSOR_Enable_Wake_Up_Detection(void);
void STS_MOTION_SENSOR_Initialization(void);
void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size); void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size);
void STS_SENSOR_Function_Test_Process(void); void STS_SENSOR_Function_Test_Process(void);

View File

@ -100,7 +100,7 @@ void PWR_EnterStopMode(void)
LL_PWR_ClearFlag_C1STOP_C1STB(); LL_PWR_ClearFlag_C1STOP_C1STB();
/* USER CODE BEGIN EnterStopMode_2 */ /* USER CODE BEGIN EnterStopMode_2 */
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
/* USER CODE END EnterStopMode_2 */ /* USER CODE END EnterStopMode_2 */
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI); HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
/* USER CODE BEGIN EnterStopMode_3 */ /* USER CODE BEGIN EnterStopMode_3 */