From bcb5cb44d3e2bf1fa9f2028fa7863a6e5746b1f8 Mon Sep 17 00:00:00 2001 From: Patrick Grimm Date: Mon, 26 Mar 2018 19:22:36 +0200 Subject: [PATCH] fix COV --- demo/object/ai.c | 15 ++++++++++++--- demo/object/ao.c | 18 ++++++++++++++---- demo/object/av.c | 9 ++++++--- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/demo/object/ai.c b/demo/object/ai.c index d76a54c..c1579d7 100644 --- a/demo/object/ai.c +++ b/demo/object/ai.c @@ -301,6 +301,8 @@ void Analog_Input_Init( } AI_Descr[i].Priority_Array[15] = strtof(ucivalue, (char **) NULL); + AI_Descr[i].Prior_Value = strtof(ucivalue, + (char **) NULL); AI_Descr[i].Relinquish_Default = 0; //TODO read uci @@ -548,7 +550,14 @@ void Analog_Input_Change_Of_Value_Clear( } } -/* returns true if value has changed */ +/** + * For a given object instance-number, loads the value_list with the COV data. + * + * @param object_instance - object-instance number of the object + * @param value_list - list of COV data + * + * @return true if the value list is encoded + */ bool Analog_Input_Encode_Value_List( uint32_t object_instance, BACNET_PROPERTY_VALUE * value_list) @@ -621,7 +630,7 @@ void Analog_Input_COV_Increment_Set( index = Analog_Input_Instance_To_Index(object_instance); CurrentAI = &AI_Descr[index]; CurrentAI->COV_Increment = value; - Analog_Input_COV_Detect(index, Analog_Input_Present_Value(index)); + Analog_Input_COV_Detect(object_instance, Analog_Input_Present_Value(object_instance)); } } @@ -698,7 +707,7 @@ bool Analog_Input_Present_Value_Set( if (priority == 8) { CurrentAI->Priority_Array[15] = value; } - Analog_Input_COV_Detect(index, value); + Analog_Input_COV_Detect(object_instance, Analog_Input_Present_Value(object_instance)); status = true; } } diff --git a/demo/object/ao.c b/demo/object/ao.c index 5909eaf..4fc3008 100644 --- a/demo/object/ao.c +++ b/demo/object/ao.c @@ -303,6 +303,9 @@ void Analog_Output_Init( AO_Descr[i].Priority_Array[15] = strtof(ucivalue, (char **) NULL); + AO_Descr[i].Prior_Value = strtof(ucivalue, + (char **) NULL); + AO_Descr[i].Relinquish_Default = 0; //TODO read uci ucicov_increment = ucix_get_option(ctx, "bacnet_ao", idx_c, @@ -549,7 +552,14 @@ void Analog_Output_Change_Of_Value_Clear( } } -/* returns true if value has changed */ +/** + * For a given object instance-number, loads the value_list with the COV data. + * + * @param object_instance - object-instance number of the object + * @param value_list - list of COV data + * + * @return true if the value list is encoded + */ bool Analog_Output_Encode_Value_List( uint32_t object_instance, BACNET_PROPERTY_VALUE * value_list) @@ -622,7 +632,7 @@ void Analog_Output_COV_Increment_Set( index = Analog_Output_Instance_To_Index(object_instance); CurrentAO = &AO_Descr[index]; CurrentAO->COV_Increment = value; - Analog_Output_COV_Detect(index, Analog_Output_Present_Value(index)); + Analog_Output_COV_Detect(object_instance, Analog_Output_Present_Value(object_instance)); } } @@ -699,7 +709,7 @@ bool Analog_Output_Present_Value_Set( if (priority == 8) { CurrentAO->Priority_Array[15] = value; } - Analog_Output_COV_Detect(index, Analog_Output_Present_Value(index)); + Analog_Output_COV_Detect(object_instance, Analog_Output_Present_Value(object_instance)); status = true; } } @@ -727,7 +737,7 @@ bool Analog_Output_Present_Value_Relinquish( However, if Out of Service is TRUE, then don't set the physical output. This comment may apply to the main loop (i.e. check out of service before changing output) */ - Analog_Output_COV_Detect(index, Analog_Output_Present_Value(index)); + Analog_Output_COV_Detect(object_instance, Analog_Output_Present_Value(object_instance)); status = true; } } diff --git a/demo/object/av.c b/demo/object/av.c index 20d76ca..8ef143a 100644 --- a/demo/object/av.c +++ b/demo/object/av.c @@ -292,6 +292,9 @@ void Analog_Value_Init( AV_Descr[i].Priority_Array[15] = strtof(ucivalue, (char **) NULL); + AV_Descr[i].Prior_Value = strtof(ucivalue, + (char **) NULL); + AV_Descr[i].Relinquish_Default = 0; //TODO read uci ucicov_increment = ucix_get_option(ctx, "bacnet_av", idx_c, @@ -592,7 +595,7 @@ void Analog_Value_COV_Increment_Set( index = Analog_Value_Instance_To_Index(object_instance); CurrentAV = &AV_Descr[index]; CurrentAV->COV_Increment = value; - Analog_Value_COV_Detect(index, Analog_Value_Present_Value(index)); + Analog_Value_COV_Detect(object_instance, Analog_Value_Present_Value(object_instance)); } } @@ -668,7 +671,7 @@ bool Analog_Value_Present_Value_Set( if (priority == 8) { CurrentAV->Priority_Array[15] = value; } - Analog_Value_COV_Detect(index, Analog_Value_Present_Value(index)); + Analog_Value_COV_Detect(object_instance, Analog_Value_Present_Value(object_instance)); status = true; } } @@ -696,7 +699,7 @@ bool Analog_Value_Present_Value_Relinquish( However, if Out of Service is TRUE, then don't set the physical output. This comment may apply to the main loop (i.e. check out of service before changing output) */ - Analog_Value_COV_Detect(index, Analog_Value_Present_Value(index)); + Analog_Value_COV_Detect(object_instance, Analog_Value_Present_Value(object_instance)); status = true; } }