minor changes

This commit is contained in:
Yunhorn 2024-08-06 13:11:34 +08:00
parent e990164543
commit 07307fbb90
2 changed files with 26 additions and 9 deletions

View File

@ -223,9 +223,17 @@ void STS_YunhornSTSEventRFAC_Process(void)
void STS_YunhornSTSEventP1_Process(void)
{
sts_reed_hall_1_result = HALL1_STATE; //sts_hall1_read;
if (sts_reed_hall_1_result != last_sts_reed_hall_1_result)
{
sts_reed_hall_changed_flag = TRUE;
}
last_sts_reed_hall_1_result = sts_reed_hall_1_result;
sts_reed_hall_2_result = HALL2_STATE;// sts_hall2_read;
if (sts_reed_hall_2_result != last_sts_reed_hall_2_result)
{
sts_reed_hall_changed_flag = TRUE;
}
last_sts_reed_hall_2_result = sts_reed_hall_2_result;
STS_Combined_Status_Processing();
@ -463,8 +471,11 @@ void STS_Combined_Status_Processing(void)
break;
case STS_REEDSWITCH_MODE:
sts_status_color = (sts_reed_hall_result == STS_Status_Door_Open )? STS_GREEN: STS_RED;
sts_status_color = (sts_reed_hall_1_result == STS_Status_Door_Open )? STS_GREEN: STS_RED;
if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
{
sts_status_color = STS_RED_BLUE;
}
break;
case STS_RSS_MODE:
if (sts_rss_result == STS_RESULT_NO_MOTION){
@ -614,8 +625,8 @@ void STS_Combined_Status_Processing(void)
if ((sts_rss_result_changed_flag)|| (sts_reed_hall_changed_flag))
{
//sts_rss_result_changed_flag =0;
//sts_reed_hall_changed_flag =0;
sts_rss_result_changed_flag =0;
sts_reed_hall_changed_flag =0;
//sts_tof_result_changed_flag =0;
sensor_data_ready = 1;
//STS_PRESENCE_SENSOR_Prepare_Send_Data();

View File

@ -903,9 +903,11 @@ static void SendTxData(void)
{
AppData.Port = (uint8_t)YUNHORN_STS_O6_LORA_APP_DATA_PORT;
} else if (sts_work_mode == STS_UNI_MODE) {
} else if (sts_work_mode == STS_UNI_MODE)
{
AppData.Port = (uint8_t)YUNHORN_STS_O7_LORA_APP_DATA_PORT;
} else if (sts_work_mode == STS_RSS_MODE) {
} else if ((sts_work_mode == STS_RSS_MODE)||(sts_work_mode == STS_REEDSWITCH_MODE))
{
AppData.Port = (uint8_t)YUNHORN_STS_O2_LORA_APP_DATA_PORT;
}
@ -918,7 +920,7 @@ static void SendTxData(void)
AppData.Port = (uint8_t)YUNHORN_STS_O6_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1;
else if (sts_work_mode == STS_UNI_MODE)
AppData.Port = (uint8_t)YUNHORN_STS_O7_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1;
else if (sts_work_mode == STS_RSS_MODE)
else if ((sts_work_mode == STS_RSS_MODE)||(sts_work_mode == STS_REEDSWITCH_MODE))
AppData.Port = (uint8_t)YUNHORN_STS_O2_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1;
//AppData.Port = (uint8_t)sts_sendhtbtport; //LORAWAN_USER_APP_PORT+1;
@ -929,14 +931,18 @@ static void SendTxData(void)
} else if ((sensor_data_ready!= 0U)) //sensor_data_ready for manual push button-1 trigger)
{
sensor_data_ready =0;
if (sts_work_mode != STS_RSS_MODE) // keep compatible with previous version, PIXEL-NETWORK
if (sts_work_mode > STS_RSS_MODE) // keep compatible with previous version, PIXEL-NETWORK
{
AppData.Buffer[i++] = (uint8_t)(AppLedStateOn|0x80)&0x0ff; //00 ************ MUST KEEP IT HERE, NON-ZERO ******
}
AppData.Buffer[i++] = (uint8_t)(sensorData.lamp_bar_color)&0xff; //01
AppData.Buffer[i++] = (uint8_t)(sensorData.workmode)&0xff; //02 WORK MODE
if (sts_work_mode == STS_RSS_MODE)
if (sts_work_mode == STS_REEDSWITCH_MODE)
{
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status reed switch
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor2_on_off)&0xff; //04 Sensor head #2 status reed switch
} else if (sts_work_mode == STS_RSS_MODE)
{
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status reed switch
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor3_on_off)&0xff; //04 Sensor head #3 status RSS motion