Commit d14b36ee authored by Claes Sjofors's avatar Claes Sjofors

Ge dyn pwrameter type for float added, and set on FillLevel Min and MaxValue

parent b1ee761b
......@@ -1313,6 +1313,11 @@ int attrnav_attr_string_to_value(int type_id, char* value_str, void* buffer_ptr,
return ATTRNAV__INPUT_SYNTAX;
break;
}
case glow_eType_Float: {
if (sscanf(value_str, "%f", (pwr_tFloat32*)buffer_ptr) != 1)
return ATTRNAV__INPUT_SYNTAX;
break;
}
case glow_eType_Double: {
pwr_tFloat32 f;
pwr_tFloat64 d;
......@@ -1387,6 +1392,13 @@ void attrnav_attrvalue_to_string(
*len = snprintf(str, size, format, *(pwr_tBoolean*)value_ptr);
break;
}
case glow_eType_Float: {
if (!format)
*len = snprintf(str, size, "%g", *(float*)value_ptr);
else
*len = snprintf(str, size, format, *(float*)value_ptr);
break;
}
case glow_eType_Double: {
if (!format)
*len = snprintf(str, size, "%g", *(double*)value_ptr);
......@@ -1588,6 +1600,12 @@ int AttrNav::set_attr_value(
message(0, 'E', "Min or maxvalue exceeded");
return 0;
}
} else if (item->type_id == glow_eType_Float) {
if (*(float*)&buffer < item->min_limit
|| *(float*)&buffer > item->max_limit) {
message(0, 'E', "Min or maxvalue exceeded");
return 0;
}
} else if (item->type_id == glow_eType_Int) {
if (*(int*)&buffer < item->min_limit
|| *(int*)&buffer > item->max_limit) {
......
......@@ -14873,12 +14873,12 @@ void GeFillLevel::get_attributes(attr_sItem* attrinfo, int* item_count)
strcpy(attrinfo[i].name, "FillLevel.MinValue");
attrinfo[i].value = &min_value;
attrinfo[i].type = glow_eType_Double;
attrinfo[i].type = glow_eType_Float;
attrinfo[i++].size = sizeof(min_value);
strcpy(attrinfo[i].name, "FillLevel.MaxValue");
attrinfo[i].value = &max_value;
attrinfo[i].type = glow_eType_Double;
attrinfo[i].type = glow_eType_Float;
attrinfo[i++].size = sizeof(max_value);
strcpy(attrinfo[i].name, "FillLevel.MinValueAttr");
......
......@@ -98,7 +98,8 @@ typedef enum {
glow_eType_AnnotType, //!< Type is glow_eAnnotType
glow_eType_DynType2, //!< Type of dynamics mask 2
glow_eType_ActionType2, //!< Type of action mask 2
glow_eType_AppMotion //!< Type is glow_eAppMotion
glow_eType_AppMotion, //!< Type is glow_eAppMotion
glow_eType_Float //!< Type is a float
} glow_eType;
//! Type of Ctx class
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment