From 08fa70857efc663293682caf271a0fe0009f843a Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Fri, 31 May 2024 16:03:08 +0800 Subject: [PATCH] revised over stay state --- Core/Inc/yunhorn_sts_sensors.h | 2 +- Core/Src/yunhorn_sts_process.c | 10 +++++----- LoRaWAN/App/lora_app.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Core/Inc/yunhorn_sts_sensors.h b/Core/Inc/yunhorn_sts_sensors.h index b1d06bf..ea279af 100644 --- a/Core/Inc/yunhorn_sts_sensors.h +++ b/Core/Inc/yunhorn_sts_sensors.h @@ -177,7 +177,7 @@ typedef struct STS_OO_SensorStatusDataTypeDef uint8_t fall_state; // FALL DETECION NONE, FALL DOWN, RISE UP, LAYDOWN_STILL uint8_t fall_speed; // speed of fall down measure uint8_t fall_gravity; // gravity of fall down measure - uint8_t overtime; // occupancy over time or not 0:1 + uint8_t over_stay_state; // occupancy over time or not 0:1 uint16_t over_stay_duration; // time lenght of overstay in seconds uint8_t battery_Pct; /* % of battery two digits, 88% (00-99)% */ uint8_t dutycycletimelevel; /* level=0,255 */ diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index 07fbedf..b5b122c 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -195,7 +195,7 @@ void STS_YunhornSTSEventRFAC_Process(void) if ((rfac_timer >= STS_BURN_IN_RFAC) && (rfac_timer < (STS_BURN_IN_RFAC +3))) { APP_LOG(TS_OFF, VLEVEL_M, "\r\n -------------------RFAC Process\r\n"); - STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, 4, "RFAC"); + STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, 4, (uint8_t *)"RFAC"); } if ((rfac_timer > (STS_BURN_IN_RFAC + 2))) { @@ -514,7 +514,7 @@ void STS_PRESENCE_SENSOR_Init_Send_Data(void) sts_o7_sensorData.fall_gravity = 0x0; sts_o7_sensorData.event_start_time = 0x0; sts_o7_sensorData.event_stop_time = 0x0; - sts_o7_sensorData.overtime = 0x0; + sts_o7_sensorData.over_stay_state = 0x0; sts_o7_sensorData.over_stay_duration = 0x0; sts_o7_sensorData.unconcious_state = 0x0; sts_o7_sensorData.unconcious_duration = 0x0; @@ -569,7 +569,7 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso { APP_LOG(TS_OFF, VLEVEL_M, "\r\n......OVER STAY............\r\n"); sts_occupancy_overtime_state = 1U; - sensor_data->overtime = sts_occupancy_overtime_state; + sensor_data->over_stay_state = sts_occupancy_overtime_state; sensor_data->over_stay_duration = check_time_tmp; sts_status_color = STS_RED_BLUE; @@ -601,7 +601,7 @@ void STS_PRESENCE_SENSOR_Read(STS_OO_SensorStatusDataTypeDef *oo_data) oo_data->fall_state = (uint8_t)sts_o7_sensorData.fall_state; oo_data->event_start_time = (uint32_t)sts_o7_sensorData.event_start_time; oo_data->event_stop_time = (uint32_t)sts_o7_sensorData.event_stop_time; - oo_data->overtime = (uint8_t)sts_o7_sensorData.overtime; + oo_data->over_stay_state = (uint8_t)sts_o7_sensorData.over_stay_state; oo_data->over_stay_duration = (uint16_t)sts_o7_sensorData.over_stay_duration; oo_data->battery_Pct = (uint8_t)sts_o7_sensorData.battery_Pct; @@ -627,7 +627,7 @@ void STS_PRESENCE_SENSOR_Init(void) sts_o7_sensorData.dutycycletimelevel = 1; sts_o7_sensorData.event_start_time = 0; sts_o7_sensorData.event_stop_time = 0; - sts_o7_sensorData.overtime = 0; + sts_o7_sensorData.over_stay_state = 0; sts_o7_sensorData.over_stay_duration = 0; STS_SENSOR_Power_ON(0); diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index f76f4ed..605a208 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -852,7 +852,7 @@ static void SendTxData(void) #if 1 AppData.Buffer[i++] = (uint8_t)(sensorData.unconcious_state)&0xff; //11 unconcious state detected or not AppData.Buffer[i++] = (uint8_t)(sensorData.fall_state)&0xff; //12 fall detected or not - AppData.Buffer[i++] = (uint8_t)(sensorData.overtime)&0xff; //13 occupancy over time or not + AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_state)&0xff; //13 occupancy over time or not AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration>>8)&0xff; //14 occupancy over time or not AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration)&0xff; //15 occupancy over time or not #endif @@ -962,6 +962,7 @@ static void OnJoinTimerLedEvent(void *context) #ifndef STM32WLE5xx HAL_GPIO_TogglePin(LED3_GPIO_Port, LED3_Pin); /* LED_RED */ #endif + HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin); /* STS GREEN */ if ((sts_work_mode != STS_WIRED_MODE)) UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), CFG_SEQ_Prio_0); }