RM2_1 #2
|
@ -81,8 +81,12 @@ function Decode(fPort, data, variables) {
|
|||
data.workmode = "Unknown Mode";
|
||||
break;
|
||||
}
|
||||
// select only one below
|
||||
// For NC(Normal Closed states
|
||||
// data.Sensor1_Door_Contact_Open = bytes[3]===0?"Door Closed":"Door Open";
|
||||
// For NC(Normal Closed states
|
||||
data.Sensor1_Door_Contact_Open = bytes[3] === 1 ? "Door Closed" : "Door Open";
|
||||
|
||||
data.Sensor1_Door_Contact_Open = bytes[3] === 0 ? "Door Closed" : "Door Open";
|
||||
data.Sensor2_Motion_Detected = bytes[4] === 0 ? "No Motion" : "Motion Detected";
|
||||
data.Sensor3_Emergency_Button = bytes[5] === 0 ? "Alarm Push Down" : "No Alarm, Released";
|
||||
if (bytes.length > 6) {
|
||||
|
@ -184,16 +188,18 @@ function Decode(fPort, data, variables) {
|
|||
data.reserve2 = bytes[33];
|
||||
data.reserve3 = bytes[34];
|
||||
data.reserve4 = bytes[35];
|
||||
data.reserve5 = bytes[36];
|
||||
|
||||
data.alarm_mute_expire_tier = bytes[37];
|
||||
data.fall_down_confirm_threshold = bytes[38];
|
||||
data.motionless_duration_threshold = bytes[39];
|
||||
data.lamp_bar_flashing_color = bytes[40];
|
||||
data.fall_detection_acc_threshold = bytes[41];
|
||||
data.fall_detection_depth_threshold = bytes[42];
|
||||
data.unconcious_threshold = bytes[43];
|
||||
data.occupancy_overtime_threshold = bytes[44];
|
||||
data.alarm_parameter05 = bytes[36];
|
||||
data.alarm_mute_expire_timer = bytes[37];
|
||||
data.alarm_lamp_bar_flashing_color = bytes[38];
|
||||
data.occupancy_overtime_threshold = bytes[39];
|
||||
|
||||
data.motionless_duration_threshold = bytes[40];
|
||||
data.unconcious_threshold = bytes[41];
|
||||
|
||||
data.fall_detection_acc_threshold = bytes[42];
|
||||
data.fall_detection_depth_threshold = bytes[43];
|
||||
data.fall_down_confirm_threshold = bytes[44];
|
||||
}
|
||||
else if (bytes[0] === 0x53) { // SELF TEST FUNCTION
|
||||
data.mtm_code1 = bytes[1];
|
||||
|
|
|
@ -30,8 +30,8 @@ extern "C" {
|
|||
#define DEFAULT_SATURATION 50 // 0 - 100 S:Saturation, 0~100
|
||||
#define DEFAULT_BRIGHTNESS 50 // 0 - 100 V:Value of lightness, 0~100
|
||||
#define DEFAULT_LUMINANCE_LEVEL (30)
|
||||
#define STS_Status_Door_Close (0) //Normal Close NC:Open
|
||||
#define STS_Status_Door_Open (1) //Normal Close NC:Close
|
||||
#define STS_Status_Door_Close (1) //Normal Close NC:Open
|
||||
#define STS_Status_Door_Open (0) //Normal Close NC:Close
|
||||
#define STS_Status_SOS_Pushdown (0) //Normal Open NO:Open
|
||||
#define STS_Status_SOS_Release (1) //Normal Open NO:Close
|
||||
|
||||
|
|
|
@ -692,7 +692,9 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||
{
|
||||
HAL_Delay(250); //de-bouncing
|
||||
sts_hall1_read = HALL1_STATE;
|
||||
//if (last_sts_hall1_read !=sts_hall1_read)
|
||||
SysTime_t current_event_time = SysTimeGetMcuTime();
|
||||
if (((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_start_time) > 5) && (last_sts_hall1_read !=sts_hall1_read))
|
||||
// if (last_sts_hall1_read !=sts_hall1_read)
|
||||
{
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\n\n Door Contact Read = %02x --%20s\r\n", HALL1_STATE, (HALL1_STATE==STS_Status_Door_Close)?"Door Closed":"Door Opened");
|
||||
OnSensor1StateChanged();
|
||||
|
@ -712,7 +714,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||
case HALL2_Pin:
|
||||
if (sts_reed_hall_2_changed)
|
||||
{
|
||||
HAL_Delay(250); //de-bouncing
|
||||
HAL_Delay(50); //de-bouncing
|
||||
sts_hall2_read = HALL2_STATE;
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\n\n SOS Button Read = %02x --%20s\r\n", HALL2_STATE, (HALL2_STATE==STS_Status_SOS_Pushdown)?"SOS Pushdown":"SOS Released");
|
||||
OnSensor2StateChanged();
|
||||
|
|
Loading…
Reference in New Issue