From 8347c2fdacd9868c793bdc1bc9a2ac5c9ffc166e Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 1 Jan 2000 00:24:32 +0900 Subject: added get_float_with_min function --- device-functions.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'device-functions.c') 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", -- cgit