From 07307fbb903fb47d21a817f8846ea03fc7a6f7c3 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Tue, 6 Aug 2024 13:11:34 +0800 Subject: [PATCH] minor changes --- Core/Src/yunhorn_sts_process.c | 19 +++++++++++++++---- LoRaWAN/App/lora_app.c | 16 +++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index d348138..6931ddd 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -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(); diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index ef668bd..4fa8ebb 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -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