Fixed lighting-output object blink warn relinquish. (#1192)

* Fixed lighting-output object blink warn to honor blink-warn-enable.

* Fixed the blink warn logic for a non-zero percent value blink inhibit.

* Fixed the warn relinquish to actually relinquish.
This commit is contained in:
Steve Karg
2025-12-18 16:25:52 -06:00
committed by GitHub
parent 5a9abde528
commit 88abd3a488
3 changed files with 25 additions and 17 deletions
+3
View File
@@ -66,6 +66,9 @@ The git repositories are hosted at the following sites:
### Fixed
* Fixed lighting-output object blink warn to honor blink-warn-enable.
Fixed the blink warn logic for a non-zero percent value blink inhibit.
Fixed the warn relinquish to actually relinquish. (#1192)
* Fixed channel-value encoding in the channel object when no-coercian
is required for lighting-command, color-command, and xy-color. (#1190)
* Fixed NULL handling in CharacterString sprintf which caused an endless
+16 -17
View File
@@ -477,7 +477,8 @@ Lighting_Command_Warn(struct object_data *pObject, unsigned priority)
current_priority = Present_Value_Priority(pObject);
if ((priority <= current_priority) &&
(Priority_Array_Active(pObject, priority - 1)) &&
(isgreater(Priority_Array_Value(pObject, priority - 1), 0.0))) {
(!is_float_equal(Priority_Array_Value(pObject, priority - 1), 0.0)) &&
pObject->Blink_Warn_Enable) {
/* The blink-warn notification shall not occur
if any of the following conditions occur:
(a) The specified priority is not the highest
@@ -506,8 +507,10 @@ Lighting_Command_Warn_Off(struct object_data *pObject, unsigned priority)
current_priority = Present_Value_Priority(pObject);
if ((priority <= current_priority) &&
(Priority_Array_Active(pObject, priority - 1)) &&
(isgreater(Priority_Array_Value(pObject, priority - 1), 0.0)) &&
(isgreater(Priority_Array_Next_Value(pObject, priority - 1), 0.0))) {
(!is_float_equal(Priority_Array_Value(pObject, priority - 1), 0.0)) &&
(is_float_equal(
Priority_Array_Next_Value(pObject, priority - 1), 0.0)) &&
pObject->Blink_Warn_Enable) {
/* The blink-warn notification shall not occur and
the value 0.0% written at the specified
priority immediately if any of the following
@@ -521,9 +524,8 @@ Lighting_Command_Warn_Off(struct object_data *pObject, unsigned priority)
lighting_command_blink_warn(
&pObject->Lighting_Command, BACNET_LIGHTS_WARN_OFF,
&pObject->Lighting_Command.Blink);
} else {
Present_Value_Set(pObject, 0.0, priority);
}
Present_Value_Set(pObject, 0.0, priority);
}
/**
@@ -542,28 +544,25 @@ Lighting_Command_Warn_Relinquish(struct object_data *pObject, unsigned priority)
current_priority = Present_Value_Priority(pObject);
if ((priority <= current_priority) &&
(Priority_Array_Active(pObject, priority - 1)) &&
(isgreater(Priority_Array_Value(pObject, priority - 1), 0.0)) &&
(isgreater(Priority_Array_Next_Value(pObject, priority - 1), 0.0))) {
(!is_float_equal(Priority_Array_Value(pObject, priority - 1), 0.0)) &&
(is_float_equal(
Priority_Array_Next_Value(pObject, priority - 1), 0.0)) &&
pObject->Blink_Warn_Enable) {
/* The blink-warn notification shall not occur,
and the value at the specified priority shall be
relinquished immediately if any of the following
conditions occur:
(a) The specified priority is not the highest
active priority, or
(b) The value at the specified priority
is 0.0% or NULL, or
(c) The value of the next highest non-NULL
priority, including Relinquish_Default,
is greater than 0.0%, or
(d) Blink_Warn_Enable is FALSE. */
(a) Blink_Warn_Enable is FALSE, or
(b) The Present_Value is 0.0%, or
(c) The Present_Value would not evaluate to 0.0% after
the priority slot is relinquished. */
pObject->Lighting_Command.Blink.Duration =
pObject->Egress_Time_Seconds * 1000UL;
lighting_command_blink_warn(
&pObject->Lighting_Command, BACNET_LIGHTS_WARN_RELINQUISH,
&pObject->Lighting_Command.Blink);
} else {
Present_Value_Relinquish(pObject, priority);
}
Present_Value_Relinquish(pObject, priority);
}
/**
+6
View File
@@ -180,6 +180,8 @@ static void testLightingOutput(void)
/* WARN - start with lights on */
real_value = -1.0;
priority = 8;
status = Lighting_Output_Blink_Warn_Enable_Set(instance, true);
zassert_true(status, NULL);
status = Lighting_Output_Present_Value_Set(instance, 100.0f, priority);
zassert_true(status, NULL);
Lighting_Output_Timer(instance, 10);
@@ -201,6 +203,8 @@ static void testLightingOutput(void)
/* WARN RELINQUISH */
real_value = -2.0;
priority = 8;
status = Lighting_Output_Blink_Warn_Enable(instance);
zassert_true(status, NULL);
Lighting_Output_Present_Value_Set(instance, real_value, priority);
Lighting_Output_Timer(instance, 10);
in_progress = Lighting_Output_In_Progress(instance);
@@ -210,6 +214,8 @@ static void testLightingOutput(void)
/* WARN_OFF */
real_value = -3.0;
priority = 8;
status = Lighting_Output_Blink_Warn_Enable(instance);
zassert_true(status, NULL);
Lighting_Output_Present_Value_Set(instance, real_value, priority);
Lighting_Output_Timer(instance, 10);
in_progress = Lighting_Output_In_Progress(instance);