Bugfix/double float promotion warnings (#605)

* Fixed compile warnings from double-float promotions.

* Changed zephyr compile to suppress deprecation warnings

* Fixed CreateObject API return value in many objects header files

* Changed zephyr build defines as strdup is no longer required for log print of strings
This commit is contained in:
Steve Karg
2024-03-26 09:45:01 -05:00
committed by GitHub
parent 1520f2c612
commit 31ffc8024e
25 changed files with 120 additions and 74 deletions
+44 -25
View File
@@ -81,6 +81,34 @@ void Analog_Input_Property_Lists(
return;
}
/**
* @brief Determine if the object property is a member of this object instance
* @param object_instance - object-instance number of the object
* @param object_property - object-property to be checked
* @return true if the property is a member of this object instance
*/
static bool Property_List_Member(
uint32_t object_instance, int object_property)
{
bool found = false;
const int *pRequired = NULL;
const int *pOptional = NULL;
const int *pProprietary = NULL;
(void)object_instance;
Analog_Input_Property_Lists(
&pRequired, &pOptional, &pProprietary);
found = property_list_member(pRequired, object_property);
if (!found) {
found = property_list_member(pOptional, object_property);
}
if (!found) {
found = property_list_member(pProprietary, object_property);
}
return found;
}
void Analog_Input_Init(void)
{
unsigned i;
@@ -166,7 +194,7 @@ unsigned Analog_Input_Instance_To_Index(uint32_t object_instance)
float Analog_Input_Present_Value(uint32_t object_instance)
{
float value = 0.0;
float value = 0.0f;
unsigned int index;
index = Analog_Input_Instance_To_Index(object_instance);
@@ -179,9 +207,9 @@ float Analog_Input_Present_Value(uint32_t object_instance)
static void Analog_Input_COV_Detect(unsigned int index, float value)
{
float prior_value = 0.0;
float cov_increment = 0.0;
float cov_delta = 0.0;
float prior_value = 0.0f;
float cov_increment = 0.0f;
float cov_delta = 0.0f;
if (index < MAX_ANALOG_INPUTS) {
prior_value = AI_Descr[index].Prior_Value;
@@ -274,6 +302,8 @@ unsigned Analog_Input_Event_State(uint32_t object_instance)
if (index < MAX_ANALOG_INPUTS) {
state = AI_Descr[index].Event_State;
}
#else
(void)object_instance;
#endif
return state;
@@ -352,7 +382,7 @@ bool Analog_Input_Encode_Value_List(
bool out_of_service = false;
const bool fault = false;
const bool overridden = false;
float present_value = 0.0;
float present_value = 0.0f;
unsigned index = 0; /* offset from instance lookup */
index = Analog_Input_Instance_To_Index(object_instance);
@@ -773,7 +803,7 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
status = write_property_type_valid(
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
if (status) {
if (value.type.Real >= 0.0) {
if (value.type.Real >= 0.0f) {
Analog_Input_COV_Increment_Set(
wp_data->object_instance, value.type.Real);
} else {
@@ -874,26 +904,15 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
}
break;
#endif
case PROP_OBJECT_IDENTIFIER:
case PROP_OBJECT_NAME:
case PROP_OBJECT_TYPE:
case PROP_STATUS_FLAGS:
case PROP_EVENT_STATE:
case PROP_DESCRIPTION:
case PROP_RELIABILITY:
#if defined(INTRINSIC_REPORTING)
case PROP_ACKED_TRANSITIONS:
case PROP_EVENT_TIME_STAMPS:
#endif
case 9997:
case 9998:
case 9999:
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
break;
default:
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
if (Property_List_Member(
wp_data->object_instance, wp_data->object_property)) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
}
break;
}