summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
authorMike <mjc@avtechpulse.com>2000-01-01 00:24:32 +0900
committerMike <mjc@avtechpulse.com>2000-01-01 00:24:32 +0900
commit8347c2fdacd9868c793bdc1bc9a2ac5c9ffc166e (patch)
treea6be7ef2e4589f474564fde9210b83b0a528c0df /device-functions.c
parentd476aebf54714ff2ea2d80873b55979dd577be88 (diff)
added get_float_with_min function
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/device-functions.c b/device-functions.c
index 24685b9..ccedec6 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -77,6 +77,22 @@ static float get_bounded_float (float val_in, float default_val)
}
+static float get_float_with_min (float val_in, float default_val)
+{
+ // limits returned value within +2 / -0 order of magnitude
+
+ if (val_in > 100.0 * default_val) {
+ return default_val;
+ }
+
+ if (val_in < default_val) {
+ return default_val;
+ }
+
+ return val_in;
+}
+
+
void idn_string(gchar** response)
{
*response = g_strdup_printf ("AVTECH ELECTROSYSTEMS,%s,SN:%s,v%s",