revised decoder.js normal open or normal close
This commit is contained in:
parent
172b589397
commit
e7e57e5d8a
|
@ -81,8 +81,12 @@ function Decode(fPort, data, variables) {
|
||||||
data.workmode = "Unknown Mode";
|
data.workmode = "Unknown Mode";
|
||||||
break;
|
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.Sensor2_Motion_Detected = bytes[4] === 0 ? "No Motion" : "Motion Detected";
|
||||||
data.Sensor3_Emergency_Button = bytes[5] === 0 ? "Alarm Push Down" : "No Alarm, Released";
|
data.Sensor3_Emergency_Button = bytes[5] === 0 ? "Alarm Push Down" : "No Alarm, Released";
|
||||||
if (bytes.length > 6) {
|
if (bytes.length > 6) {
|
||||||
|
@ -184,16 +188,18 @@ function Decode(fPort, data, variables) {
|
||||||
data.reserve2 = bytes[33];
|
data.reserve2 = bytes[33];
|
||||||
data.reserve3 = bytes[34];
|
data.reserve3 = bytes[34];
|
||||||
data.reserve4 = bytes[35];
|
data.reserve4 = bytes[35];
|
||||||
data.reserve5 = bytes[36];
|
|
||||||
|
|
||||||
data.alarm_mute_expire_tier = bytes[37];
|
data.alarm_parameter05 = bytes[36];
|
||||||
data.fall_down_confirm_threshold = bytes[38];
|
data.alarm_mute_expire_timer = bytes[37];
|
||||||
data.motionless_duration_threshold = bytes[39];
|
data.alarm_lamp_bar_flashing_color = bytes[38];
|
||||||
data.lamp_bar_flashing_color = bytes[40];
|
data.occupancy_overtime_threshold = bytes[39];
|
||||||
data.fall_detection_acc_threshold = bytes[41];
|
|
||||||
data.fall_detection_depth_threshold = bytes[42];
|
data.motionless_duration_threshold = bytes[40];
|
||||||
data.unconcious_threshold = bytes[43];
|
data.unconcious_threshold = bytes[41];
|
||||||
data.occupancy_overtime_threshold = bytes[44];
|
|
||||||
|
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
|
else if (bytes[0] === 0x53) { // SELF TEST FUNCTION
|
||||||
data.mtm_code1 = bytes[1];
|
data.mtm_code1 = bytes[1];
|
||||||
|
|
|
@ -30,8 +30,8 @@ extern "C" {
|
||||||
#define DEFAULT_SATURATION 50 // 0 - 100 S:Saturation, 0~100
|
#define DEFAULT_SATURATION 50 // 0 - 100 S:Saturation, 0~100
|
||||||
#define DEFAULT_BRIGHTNESS 50 // 0 - 100 V:Value of lightness, 0~100
|
#define DEFAULT_BRIGHTNESS 50 // 0 - 100 V:Value of lightness, 0~100
|
||||||
#define DEFAULT_LUMINANCE_LEVEL (30)
|
#define DEFAULT_LUMINANCE_LEVEL (30)
|
||||||
#define STS_Status_Door_Close (0) //Normal Close NC:Open
|
#define STS_Status_Door_Close (1) //Normal Close NC:Open
|
||||||
#define STS_Status_Door_Open (1) //Normal Close NC:Close
|
#define STS_Status_Door_Open (0) //Normal Close NC:Close
|
||||||
#define STS_Status_SOS_Pushdown (0) //Normal Open NO:Open
|
#define STS_Status_SOS_Pushdown (0) //Normal Open NO:Open
|
||||||
#define STS_Status_SOS_Release (1) //Normal Open NO:Close
|
#define STS_Status_SOS_Release (1) //Normal Open NO:Close
|
||||||
|
|
||||||
|
|
|
@ -692,6 +692,8 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
{
|
{
|
||||||
HAL_Delay(250); //de-bouncing
|
HAL_Delay(250); //de-bouncing
|
||||||
sts_hall1_read = HALL1_STATE;
|
sts_hall1_read = HALL1_STATE;
|
||||||
|
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)
|
// 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");
|
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");
|
||||||
|
@ -712,7 +714,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
case HALL2_Pin:
|
case HALL2_Pin:
|
||||||
if (sts_reed_hall_2_changed)
|
if (sts_reed_hall_2_changed)
|
||||||
{
|
{
|
||||||
HAL_Delay(250); //de-bouncing
|
HAL_Delay(50); //de-bouncing
|
||||||
sts_hall2_read = HALL2_STATE;
|
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");
|
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();
|
OnSensor2StateChanged();
|
||||||
|
|
Loading…
Reference in New Issue