From bb94847511e76c34cf0fbebe874ed4fd6efe1c0c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 5 May 2013 11:43:29 +0200 Subject: Allowed parsing of floating point params from scripts --- src/systemcmds/param/param.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/systemcmds') diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index 56f5317e3..60e61d07b 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * Author: Lorenz Meier * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,7 @@ /** * @file param.c + * @author Lorenz Meier * * Parameter tool. */ @@ -262,7 +263,7 @@ do_set(const char* name, const char* val) switch (param_type(param)) { case PARAM_TYPE_INT32: if (!param_get(param, &i)) { - printf("old: %d", i); + printf("curr: %d", i); /* convert string */ char* end; @@ -276,14 +277,13 @@ do_set(const char* name, const char* val) case PARAM_TYPE_FLOAT: if (!param_get(param, &f)) { - printf("float values are not yet supported."); - // printf("old: %4.4f", (double)f); - - // /* convert string */ - // char* end; - // f = strtof(val,&end); - // param_set(param, &f); - // printf(" -> new: %4.4f\n", f); + printf("curr: %4.4f", (double)f); + + /* convert string */ + char* end; + f = strtod(val,&end); + param_set(param, &f); + printf(" -> new: %f\n", f); } -- cgit v1.2.3