From 568c2638e862ae029e7de860a68c253f0629d0dd Mon Sep 17 00:00:00 2001 From: Mateusz Szafoni Date: Sun, 5 Nov 2017 14:18:08 +0000 Subject: [PATCH] Merged in raiden00/apps (pull request #121) smps, powerled examples: fix floating point format in printf Approved-by: Gregory Nutt --- examples/powerled/powerled_main.c | 8 ++++---- examples/smps/smps_main.c | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/powerled/powerled_main.c b/examples/powerled/powerled_main.c index c679e3652..f2e3af014 100644 --- a/examples/powerled/powerled_main.c +++ b/examples/powerled/powerled_main.c @@ -533,7 +533,7 @@ int powerled_main(int argc, char *argv[]) config = false; } - printf("Brightness is %0.2f\n", powerled_params.brightness); + printf("Brightness is %.2f\n", powerled_params.brightness); /* Set Powerled parameters */ @@ -591,13 +591,13 @@ int powerled_main(int argc, char *argv[]) printf("failed to set powerled mode %d \n", ret); } - printf("Brightness is %0.2f\n", powerled_params.brightness); - printf("Duty is %0.2f\n", powerled_params.duty); + printf("Brightness is %.2f\n", powerled_params.brightness); + printf("Duty is %.2f\n", powerled_params.duty); config = false; } - printf("Frequency is %0.2f\n", powerled_params.frequency); + printf("Frequency is %.2f\n", powerled_params.frequency); /* Set Powerled parameters */ diff --git a/examples/smps/smps_main.c b/examples/smps/smps_main.c index b09c9b573..aa9d8ffcc 100644 --- a/examples/smps/smps_main.c +++ b/examples/smps/smps_main.c @@ -336,21 +336,21 @@ static int validate_args(FAR struct args_s *args) if (args->current < 0 || args->current > (((float)CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT)/1000.0)) { - printf("Not valid current value: %0.2f\n", args->current); + printf("Not valid current value: %.2f\n", args->current); goto errout; } if (args->voltage < 0 || args->voltage > (((float)CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT)/1000.0)) { - printf("Not valid voltage value: %0.2f\n", args->voltage); + printf("Not valid voltage value: %.2f\n", args->voltage); goto errout; } if (args->power < 0 || args->power > (((float)CONFIG_EXAMPLES_SMPS_OUT_POWER_LIMIT)/1000.0)) { - printf("Not valid power value: %0.2f\n", args->power); + printf("Not valid power value: %.2f\n", args->power); goto errout; } @@ -397,22 +397,22 @@ void print_info(struct smps_limits_s *limits, struct smps_params_s *params, printf("\n"); #if CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT > 0 - printf(" Output voltage limit set to %0.2f\n", limits->v_out); + printf(" Output voltage limit set to %.2f\n", limits->v_out); #endif #if CONFIG_EXAMPLES_SMPS_IN_VOLTAGE_LIMIT > 0 - printf(" Input voltage limit set to %0.2f\n", limits->v_in); + printf(" Input voltage limit set to %.2f\n", limits->v_in); #endif #if CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT > 0 - printf(" Output current limit set to %0.2f\n", limits->i_out); + printf(" Output current limit set to %.2f\n", limits->i_out); #endif #if CONFIG_EXAMPLES_SMPS_IN_CURRENT_LIMIT > 0 - printf(" Input current limit set to %0.2f\n", limits->i_in); + printf(" Input current limit set to %.2f\n", limits->i_in); #endif #if CONFIG_EXAMPLES_SMPS_OUT_POWER_LIMIT > 0 - printf(" Output power limit set to %0.2f\n", limits->p_out); + printf(" Output power limit set to %.2f\n", limits->p_out); #endif #if CONFIG_EXAMPLES_SMPS_IN_POWER_LIMIT > 0 - printf(" Input power limit set to %0.2f\n", limits->p_in); + printf(" Input power limit set to %.2f\n", limits->p_in); #endif printf("\n"); @@ -421,17 +421,17 @@ void print_info(struct smps_limits_s *limits, struct smps_params_s *params, if (params->v_out > 0) { - printf(" Output voltage set to %0.2f\n", params->v_out); + printf(" Output voltage set to %.2f\n", params->v_out); } if (params->i_out > 0) { - printf(" Output current set to %0.2f\n", params->i_out); + printf(" Output current set to %.2f\n", params->i_out); } if (params->p_out > 0) { - printf(" Output power set to %0.2f\n", params->p_out); + printf(" Output power set to %.2f\n", params->p_out); } printf("-------------------------------------\n\n");