minor revise
This commit is contained in:
parent
8d13b6cb6d
commit
9edfa3c816
|
@ -130,7 +130,7 @@ void Error_Handler(void);
|
||||||
*/
|
*/
|
||||||
#define STS_LAMP_BAR_PWM_TIM_PERIOD (60 - 1)
|
#define STS_LAMP_BAR_PWM_TIM_PERIOD (60 - 1)
|
||||||
#define STS_LAMP_BAR_HTIM htim1
|
#define STS_LAMP_BAR_HTIM htim1
|
||||||
#define STS_LAMP_BAR_LED_NUM (50)
|
#define STS_LAMP_BAR_LED_NUM (7) //50
|
||||||
|
|
||||||
#define WSDATA_PORT_PIN_PA8
|
#define WSDATA_PORT_PIN_PA8
|
||||||
//#define WSDATA_PORT_PIN_PA9
|
//#define WSDATA_PORT_PIN_PA9
|
||||||
|
|
|
@ -439,8 +439,11 @@
|
||||||
// #define LORAWAN_NVM_BASE_ADDRESS ((uint32_t)0x0803F000UL)
|
// #define LORAWAN_NVM_BASE_ADDRESS ((uint32_t)0x0803F000UL)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SYSTEM QA/TESTING PARAMETERS DEFINES
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define QA_OVERSTAY_DURATION_THRESHOLD 1 //1 min
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,7 +555,7 @@ enum nvm_order {
|
||||||
NVM_S_UNIT, // 7
|
NVM_S_UNIT, // 7
|
||||||
NVM_WORK_MODE, // 8
|
NVM_WORK_MODE, // 8
|
||||||
NVM_SERVICE_MASK, // 9
|
NVM_SERVICE_MASK, // 9
|
||||||
NVM_RESERVE01, //10
|
NVM_IOC_MASK, //10
|
||||||
NVM_LEN, //11, 32=0x20
|
NVM_LEN, //11, 32=0x20
|
||||||
NVM_CFG_START=12, //12, p[0] bytes for configs,
|
NVM_CFG_START=12, //12, p[0] bytes for configs,
|
||||||
//13, p[1]
|
//13, p[1]
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define ONE_PULSE (36)
|
#define ONE_PULSE (36)
|
||||||
#define ZERO_PULSE (20)
|
#define ZERO_PULSE (20)
|
||||||
|
|
||||||
#define LED_DATA_LEN (24)
|
#define LED_DATA_LEN 24
|
||||||
#define WS2812B_DATA_LEN (LED_DATA_LEN * (STS_LAMP_BAR_LED_NUM+4))
|
#define WS2812B_DATA_LEN (LED_DATA_LEN * (STS_LAMP_BAR_LED_NUM+4))
|
||||||
//#define DEFAULT_LUMINANCE_LEVEL (30)
|
//#define DEFAULT_LUMINANCE_LEVEL (30)
|
||||||
#define RESET_PULSE (10) //(80) TO FIX DARK_COLOR AND SM2
|
#define RESET_PULSE (10) //(80) TO FIX DARK_COLOR AND SM2
|
||||||
|
@ -103,7 +103,7 @@ void STS_WS2812B_Refresh(void)
|
||||||
{
|
{
|
||||||
HAL_TIM_PWM_Start_DMA(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL, (uint32_t *)&rgb_buf, (RESET_PULSE+WS2812B_DATA_LEN+1));
|
HAL_TIM_PWM_Start_DMA(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL, (uint32_t *)&rgb_buf, (RESET_PULSE+WS2812B_DATA_LEN+1));
|
||||||
|
|
||||||
//HAL_TIM_PWM_Start_IT(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL);
|
HAL_TIM_PWM_Start_IT(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void STS_Lamp_Bar_Init(void)
|
void STS_Lamp_Bar_Init(void)
|
||||||
|
|
|
@ -554,7 +554,7 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso
|
||||||
sensor_data->unconscious_duration = sts_o7_sensorData.event_sensor3_unconcious_duration;
|
sensor_data->unconscious_duration = sts_o7_sensorData.event_sensor3_unconcious_duration;
|
||||||
sensor_data->no_movement_duration = sts_o7_sensorData.event_sensor3_no_movement_duration;
|
sensor_data->no_movement_duration = sts_o7_sensorData.event_sensor3_no_movement_duration;
|
||||||
|
|
||||||
APP_LOG(TS_OFF,VLEVEL_L,"\r\n ... Over Stay Duration=%u Sec\r\n", sensor_data->over_stay_duration);
|
APP_LOG(TS_OFF,VLEVEL_L,"\r\n ... Over Stay Duration = %u Sec [Threshold: %u Seconds]\r\n", sensor_data->over_stay_duration, sts_occupancy_overtime_threshold_in_10min*60);
|
||||||
|
|
||||||
sensor_data->fall_state = sts_fall_rising_detected_result;
|
sensor_data->fall_state = sts_fall_rising_detected_result;
|
||||||
if (sts_fall_rising_detected_result == STS_PRESENCE_FALL)
|
if (sts_fall_rising_detected_result == STS_PRESENCE_FALL)
|
||||||
|
|
|
@ -1160,14 +1160,21 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
||||||
sts_o7_sensorData.event_sensor1_duration = 0;
|
sts_o7_sensorData.event_sensor1_duration = 0;
|
||||||
sts_o7_sensorData.over_stay_state = 0;
|
sts_o7_sensorData.over_stay_state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
//if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
||||||
if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*60) //for debug
|
if (sts_o7_sensorData.event_sensor1_duration > (sts_occupancy_overtime_threshold_in_10min*60)) //for debug
|
||||||
{
|
{
|
||||||
sts_o7_sensorData.over_stay_state = 1;
|
sts_o7_sensorData.over_stay_state = 1;
|
||||||
sts_o7_sensorData.over_stay_duration = sts_o7_sensorData.event_sensor1_duration;
|
sts_o7_sensorData.over_stay_duration = sts_o7_sensorData.event_sensor1_duration;
|
||||||
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\nSensor 1 Over Stay = %d Sec \r\n", (sts_o7_sensorData.over_stay_duration));
|
APP_LOG(TS_OFF, VLEVEL_L, "\r\nSensor 1 Over Stay State=%d, Duration= %d Sec, Threshold =%u \r\n", sts_o7_sensorData.over_stay_state,(sts_o7_sensorData.over_stay_duration),(sts_occupancy_overtime_threshold_in_10min*60) );
|
||||||
|
sts_lamp_bar_color = STS_RED_DARK;
|
||||||
|
sts_lamp_bar_flashing_color = 0x20;
|
||||||
|
//volatile uint8_t sts_lamp_bar_color = STS_GREEN; //puColor
|
||||||
|
//volatile uint8_t sts_lamp_bar_flashing_color = 0x23; // RED_BLUE;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
sts_o7_sensorData.over_stay_state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// to be defined later for SOS threshold TODO XXXX
|
// to be defined later for SOS threshold TODO XXXX
|
||||||
|
@ -1176,7 +1183,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
||||||
sts_o7_sensorData.event_sensor2_duration = current_time.Seconds - sts_o7_sensorData.event_sensor2_start_time;
|
sts_o7_sensorData.event_sensor2_duration = current_time.Seconds - sts_o7_sensorData.event_sensor2_start_time;
|
||||||
} else {
|
} else {
|
||||||
sts_o7_sensorData.event_sensor2_duration =0;
|
sts_o7_sensorData.event_sensor2_duration =0;
|
||||||
sts_o7_sensorData.over_stay_state = 0;
|
//sts_o7_sensorData.over_stay_state = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
//if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
//if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
||||||
|
@ -1991,7 +1998,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
||||||
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_S_UNIT]; //Heart-beat or SAMPLING Periodicity unit
|
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_S_UNIT]; //Heart-beat or SAMPLING Periodicity unit
|
||||||
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_WORK_MODE]; // STS WORK MODE
|
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_WORK_MODE]; // STS WORK MODE
|
||||||
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_SERVICE_MASK]; //service mask
|
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_SERVICE_MASK]; //service mask
|
||||||
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_RESERVE01]; //service mask
|
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_IOC_MASK]; //sts ioc mask
|
||||||
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_LEN]; //length of following cfg value
|
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_LEN]; //length of following cfg value
|
||||||
|
|
||||||
for (uint8_t j=0; j < cfg_in_nvm[NVM_LEN]; j++) {
|
for (uint8_t j=0; j < cfg_in_nvm[NVM_LEN]; j++) {
|
||||||
|
@ -2170,9 +2177,10 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
||||||
invalid_flag = 0;
|
invalid_flag = 0;
|
||||||
|
|
||||||
sts_work_mode = (uint8_t)(tlv_buf[CFG_CMD4] - 0x30);
|
sts_work_mode = (uint8_t)(tlv_buf[CFG_CMD4] - 0x30);
|
||||||
if (sts_work_mode == STS_NETWORK_MODE) { //network mode
|
if (sts_work_mode == STS_NETWORK_MODE)
|
||||||
|
{ //network mode
|
||||||
sts_cloud_netcolor = (uint8_t)(tlv_buf[CFG_CMD5]-0x30);
|
sts_cloud_netcolor = (uint8_t)(tlv_buf[CFG_CMD5]-0x30);
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Cloud Color Set to %d \r\n",sts_cloud_netcolor);
|
APP_LOG(TS_OFF, VLEVEL_L, "\r\n Cloud Color Set to %u \r\n", sts_cloud_netcolor);
|
||||||
}
|
}
|
||||||
sts_service_mask = STS_SERVICE_MASK_L0;
|
sts_service_mask = STS_SERVICE_MASK_L0;
|
||||||
sts_lamp_bar_color = sts_cloud_netcolor;
|
sts_lamp_bar_color = sts_cloud_netcolor;
|
||||||
|
@ -2188,6 +2196,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
||||||
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD5];
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD5];
|
||||||
|
|
||||||
STS_Combined_Status_Processing();
|
STS_Combined_Status_Processing();
|
||||||
|
|
||||||
} else if (tlv_buf_size == 8 && tlv_buf[CFG_CMD4]=='F') // Change fall detection
|
} else if (tlv_buf_size == 8 && tlv_buf[CFG_CMD4]=='F') // Change fall detection
|
||||||
{
|
{
|
||||||
invalid_flag = 0; // P 1 1 F A B C D
|
invalid_flag = 0; // P 1 1 F A B C D
|
||||||
|
@ -2544,7 +2553,7 @@ void OnStoreSTSCFGContextRequest(void)
|
||||||
nvm_store_value[i++] = sts_cfg_nvm.s_unit;
|
nvm_store_value[i++] = sts_cfg_nvm.s_unit;
|
||||||
nvm_store_value[i++] = sts_cfg_nvm.work_mode;
|
nvm_store_value[i++] = sts_cfg_nvm.work_mode;
|
||||||
nvm_store_value[i++] = sts_cfg_nvm.sts_service_mask;
|
nvm_store_value[i++] = sts_cfg_nvm.sts_service_mask;
|
||||||
nvm_store_value[i++] = sts_cfg_nvm.reseve01;
|
nvm_store_value[i++] = sts_cfg_nvm.sts_ioc_mask;
|
||||||
nvm_store_value[i++] = (uint8_t) STS_O7_NVM_CFG_SIZE; //sts_cfg_nvm.length;
|
nvm_store_value[i++] = (uint8_t) STS_O7_NVM_CFG_SIZE; //sts_cfg_nvm.length;
|
||||||
|
|
||||||
for (j = 0; j < STS_O7_CFG_PCFG_SIZE; j++) {
|
for (j = 0; j < STS_O7_CFG_PCFG_SIZE; j++) {
|
||||||
|
@ -2631,7 +2640,7 @@ void STS_REBOOT_CONFIG_Init(void)
|
||||||
sts_cfg_nvm.s_unit = (uint8_t)(nvm_stored_value[NVM_S_UNIT]);
|
sts_cfg_nvm.s_unit = (uint8_t)(nvm_stored_value[NVM_S_UNIT]);
|
||||||
sts_cfg_nvm.work_mode = (uint8_t)(nvm_stored_value[NVM_WORK_MODE]);
|
sts_cfg_nvm.work_mode = (uint8_t)(nvm_stored_value[NVM_WORK_MODE]);
|
||||||
sts_cfg_nvm.sts_service_mask = (uint8_t)(nvm_stored_value[NVM_SERVICE_MASK]);
|
sts_cfg_nvm.sts_service_mask = (uint8_t)(nvm_stored_value[NVM_SERVICE_MASK]);
|
||||||
sts_cfg_nvm.reseve01 = (uint8_t)(nvm_stored_value[NVM_RESERVE01]);
|
sts_cfg_nvm.sts_ioc_mask = (uint8_t)(nvm_stored_value[NVM_IOC_MASK]);
|
||||||
sts_cfg_nvm.length = (uint8_t)(nvm_stored_value[NVM_LEN]&0x3F); //MAX 32 bytes
|
sts_cfg_nvm.length = (uint8_t)(nvm_stored_value[NVM_LEN]&0x3F); //MAX 32 bytes
|
||||||
|
|
||||||
for (uint8_t j=0; j< STS_O7_CFG_PCFG_SIZE; j++) { // P RSS CONFIG SIZE= 20U
|
for (uint8_t j=0; j< STS_O7_CFG_PCFG_SIZE; j++) { // P RSS CONFIG SIZE= 20U
|
||||||
|
|
Loading…
Reference in New Issue