almost fixed reed switch, SOS button logic
This commit is contained in:
parent
80dbb967e1
commit
f455308422
|
@ -397,7 +397,7 @@ void STS_Combined_Status_Processing(void)
|
||||||
sts_water_leakage_changed_flag=0;
|
sts_water_leakage_changed_flag=0;
|
||||||
#endif
|
#endif
|
||||||
sensor_data_ready = 1;
|
sensor_data_ready = 1;
|
||||||
STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
//STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
|
||||||
sts_mtmcode2,
|
sts_mtmcode2,
|
||||||
sts_version,
|
sts_version,
|
||||||
sts_hardware_ver,
|
sts_hardware_ver,
|
||||||
0x02,
|
0x05,
|
||||||
'M', //Uplink data interval for heart-beat uplink
|
'M', //Uplink data interval for heart-beat uplink
|
||||||
0x01,
|
0x01,
|
||||||
'S', //Sampling sensor interval for real-time sensing of MEMS
|
'S', //Sampling sensor interval for real-time sensing of MEMS
|
||||||
|
@ -641,7 +641,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
|
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
|
||||||
// if (EventType == TX_ON_EVENT)
|
// if (EventType == TX_ON_EVENT)
|
||||||
{
|
{
|
||||||
sensor_data_ready =1;
|
//sensor_data_ready =1;
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
sts_hall2_read = HALL2_STATE;
|
sts_hall2_read = HALL2_STATE;
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\n\n SOS Button Read = %02X \r\n", HALL2_STATE);
|
APP_LOG(TS_OFF, VLEVEL_M, "\n\n SOS Button Read = %02X \r\n", HALL2_STATE);
|
||||||
|
|
||||||
sensor_data_ready =1;
|
//sensor_data_ready =1;
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||||
break;
|
break;
|
||||||
|
@ -913,18 +913,14 @@ static void SendTxData(void)
|
||||||
AppData.Port = LORAWAN_USER_APP_PORT;
|
AppData.Port = LORAWAN_USER_APP_PORT;
|
||||||
//AppData.Buffer[i++] = AppLedStateOn; //#01
|
//AppData.Buffer[i++] = AppLedStateOn; //#01
|
||||||
|
|
||||||
if ((heart_beat_timer != 0L)&&(sensor_data_ready==0)) // sensor data OVERWRITE heart-beat message, 2024-05-12
|
if ((heart_beat_timer != 0L)) // sensor data OVERWRITE heart-beat message, 2024-05-12
|
||||||
{
|
{
|
||||||
heart_beat_timer = 0U;
|
|
||||||
AppData.Port = sts_sendhtbtport; //LORAWAN_USER_APP_PORT+1;
|
AppData.Port = sts_sendhtbtport; //LORAWAN_USER_APP_PORT+1;
|
||||||
AppData.Buffer[i++]= AppLedStateOn|0x80;
|
AppData.Buffer[i++]= AppLedStateOn|0x80;
|
||||||
AppData.Buffer[i++] = (uint8_t)(99*batteryLevel/254)&0xff; //#05
|
AppData.Buffer[i++] = (uint8_t)(99*batteryLevel/254)&0xff; //#05
|
||||||
|
|
||||||
} else if ((upload_message_timer != 0U)||(sensor_data_ready!= 0U)) //sensor_data_ready for manual push button-1 trigger)
|
} else if ((upload_message_timer != 0U)||(sensor_data_ready!= 0U)) //sensor_data_ready for manual push button-1 trigger)
|
||||||
{
|
{
|
||||||
sensor_data_ready =0;
|
|
||||||
upload_message_timer =0;
|
|
||||||
|
|
||||||
//AppData.Buffer[i++] = AppLedStateOn;
|
//AppData.Buffer[i++] = AppLedStateOn;
|
||||||
//i = PrepareSendTxData();
|
//i = PrepareSendTxData();
|
||||||
STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
||||||
|
@ -975,6 +971,7 @@ static void SendTxData(void)
|
||||||
sts_o7_sensorData.unconcious_state, sts_o7_sensorData.unconcious_duration, sts_o7_sensorData.fall_state );
|
sts_o7_sensorData.unconcious_state, sts_o7_sensorData.unconcious_duration, sts_o7_sensorData.fall_state );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
heart_beat_timer=0;
|
heart_beat_timer=0;
|
||||||
sensor_data_ready =0;
|
sensor_data_ready =0;
|
||||||
upload_message_timer =0;
|
upload_message_timer =0;
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue