---update decoder for ALARM MUTE/RESET hall3/4
This commit is contained in:
parent
aeb6fb6415
commit
3acc23d107
|
@ -6,6 +6,7 @@
|
||||||
// for Yunhorn SmarToilets STS-O7 Occupancy/Fall Detection/Over stay sensor
|
// for Yunhorn SmarToilets STS-O7 Occupancy/Fall Detection/Over stay sensor
|
||||||
function Decode(fPort, data, variables) {
|
function Decode(fPort, data, variables) {
|
||||||
var data = {};
|
var data = {};
|
||||||
|
data.length = bytes.length;
|
||||||
if ((fPort === 10)) { // STS_O2_O6 V3 version 2023,pixel-network version
|
if ((fPort === 10)) { // STS_O2_O6 V3 version 2023,pixel-network version
|
||||||
switch (bytes[0]) {
|
switch (bytes[0]) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
@ -86,8 +87,12 @@ function Decode(fPort, data, variables) {
|
||||||
|
|
||||||
// For NC(Normal Closed states
|
// For NC(Normal Closed states
|
||||||
//data.Sensor1_Door_Contact_Open = bytes[3]===1?"Door Closed":"Door Open";
|
//data.Sensor1_Door_Contact_Open = bytes[3]===1?"Door Closed":"Door Open";
|
||||||
|
if (bytes[1] == 0x02) //Hall_element_mode
|
||||||
data.Sensor2_Motion_Detected = bytes[3] === 0 ? "No Motion" : "Motion Detected";
|
{
|
||||||
|
data.Sensor2_SOS_Pushed = bytes[3] === 0 ? "PushDown" : "RelaseUP";
|
||||||
|
} else if (bytes[1] > 0x02) {
|
||||||
|
data.Sensor2_Motion_Detected = bytes[3] === 0 ? "No Motion" : "Motion Detected";
|
||||||
|
}
|
||||||
|
|
||||||
return { "Yunhorn_SmarToilets_data": data };
|
return { "Yunhorn_SmarToilets_data": data };
|
||||||
}
|
}
|
||||||
|
@ -175,7 +180,7 @@ function Decode(fPort, data, variables) {
|
||||||
data.Sensor2_Emergency_Button = bytes[4] === 0 ? "Alarm Push Down" : "No Alarm, Released";
|
data.Sensor2_Emergency_Button = bytes[4] === 0 ? "Alarm Push Down" : "No Alarm, Released";
|
||||||
data.Sensor3_Motion_Detected = bytes[5] === 0 ? "No Motion" : "Motion Detected";
|
data.Sensor3_Motion_Detected = bytes[5] === 0 ? "No Motion" : "Motion Detected";
|
||||||
|
|
||||||
data.length = bytes.length
|
data.length = bytes.length;
|
||||||
if (data.length === 9) {
|
if (data.length === 9) {
|
||||||
data.Over_stay_state = (bytes[6] === 0) ? "False" : "True";
|
data.Over_stay_state = (bytes[6] === 0) ? "False" : "True";
|
||||||
data.Over_Stay_duration_in_Seconds = (bytes[7] << 8 | bytes[8]);
|
data.Over_Stay_duration_in_Seconds = (bytes[7] << 8 | bytes[8]);
|
||||||
|
@ -183,13 +188,14 @@ function Decode(fPort, data, variables) {
|
||||||
return { "Yunhorn_SmarToilets_data": data };
|
return { "Yunhorn_SmarToilets_data": data };
|
||||||
}
|
}
|
||||||
else if (data.length > 9) {
|
else if (data.length > 9) {
|
||||||
data.Sensor4 = (bytes[6] === 0) ? "No" : "Yes";
|
data.Sensor4_ALARM_MUTE = (bytes[6] === 0) ? "Down Mute" : "No Mute";
|
||||||
data.Distance_in_mm = (bytes[7] << 8 | bytes[8]);
|
data.Sensor5_ALARM_RESET = (bytes[7] === 0) ? "Down RESET" : "NO Reset";
|
||||||
data.MotionLevel = (bytes[9] << 8 | bytes[10]);
|
data.Distance_in_mm = (bytes[8] << 8 | bytes[9]);
|
||||||
|
data.MotionLevel = (bytes[10] << 8 | bytes[11]);
|
||||||
|
|
||||||
data.Unconcious_State = (bytes[11] == 0) ? "False" : "True";
|
data.Unconcious_State = (bytes[12] == 0) ? "False" : "True";
|
||||||
|
|
||||||
switch (bytes[12]) {
|
switch (bytes[13]) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
data.Fall_Down_Detected_State = "Presence_Normal";
|
data.Fall_Down_Detected_State = "Presence_Normal";
|
||||||
break;
|
break;
|
||||||
|
@ -212,29 +218,29 @@ function Decode(fPort, data, variables) {
|
||||||
data.Fall_Down_Detected_State = "Presence_Normal";
|
data.Fall_Down_Detected_State = "Presence_Normal";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
data.OverStay_Detected_State = (bytes[13] == 0x0) ? "False" : "True";
|
data.OverStay_Detected_State = (bytes[14] == 0x0) ? "False" : "True";
|
||||||
data.OverStay_Duration_in_Seconds = (bytes[14] << 8 | bytes[15]);
|
data.OverStay_Duration_in_Seconds = (bytes[15] << 8 | bytes[16]);
|
||||||
data.No_Movement_Duration_in_Seconds = (bytes[16] << 8 | bytes[17]);
|
data.No_Movement_Duration_in_Seconds = (bytes[17] << 8 | bytes[18]);
|
||||||
data.Unconcious_Duration_in_Seconds = (bytes[16] << 8 | bytes[17]);
|
data.Unconcious_Duration_in_Seconds = (bytes[17] << 8 | bytes[18]);
|
||||||
data.Fall_Down_Speed_in_m_per_s = (bytes[18]);
|
data.Fall_Down_Speed_in_m_per_s = (bytes[19]);
|
||||||
data.Fall_Down_Gravity_in_g = (bytes[19]);
|
data.Fall_Down_Gravity_in_g = (bytes[20]);
|
||||||
data.SOS_PushDown_Stamp = (bytes[20] << 24 | bytes[21] << 16 | bytes[22] << 8 | bytes[23]);
|
data.SOS_PushDown_Stamp = (bytes[21] << 24 | bytes[22] << 16 | bytes[23] << 8 | bytes[24]);
|
||||||
if (data.SOS_PushDown_Stamp != 0) {
|
if (data.SOS_PushDown_Stamp != 0) {
|
||||||
var sos_start = new Date(1000 * data.SOS_PushDown_Stamp);
|
var sos_start = new Date(1000 * data.SOS_PushDown_Stamp);
|
||||||
data.SOS_PushDown_Time = "[" + sos_start.getDate() + "." + (sos_start.getMonth() + 1) + "." + (sos_start.getFullYear()) + "] " + sos_start.getHours() + ":" + sos_start.getMinutes() + ":" + sos_start.getSeconds();
|
data.SOS_PushDown_Time = "[" + sos_start.getDate() + "." + (sos_start.getMonth() + 1) + "." + (sos_start.getFullYear()) + "] " + sos_start.getHours() + ":" + sos_start.getMinutes() + ":" + sos_start.getSeconds();
|
||||||
} else data.SOS_PushDown_Time = "N/A";
|
} else data.SOS_PushDown_Time = "N/A";
|
||||||
data.SOS_ReleaseUP_Stamp = (bytes[24] << 24 | bytes[25] << 16 | bytes[26] << 8 | bytes[27]);
|
data.SOS_ReleaseUP_Stamp = (bytes[25] << 24 | bytes[26] << 16 | bytes[27] << 8 | bytes[28]);
|
||||||
if (data.SOS_ReleaseUP_Stamp != 0) {
|
if (data.SOS_ReleaseUP_Stamp != 0) {
|
||||||
var sos_stop = new Date(1000 * data.SOS_ReleaseUP_Stamp);
|
var sos_stop = new Date(1000 * data.SOS_ReleaseUP_Stamp);
|
||||||
data.SOS_ReleaseUP_Time = "[" + sos_stop.getDate() + "." + (sos_stop.getMonth() + 1) + "." + (sos_stop.getFullYear()) + "] " + sos_stop.getHours() + ":" + sos_stop.getMinutes() + ":" + sos_stop.getSeconds();
|
data.SOS_ReleaseUP_Time = "[" + sos_stop.getDate() + "." + (sos_stop.getMonth() + 1) + "." + (sos_stop.getFullYear()) + "] " + sos_stop.getHours() + ":" + sos_stop.getMinutes() + ":" + sos_stop.getSeconds();
|
||||||
} else data.SOS_ReleaseUP_Time = "N/A";
|
} else data.SOS_ReleaseUP_Time = "N/A";
|
||||||
|
|
||||||
data.Fall_Down_Stamp = (bytes[28] << 24 | bytes[29] << 16 | bytes[30] << 8 | bytes[31]);
|
data.Fall_Down_Stamp = (bytes[29] << 24 | bytes[30] << 16 | bytes[31] << 8 | bytes[32]);
|
||||||
if (data.Fall_Down_Stamp != 0) {
|
if (data.Fall_Down_Stamp != 0) {
|
||||||
var fall_start = new Date(1000 * data.Fall_Down_Stamp);
|
var fall_start = new Date(1000 * data.Fall_Down_Stamp);
|
||||||
data.Fall_Down_Time = "[" + fall_start.getDate() + "." + (fall_start.getMonth() + 1) + "." + (fall_start.getFullYear()) + "] " + fall_start.getHours() + ":" + fall_start.getMinutes() + ":" + fall_start.getSeconds();
|
data.Fall_Down_Time = "[" + fall_start.getDate() + "." + (fall_start.getMonth() + 1) + "." + (fall_start.getFullYear()) + "] " + fall_start.getHours() + ":" + fall_start.getMinutes() + ":" + fall_start.getSeconds();
|
||||||
} else data.Fall_RiseUp_Stamp = "N/A";
|
} else data.Fall_RiseUp_Stamp = "N/A";
|
||||||
data.Fall_RiseUp_Stamp = (bytes[32] << 24 | bytes[33] << 16 | bytes[34] << 8 | bytes[35]);
|
data.Fall_RiseUp_Stamp = (bytes[33] << 24 | bytes[34] << 16 | bytes[35] << 8 | bytes[36]);
|
||||||
if (data.Fall_RiseUp_Stamp != 0) {
|
if (data.Fall_RiseUp_Stamp != 0) {
|
||||||
var fall_stop = new Date(1000 * data.Fall_RiseUp_Stamp);
|
var fall_stop = new Date(1000 * data.Fall_RiseUp_Stamp);
|
||||||
data.Fall_RiseUp_Time = "[" + fall_stop.getDate() + "." + (fall_stop.getMonth() + 1) + "." + (fall_stop.getFullYear()) + "] " + fall_stop.getHours() + ":" + fall_stop.getMinutes() + ":" + fall_stop.getSeconds();
|
data.Fall_RiseUp_Time = "[" + fall_stop.getDate() + "." + (fall_stop.getMonth() + 1) + "." + (fall_stop.getFullYear()) + "] " + fall_stop.getHours() + ":" + fall_stop.getMinutes() + ":" + fall_stop.getSeconds();
|
||||||
|
@ -256,11 +262,39 @@ function Decode(fPort, data, variables) {
|
||||||
var data = {};
|
var data = {};
|
||||||
data.length = bytes.length;
|
data.length = bytes.length;
|
||||||
|
|
||||||
if (data.length === 4) {
|
if ((data.length === 4) && (bytes[0] == 0x52) && (bytes[1] = 0x46)) //RFAC
|
||||||
|
{
|
||||||
|
data.Request_Performed = "OK";
|
||||||
data.RFAC = "OK";
|
data.RFAC = "OK";
|
||||||
data.AC0 = bytes[0];
|
data.AC0 = bytes[0];
|
||||||
data.AC1 = bytes[1];
|
data.AC1 = bytes[1];
|
||||||
}
|
}
|
||||||
|
else if ((data.length === 4) && (bytes[0] === 0x50) && (bytes[1] === 0x31) && (bytes[2] === 0x31)) {
|
||||||
|
data.Work_Mode_Switch = "OK";
|
||||||
|
switch (bytes[3] - 0x30) {
|
||||||
|
case 0x0:
|
||||||
|
data.workmode = "Network_mode";
|
||||||
|
break;
|
||||||
|
case 0x01:
|
||||||
|
data.workmode = "Wired_Mode";
|
||||||
|
break;
|
||||||
|
case 0x02:
|
||||||
|
data.workmode = "Hall_element_mode";
|
||||||
|
break;
|
||||||
|
case 0x03:
|
||||||
|
data.workmode = "MotionDetect_mode";
|
||||||
|
break;
|
||||||
|
case 0x04:
|
||||||
|
data.workmode = "Dual_mode";
|
||||||
|
break;
|
||||||
|
case 0x05:
|
||||||
|
data.workmode = "Uni_Mode";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
data.workmode = "Unknown Mode";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((bytes[0] === 0x59) && (bytes[1] === 0x44)) //Duration interval
|
if ((bytes[0] === 0x59) && (bytes[1] === 0x44)) //Duration interval
|
||||||
|
@ -380,6 +414,59 @@ function Decode(fPort, data, variables) {
|
||||||
data.LocalTime_EST8 = "GMT+8: " + data.L_year + "/" + data.L_mon + "/" + data.L_day + " " + (data.L_hour + 8) + ":" + data.L_min + ":" + data.L_sec;
|
data.LocalTime_EST8 = "GMT+8: " + data.L_year + "/" + data.L_mon + "/" + data.L_day + " " + (data.L_hour + 8) + ":" + data.L_min + ":" + data.L_sec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (bytes[0] === 0x50) { // P cmd report
|
||||||
|
if (data.length == 7) {
|
||||||
|
switch (bytes[3]) {
|
||||||
|
case 0x46: // F --- fall down & unconscious detection threshold
|
||||||
|
data.FALL_acceleration = (bytes[4] == 0x30 ? "Disabled" : ((bytes[4] - 0x30) * 10) + " mg/s2");
|
||||||
|
data.FALL_depth_measure = (bytes[5] == 0x30 ? "Disabled" : ((bytes[5] - 0x30) * 10) + " cm");
|
||||||
|
data.FALL_confirm_threshold = (bytes[6] == 0x30 ? "Disabled" : ((bytes[6] - 0x30) * 10) + " seconds");
|
||||||
|
//data.FALL_reserved = (bytes[7]==0x0?"Disabled":((bytes[6]-0x30)*10)+" min");
|
||||||
|
break;
|
||||||
|
} //switch
|
||||||
|
}
|
||||||
|
else if (data.length == 8) {
|
||||||
|
switch (bytes[3]) {
|
||||||
|
case 0x4f: // O -- over stay, onconscious, long stay
|
||||||
|
data.OMU_Motionless_duration_in_min = (bytes[4] == 0x30 ? "Disabled" : ((bytes[4] - 0x30)) + " Min");
|
||||||
|
data.OMU_Long_Occupy_duration_in_Min = (bytes[5] == 0x30 ? "Disabled" : ((bytes[5] - 0x30) * 10) + " Min");
|
||||||
|
data.OMU_Unconcious_Threshold = (bytes[6] == 0x30 ? "Disabled" : ((bytes[6] - 0x30) * 100) + "ml");
|
||||||
|
data.OMU_Alarm_Mute_Reset_Timer = (bytes[7] == 0x30 ? "Disabled" : ((bytes[7] - 0x30) * 10) + " Seconds");
|
||||||
|
break;
|
||||||
|
case 0x46: // F --- fall down & unconscious detection threshold
|
||||||
|
data.FALL_acceleration = (bytes[4] == 0x30 ? "Disabled" : ((bytes[4] - 0x30) * 10) + " mg/s2");
|
||||||
|
data.FALL_depth_measure = (bytes[5] == 0x30 ? "Disabled" : ((bytes[5] - 0x30) * 10) + " cm");
|
||||||
|
data.FALL_confirm_threshold = (bytes[6] == 0x30 ? "Disabled" : ((bytes[6] - 0x30) * 10) + " seconds");
|
||||||
|
data.FALL_reserved = (bytes[7] == 0x30 ? "Disabled" : ((bytes[6] - 0x30) * 10) + " min");
|
||||||
|
break;
|
||||||
|
} //switch
|
||||||
|
} else if (data.length == 11) { // P 1108201365
|
||||||
|
data.RSS_SIMPLE_Start = ((bytes[3] - 0x30) * 100 + (bytes[4] - 0x30) * 10) + " cm";
|
||||||
|
data.RSS_SIMPLE_Length = ((bytes[5] - 0x30) * 100 + (bytes[6] - 0x030) * 10) + " cm";
|
||||||
|
data.RSS_SIMPLE_Threshold = ((bytes[7] - 0x30) * 1000 + (bytes[8] - 0x30) * 100) + " ml";
|
||||||
|
data.RSS_SIMPLE_Gain = ((bytes[9] - 0x30) * 10 + (bytes[10] - 0x30)) + " %";
|
||||||
|
} else if (data.length == 33) { // P 11
|
||||||
|
data.RSS_FULL_Start = ((bytes[3] - 0x30) * 100 + (bytes[4] - 0x30) * 10) + " cm";
|
||||||
|
data.RSS_FULL_Length = ((bytes[5] - 0x30) * 100 + (bytes[6] - 0x30) * 10) + " cm";
|
||||||
|
data.RSS_FULL_Threshold = ((bytes[7] - 0x30) * 1000 + (bytes[8] - 0x30) * 100) + " ml";
|
||||||
|
data.RSS_FULL_Gain = ((bytes[9] - 0x30) * 10 + (bytes[10] - 0x30)) + " %";
|
||||||
|
data.RSS_FULL_Profile = (bytes[11] - 0x30);
|
||||||
|
data.RSS_FULL_Rate_Tracking = ((bytes[12] - 0x30) * 10 + (bytes[13] - 0x30));
|
||||||
|
data.RSS_FULL_Rate_Presence = ((bytes[14] - 0x30) * 10 + (bytes[15] - 0x30));
|
||||||
|
data.RSS_FULL_HWAAS = ((bytes[16] - 0x30) * 10 + (bytes[17] - 0x30));
|
||||||
|
data.RSS_FULL_Num_Removed_PC = (bytes[18] - 0x30);
|
||||||
|
data.RSS_FULL_Inter_Deviation_Time_Const_in_Sec = ((bytes[19] - 0x30) + (bytes[20] - 0x30) * 0.1);
|
||||||
|
data.RSS_FULL_Inter_Fast_Cut_Off = ((bytes[21] - 0x30) * 10 + (bytes[22] - 0x30));
|
||||||
|
data.RSS_FULL_Inter_Slow_Cut_Off = ((bytes[23] - 0x30) * 0.1 + (bytes[24] - 0x30) * 0.001);
|
||||||
|
data.RSS_FULL_Inter_Time_Const_in_Sec = ((bytes[25] - 0x30) * 10 + (bytes[26] - 0x30));
|
||||||
|
data.RSS_FULL_Inter_Weight = ((bytes[27] - 0x30) + (bytes[28] - 0x30) * 0.1);
|
||||||
|
data.RSS_FULL_Output_Time_Const_in_Sec = ((bytes[29] - 0x30) + (bytes[30] - 0x30) * 0.1);
|
||||||
|
data.RSS_FULL_DownSampling_factor = (bytes[31] - 0x30);
|
||||||
|
data.RSS_FULL_Power_Saving_mode = (bytes[32] - 0x30);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
return { "Yunhorn_SmarToilets_data": data };
|
return { "Yunhorn_SmarToilets_data": data };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,23 +233,32 @@ void STS_YunhornSTSEventP1_Process(void)
|
||||||
sts_reed_hall_1_result = HALL1_STATE; //sts_hall1_read;
|
sts_reed_hall_1_result = HALL1_STATE; //sts_hall1_read;
|
||||||
if (sts_reed_hall_1_result != last_sts_reed_hall_1_result)
|
if (sts_reed_hall_1_result != last_sts_reed_hall_1_result)
|
||||||
{
|
{
|
||||||
sts_reed_hall_changed_flag = TRUE;
|
sts_reed_hall_changed_flag |= 0x01;
|
||||||
}
|
}
|
||||||
last_sts_reed_hall_1_result = sts_reed_hall_1_result;
|
last_sts_reed_hall_1_result = sts_reed_hall_1_result;
|
||||||
|
|
||||||
sts_reed_hall_2_result = HALL2_STATE;// sts_hall2_read;
|
sts_reed_hall_2_result = HALL2_STATE;// sts_hall2_read;
|
||||||
if (sts_reed_hall_2_result != last_sts_reed_hall_2_result)
|
if (sts_reed_hall_2_result != last_sts_reed_hall_2_result)
|
||||||
{
|
{
|
||||||
sts_reed_hall_changed_flag |= TRUE;
|
sts_reed_hall_changed_flag |= 0x02;
|
||||||
}
|
}
|
||||||
last_sts_reed_hall_2_result = sts_reed_hall_2_result;
|
last_sts_reed_hall_2_result = sts_reed_hall_2_result;
|
||||||
|
|
||||||
sts_reed_hall_3_result = sts_hall3_read;//HALL3_STATE;// sts_hall3_read;
|
sts_reed_hall_3_result = sts_hall3_read;//HALL3_STATE;// sts_hall3_read;
|
||||||
|
if (sts_reed_hall_3_result != last_sts_reed_hall_3_result)
|
||||||
|
{
|
||||||
|
sts_reed_hall_changed_flag |= 0x04;
|
||||||
|
}
|
||||||
last_sts_reed_hall_3_result = sts_reed_hall_3_result;
|
last_sts_reed_hall_3_result = sts_reed_hall_3_result;
|
||||||
|
|
||||||
sts_reed_hall_4_result = sts_hall4_read;//HALL4_STATE;// sts_hall3_read;
|
sts_reed_hall_4_result = sts_hall4_read;//HALL4_STATE;// sts_hall3_read;
|
||||||
|
if (sts_reed_hall_4_result != last_sts_reed_hall_4_result)
|
||||||
|
{
|
||||||
|
sts_reed_hall_changed_flag |= 0x08;
|
||||||
|
}
|
||||||
last_sts_reed_hall_4_result = sts_reed_hall_4_result;
|
last_sts_reed_hall_4_result = sts_reed_hall_4_result;
|
||||||
|
|
||||||
|
|
||||||
STS_Combined_Status_Processing();
|
STS_Combined_Status_Processing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +660,7 @@ void STS_Combined_Status_Processing(void)
|
||||||
if ((sts_rss_result_changed_flag))//|| (sts_reed_hall_changed_flag)||(sts_fall_rising_detected_result_changed_flag))
|
if ((sts_rss_result_changed_flag))//|| (sts_reed_hall_changed_flag)||(sts_fall_rising_detected_result_changed_flag))
|
||||||
{
|
{
|
||||||
//sts_rss_result_changed_flag =0;
|
//sts_rss_result_changed_flag =0;
|
||||||
sts_reed_hall_changed_flag =0;
|
//sts_reed_hall_changed_flag =0;
|
||||||
//sts_fall_rising_detected_result_changed_flag =0;
|
//sts_fall_rising_detected_result_changed_flag =0;
|
||||||
//sts_tof_result_changed_flag =0;
|
//sts_tof_result_changed_flag =0;
|
||||||
sensor_data_ready = 1;
|
sensor_data_ready = 1;
|
||||||
|
@ -754,7 +763,8 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso
|
||||||
sensor_data->state_sensor1_on_off = HALL1_STATE;//sts_hall1_read; //sts_hsts_reed_hall_result; // sts_hall1_read
|
sensor_data->state_sensor1_on_off = HALL1_STATE;//sts_hall1_read; //sts_hsts_reed_hall_result; // sts_hall1_read
|
||||||
sensor_data->state_sensor2_on_off = HALL2_STATE;//sts_hall2_read; //sts_emergency_button_pushed; //sts_hall2_read
|
sensor_data->state_sensor2_on_off = HALL2_STATE;//sts_hall2_read; //sts_emergency_button_pushed; //sts_hall2_read
|
||||||
sensor_data->state_sensor3_on_off = sts_rss_result;
|
sensor_data->state_sensor3_on_off = sts_rss_result;
|
||||||
sensor_data->state_sensor4_on_off = sts_rss_2nd_result;
|
sensor_data->state_sensor4_on_off = sts_hall3_read; //for alarm mute button
|
||||||
|
sensor_data->state_sensor5_on_off = sts_hall4_read; //for alarm reset button
|
||||||
|
|
||||||
if (sensor_data->state_sensor2_on_off==STS_Status_SOS_Pushdown)
|
if (sensor_data->state_sensor2_on_off==STS_Status_SOS_Pushdown)
|
||||||
{
|
{
|
||||||
|
|
|
@ -722,6 +722,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
STS_YunhornSTSEventP1_Process();
|
STS_YunhornSTSEventP1_Process();
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||||
//SendTxData();
|
//SendTxData();
|
||||||
|
sts_reed_hall_changed_flag &= !(0x01);
|
||||||
}
|
}
|
||||||
last_sts_hall1_read = sts_hall1_read;
|
last_sts_hall1_read = sts_hall1_read;
|
||||||
}
|
}
|
||||||
|
@ -739,7 +740,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
{
|
{
|
||||||
STS_YunhornSTSEventP1_Process();
|
STS_YunhornSTSEventP1_Process();
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||||
|
sts_reed_hall_changed_flag &= !(0x02);
|
||||||
}
|
}
|
||||||
last_sts_hall2_read = sts_hall2_read;
|
last_sts_hall2_read = sts_hall2_read;
|
||||||
}
|
}
|
||||||
|
@ -757,7 +758,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
{
|
{
|
||||||
STS_YunhornSTSEventP1_Process();
|
STS_YunhornSTSEventP1_Process();
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||||
|
sts_reed_hall_changed_flag &= !(0x04);
|
||||||
}
|
}
|
||||||
last_sts_hall3_read = sts_hall3_read;
|
last_sts_hall3_read = sts_hall3_read;
|
||||||
}
|
}
|
||||||
|
@ -775,7 +776,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
{
|
{
|
||||||
STS_YunhornSTSEventP1_Process();
|
STS_YunhornSTSEventP1_Process();
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||||
|
sts_reed_hall_changed_flag &= !(0x08);
|
||||||
}
|
}
|
||||||
last_sts_hall4_read = sts_hall4_read;
|
last_sts_hall4_read = sts_hall4_read;
|
||||||
}
|
}
|
||||||
|
@ -994,45 +995,45 @@ static void SendTxData(void)
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status reedswitch
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status reedswitch
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor2_on_off)&0xff; //04 Sensor head #2 status SOS button
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor2_on_off)&0xff; //04 Sensor head #2 status SOS button
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor3_on_off)&0xff; //05 Sensor head #3 status RSS motion
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor3_on_off)&0xff; //05 Sensor head #3 status RSS motion
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status reserved
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status ALARM MUTE
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor5_on_off)&0xff; //07 Sensor head #5 status ALARM RESET
|
||||||
|
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_distance>>8)&0xff; //08 MSB distance
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_distance)&0xff; //09 LSB distance
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_score>>8)&0xff; //10 MSB score
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_score)&0xff; //11 LSB score
|
||||||
|
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.unconscious_state)&0xff; //12 unconscious state detected or not
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_state)&0xff; //13 fall detected or not
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_state)&0xff; //14 occupancy over time or not
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration>>8)&0xff; //15 occupancy over stay duration MSB
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration)&0xff; //16 occupancy over stay duration LSB
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.no_movement_duration>>8)&0xff; //17 occupancy over stay duration LSB
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.no_movement_duration)&0xff; //18 occupancy over stay duration LSB
|
||||||
|
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_speed)&0xff; //19 fall detected speed
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_gravity)&0xff; //20 fall detected gravity
|
||||||
|
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_start_timestamp>>24)&0xff; //21 SOS start time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_start_timestamp>>16)&0xff; //22 SOS start time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_start_timestamp>>8)&0xff; //23 SOS start time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_start_timestamp)&0xff; //24 SOS start time stamp
|
||||||
|
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_stop_timestamp>>24)&0xff; //25 SOS stop time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_stop_timestamp>>16)&0xff; //26 SOS stop time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_stop_timestamp>>8)&0xff; //27 SOS stop time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_stop_timestamp)&0xff; //28 SOS stop time stamp
|
||||||
|
|
||||||
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_distance>>8)&0xff; //07 MSB distance
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>24)&0xff; //29 fall start time stamp
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_distance)&0xff; //08 LSB distance
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>16)&0xff; //30 fall start time stamp
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_score>>8)&0xff; //09 MSB score
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>8)&0xff; //31 fall start time stamp
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_score)&0xff; //10 LSB score
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp)&0xff; //32 fall start time stamp
|
||||||
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.unconscious_state)&0xff; //11 unconscious state detected or not
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>24)&0xff; //33 fall stop time stamp
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_state)&0xff; //12 fall detected or not
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>16)&0xff; //34 fall stop time stamp
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_state)&0xff; //13 occupancy over time or not
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>8)&0xff; //35 fall stop time stamp
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration>>8)&0xff; //14 occupancy over stay duration MSB
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp)&0xff; //36 fall stop time stamp
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration)&0xff; //15 occupancy over stay duration LSB
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.no_movement_duration>>8)&0xff; //16 occupancy over stay duration LSB
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.no_movement_duration)&0xff; //17 occupancy over stay duration LSB
|
|
||||||
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_speed)&0xff; //18 fall detected speed
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_gravity)&0xff; //19 fall detected gravity
|
|
||||||
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_start_timestamp>>24)&0xff; //20 SOS start time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_start_timestamp>>16)&0xff; //21 SOS start time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_start_timestamp>>8)&0xff; //22 SOS start time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_start_timestamp)&0xff; //23 SOS start time stamp
|
|
||||||
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_stop_timestamp>>24)&0xff; //24 SOS stop time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_stop_timestamp>>16)&0xff; //25 SOS stop time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_stop_timestamp>>8)&0xff; //26 SOS stop time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor2_stop_timestamp)&0xff; //27 SOS stop time stamp
|
|
||||||
|
|
||||||
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>24)&0xff; //28 fall start time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>16)&0xff; //29 fall start time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>8)&0xff; //30 fall start time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp)&0xff; //31 fall start time stamp
|
|
||||||
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>24)&0xff; //32 fall stop time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>16)&0xff; //33 fall stop time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>8)&0xff; //34 fall stop time stamp
|
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp)&0xff; //35 fall stop time stamp
|
|
||||||
|
|
||||||
}
|
}
|
||||||
uint8_t ich= (sts_lamp_bar_color>>4 & 0x0f);
|
uint8_t ich= (sts_lamp_bar_color>>4 & 0x0f);
|
||||||
|
|
Loading…
Reference in New Issue