good fall state =0 after door open, PIR no upload

This commit is contained in:
Yunhorn 2025-04-18 12:32:22 +08:00
parent 9ecfa78e6b
commit 0359d7acac
4 changed files with 56 additions and 54 deletions

View File

@ -766,8 +766,9 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
#endif #endif
if (sts_pir_read != last_sts_pir_read) if (sts_pir_read != last_sts_pir_read)
{ {
last_sts_pir_read = sts_hall3_read; last_sts_pir_read = sts_pir_read;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); // disable PIR status upload 2025 04 18
// UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
} }
break; break;
@ -991,7 +992,7 @@ static void SendTxData(void)
#elif defined(STS_M1) #elif defined(STS_M1)
sts_r_sensor_data_t sts_m1_sensor_data={0}; sts_r_sensor_data_t sts_m1_sensor_data={0};
#elif defined(STS_L8) #elif defined(STS_L8)
sts_fhmos_sensor_data_t fhmos_data={0}; sts_fhmos_sensor_data_t fhmos_info={0};
#elif defined(STS_XX) #elif defined(STS_XX)
#endif #endif
@ -1026,7 +1027,7 @@ static void SendTxData(void)
#endif #endif
#ifdef STS_L8 #ifdef STS_L8
STS_FHMOS_sensor_read(&fhmos_data); STS_FHMOS_sensor_read(&fhmos_info);
#endif #endif
#ifdef VL53LX #ifdef VL53LX
@ -1198,33 +1199,33 @@ static void SendTxData(void)
#if defined(L8) #if defined(L8)
//AppData.Buffer[i++] = 4; //AppData.Buffer[i++] = 4;
#if 0 #if 0
if ((fhmos_data.state_fall ==3)||(fhmos_data.state_occupancy ==3)||(fhmos_data.state_human_movement ==3)) if ((fhmos_info.state_fall ==3)||(fhmos_info.state_occupancy ==3)||(fhmos_info.state_human_movement ==3))
{ {
AppData.Buffer[i++] = 10; AppData.Buffer[i++] = 10;
AppData.Buffer[i++] = 0x04; // payload type, 0x01= regular payload AppData.Buffer[i++] = 0x04; // payload type, 0x01= regular payload
AppData.Buffer[i++] = fhmos_data.state_fall; AppData.Buffer[i++] = fhmos_info.state_fall;
AppData.Buffer[i++] = fhmos_data.state_human_movement; AppData.Buffer[i++] = fhmos_info.state_human_movement;
AppData.Buffer[i++] = fhmos_data.state_occupancy; AppData.Buffer[i++] = fhmos_info.state_occupancy;
AppData.Buffer[i++] = fhmos_data.state_sos_alarm; AppData.Buffer[i++] = fhmos_info.state_sos_alarm;
AppData.Buffer[i++] = fhmos_data.lamp_bar_color; AppData.Buffer[i++] = fhmos_info.lamp_bar_color;
if (fhmos_data.state_fall ==3) if (fhmos_info.state_fall ==3)
{ {
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_fall_confirmed>>24); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_fall_confirmed>>24);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_fall_confirmed>>16); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_fall_confirmed>>16);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_fall_confirmed>>8); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_fall_confirmed>>8);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_fall_confirmed); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_fall_confirmed);
} else if (fhmos_data.state_occupancy ==3){ } else if (fhmos_info.state_occupancy ==3){
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_overstay_confirmed>>24); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_overstay_confirmed>>24);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_overstay_confirmed>>16); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_overstay_confirmed>>16);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_overstay_confirmed>>8); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_overstay_confirmed>>8);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_overstay_confirmed); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_overstay_confirmed);
} else if (fhmos_data.state_human_movement ==3) } else if (fhmos_info.state_human_movement ==3)
{ {
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_motionless_confirmed>>24); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_motionless_confirmed>>24);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_motionless_confirmed>>16); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_motionless_confirmed>>16);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_motionless_confirmed>>8); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_motionless_confirmed>>8);
AppData.Buffer[i++] = 0xff&(fhmos_data.time_stamp_motionless_confirmed); AppData.Buffer[i++] = 0xff&(fhmos_info.time_stamp_motionless_confirmed);
} }
} else } else
@ -1233,38 +1234,38 @@ static void SendTxData(void)
AppData.Buffer[i++] = 9; AppData.Buffer[i++] = 9;
AppData.Buffer[i++] = 0x01; AppData.Buffer[i++] = 0x01;
AppData.Buffer[i++] = fhmos_data.state_fall; AppData.Buffer[i++] = fhmos_info.state_fall;
AppData.Buffer[i++] = fhmos_data.state_human_movement; AppData.Buffer[i++] = fhmos_info.state_human_movement;
AppData.Buffer[i++] = fhmos_data.state_occupancy; AppData.Buffer[i++] = fhmos_info.state_occupancy;
AppData.Buffer[i++] = fhmos_data.state_sos_alarm; AppData.Buffer[i++] = fhmos_info.state_sos_alarm;
AppData.Buffer[i++] = fhmos_data.lamp_bar_color; AppData.Buffer[i++] = fhmos_info.lamp_bar_color;
AppData.Buffer[i++] = fhmos_data.state_hall_1; AppData.Buffer[i++] = fhmos_info.state_hall_1;
AppData.Buffer[i++] = fhmos_data.state_hall_2; AppData.Buffer[i++] = fhmos_info.state_hall_2;
AppData.Buffer[i++] = fhmos_data.state_PIR; AppData.Buffer[i++] = fhmos_info.state_PIR;
if (fhmos_data.state_fall_released == 1) if (fhmos_info.state_fall_released == 1)
{ {
fhmos_data.state_fall_released = 0; fhmos_info.state_fall_released = 0;
AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_data.time_stamp_fall_confirmed>>24); AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_info.time_stamp_fall_confirmed>>24);
AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_data.time_stamp_fall_confirmed>>16); AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_info.time_stamp_fall_confirmed>>16);
AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_data.time_stamp_fall_confirmed>>8); AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_info.time_stamp_fall_confirmed>>8);
AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_data.time_stamp_fall_confirmed); AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_info.time_stamp_fall_confirmed);
} }
} }
// AppData.Buffer[i++] = 0x01; // payload type, 0x01= regular payload // AppData.Buffer[i++] = 0x01; // payload type, 0x01= regular payload
#if 0 #if 0
AppData.Buffer[i++] = fhmos_data.state_fall; AppData.Buffer[i++] = fhmos_info.state_fall;
AppData.Buffer[i++] = fhmos_data.state_human_movement; AppData.Buffer[i++] = fhmos_info.state_human_movement;
AppData.Buffer[i++] = fhmos_data.state_occupancy; AppData.Buffer[i++] = fhmos_info.state_occupancy;
AppData.Buffer[i++] = fhmos_data.state_sos_alarm; AppData.Buffer[i++] = fhmos_info.state_sos_alarm;
AppData.Buffer[i++] = fhmos_data.lamp_bar_color; AppData.Buffer[i++] = fhmos_info.lamp_bar_color;
AppData.Buffer[i++] = fhmos_data.state_hall_1; AppData.Buffer[i++] = fhmos_info.state_hall_1;
AppData.Buffer[i++] = fhmos_data.state_hall_2; AppData.Buffer[i++] = fhmos_info.state_hall_2;
AppData.Buffer[i++] = fhmos_data.state_PIR; AppData.Buffer[i++] = fhmos_info.state_PIR;
#endif #endif
#elif defined(L8) #elif defined(L8)
@ -1274,12 +1275,12 @@ static void SendTxData(void)
sts_data->state_PIR = sts_pir_read;; sts_data->state_PIR = sts_pir_read;;
AppData.Buffer[i++] = 8; AppData.Buffer[i++] = 8;
AppData.Buffer[i++] = fhmos_data.state_fall; AppData.Buffer[i++] = fhmos_info.state_fall;
AppData.Buffer[i++] = fhmos_data.state_human_movement; AppData.Buffer[i++] = fhmos_info.state_human_movement;
AppData.Buffer[i++] = fhmos_data.occupancy; AppData.Buffer[i++] = fhmos_info.occupancy;
AppData.Buffer[i++] = fhmos_data.state_sos_alarm; AppData.Buffer[i++] = fhmos_info.state_sos_alarm;
AppData.Buffer[i++] = fhmos_data.lamp_bar_color; AppData.Buffer[i++] = fhmos_info.lamp_bar_color;
AppData.Buffer[i++] = fhmos_data.batteryLevel; AppData.Buffer[i++] = fhmos_info.batteryLevel;

View File

@ -2556,7 +2556,8 @@ void YunhornSTSDurationCheckTimer(void)
//fhmos_data.head_low_level_start_time = 0; //fhmos_data.head_low_level_start_time = 0;
fhmos_data.head_low_level_duration = 0; fhmos_data.head_low_level_duration = 0;
fhmos_data.state_fall = STS_FHMOS_FALL_STATE_NORMAL; if (STS_Status_Door_Close == sts_hall1_read)
fhmos_data.state_fall = STS_FHMOS_FALL_STATE_NORMAL; // 2025 04 18
fhmos_data.state_fall_released = 1; fhmos_data.state_fall_released = 1;
sts_fhmos_bitmap_pending = 0; sts_fhmos_bitmap_pending = 0;