forked from Archive/PX4-Autopilot
Revert "systemcmds/param: use PX4_INFO_RAW directly (delete qurt special case)"
This reverts commit 470f24037e
.
This commit is contained in:
parent
cd148cda88
commit
13e875645c
|
@ -73,6 +73,13 @@ enum class COMPARE_ERROR_LEVEL {
|
|||
SILENT = 1,
|
||||
};
|
||||
|
||||
|
||||
#ifdef __PX4_QURT
|
||||
#define PARAM_PRINT PX4_INFO
|
||||
#else
|
||||
#define PARAM_PRINT PX4_INFO_RAW
|
||||
#endif
|
||||
|
||||
static int do_save(const char *param_file_name);
|
||||
static int do_save_default();
|
||||
static int do_load(const char *param_file_name);
|
||||
|
@ -463,10 +470,10 @@ do_save_default()
|
|||
static int
|
||||
do_show(const char *search_string, bool only_changed)
|
||||
{
|
||||
PX4_INFO_RAW("Symbols: x = used, + = saved, * = unsaved\n");
|
||||
PARAM_PRINT("Symbols: x = used, + = saved, * = unsaved\n");
|
||||
// also show unused params if we show non-default values only
|
||||
param_foreach(do_show_print, (char *)search_string, only_changed, !only_changed);
|
||||
PX4_INFO_RAW("\n %u/%u parameters used.\n", param_count_used(), param_count());
|
||||
PARAM_PRINT("\n %u/%u parameters used.\n", param_count_used(), param_count());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -474,19 +481,19 @@ do_show(const char *search_string, bool only_changed)
|
|||
static int
|
||||
do_show_for_airframe()
|
||||
{
|
||||
PX4_INFO_RAW("if [ $AUTOCNF = yes ]\n");
|
||||
PX4_INFO_RAW("then\n");
|
||||
PARAM_PRINT("if [ $AUTOCNF = yes ]\n");
|
||||
PARAM_PRINT("then\n");
|
||||
param_foreach(do_show_print_for_airframe, nullptr, true, true);
|
||||
PX4_INFO_RAW("fi\n");
|
||||
PARAM_PRINT("fi\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
do_show_all()
|
||||
{
|
||||
PX4_INFO_RAW("Symbols: x = used, + = saved, * = unsaved\n");
|
||||
PARAM_PRINT("Symbols: x = used, + = saved, * = unsaved\n");
|
||||
param_foreach(do_show_print, nullptr, false, false);
|
||||
PX4_INFO_RAW("\n %u parameters total, %u used.\n", param_count(), param_count_used());
|
||||
PARAM_PRINT("\n %u parameters total, %u used.\n", param_count(), param_count_used());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -506,14 +513,14 @@ do_show_quiet(const char *param_name)
|
|||
switch (param_type(param)) {
|
||||
case PARAM_TYPE_INT32:
|
||||
if (!param_get(param, &ii)) {
|
||||
PX4_INFO_RAW("%ld", (long)ii);
|
||||
PARAM_PRINT("%ld", (long)ii);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PARAM_TYPE_FLOAT:
|
||||
if (!param_get(param, &ff)) {
|
||||
PX4_INFO_RAW("%4.4f", (double)ff);
|
||||
PARAM_PRINT("%4.4f", (double)ff);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -535,7 +542,7 @@ do_find(const char *name)
|
|||
return 1;
|
||||
}
|
||||
|
||||
PX4_INFO_RAW("Found param %s at index %i\n", name, (int)ret);
|
||||
PARAM_PRINT("Found param %s at index %i\n", name, (int)ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -560,27 +567,27 @@ do_show_index(const char *index, bool used_index)
|
|||
return 1;
|
||||
}
|
||||
|
||||
PX4_INFO_RAW("index %d: %c %c %s [%d,%d] : ", i, (param_used(param) ? 'x' : ' '),
|
||||
PARAM_PRINT("index %d: %c %c %s [%d,%d] : ", i, (param_used(param) ? 'x' : ' '),
|
||||
param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'),
|
||||
param_name(param), param_get_used_index(param), param_get_index(param));
|
||||
|
||||
switch (param_type(param)) {
|
||||
case PARAM_TYPE_INT32:
|
||||
if (!param_get(param, &ii)) {
|
||||
PX4_INFO_RAW("%ld\n", (long)ii);
|
||||
PARAM_PRINT("%ld\n", (long)ii);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PARAM_TYPE_FLOAT:
|
||||
if (!param_get(param, &ff)) {
|
||||
PX4_INFO_RAW("%4.4f\n", (double)ff);
|
||||
PARAM_PRINT("%4.4f\n", (double)ff);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
PX4_INFO_RAW("<unknown type %d>\n", 0 + param_type(param));
|
||||
PARAM_PRINT("<unknown type %d>\n", 0 + param_type(param));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -630,7 +637,7 @@ do_show_print(void *arg, param_t param)
|
|||
}
|
||||
}
|
||||
|
||||
PX4_INFO_RAW("%c %c %s [%d,%d] : ", (param_used(param) ? 'x' : ' '),
|
||||
PARAM_PRINT("%c %c %s [%d,%d] : ", (param_used(param) ? 'x' : ' '),
|
||||
param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'),
|
||||
param_name(param), param_get_used_index(param), param_get_index(param));
|
||||
|
||||
|
@ -641,7 +648,7 @@ do_show_print(void *arg, param_t param)
|
|||
switch (param_type(param)) {
|
||||
case PARAM_TYPE_INT32:
|
||||
if (!param_get(param, &i)) {
|
||||
PX4_INFO_RAW("%ld\n", (long)i);
|
||||
PARAM_PRINT("%ld\n", (long)i);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -649,18 +656,18 @@ do_show_print(void *arg, param_t param)
|
|||
|
||||
case PARAM_TYPE_FLOAT:
|
||||
if (!param_get(param, &f)) {
|
||||
PX4_INFO_RAW("%4.4f\n", (double)f);
|
||||
PARAM_PRINT("%4.4f\n", (double)f);
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
PX4_INFO_RAW("<unknown type %d>\n", 0 + param_type(param));
|
||||
PARAM_PRINT("<unknown type %d>\n", 0 + param_type(param));
|
||||
return;
|
||||
}
|
||||
|
||||
PX4_INFO_RAW("<error fetching parameter %lu>\n", (unsigned long)param);
|
||||
PARAM_PRINT("<error fetching parameter %lu>\n", (unsigned long)param);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -682,19 +689,19 @@ do_show_print_for_airframe(void *arg, param_t param)
|
|||
|
||||
int32_t i;
|
||||
float f;
|
||||
PX4_INFO_RAW("\tparam set %s ", p_name);
|
||||
PARAM_PRINT("\tparam set %s ", p_name);
|
||||
|
||||
switch (param_type(param)) {
|
||||
case PARAM_TYPE_INT32:
|
||||
if (!param_get(param, &i)) {
|
||||
PX4_INFO_RAW("%ld\n", (long)i);
|
||||
PARAM_PRINT("%ld\n", (long)i);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case PARAM_TYPE_FLOAT:
|
||||
if (!param_get(param, &f)) {
|
||||
PX4_INFO_RAW("%4.4f\n", (double)f);
|
||||
PARAM_PRINT("%4.4f\n", (double)f);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -703,7 +710,7 @@ do_show_print_for_airframe(void *arg, param_t param)
|
|||
return;
|
||||
}
|
||||
|
||||
PX4_INFO_RAW("<error fetching parameter %lu>\n", (unsigned long)param);
|
||||
PARAM_PRINT("<error fetching parameter %lu>\n", (unsigned long)param);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -733,11 +740,12 @@ do_set(const char *name, const char *val, bool fail_on_not_found)
|
|||
int32_t newval = strtol(val, &end, 10);
|
||||
|
||||
if (i != newval) {
|
||||
PX4_INFO_RAW("%c %s: curr: %ld -> new: %ld\n",
|
||||
PARAM_PRINT("%c %s: ",
|
||||
param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'),
|
||||
param_name(param),
|
||||
(long)i, (long)newval);
|
||||
param_name(param));
|
||||
PARAM_PRINT("curr: %ld", (long)i);
|
||||
param_set(param, &newval);
|
||||
PARAM_PRINT(" -> new: %ld\n", (long)newval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -754,11 +762,12 @@ do_set(const char *name, const char *val, bool fail_on_not_found)
|
|||
|
||||
if (f != newval) {
|
||||
#pragma GCC diagnostic pop
|
||||
PX4_INFO_RAW("%c %s: curr: %4.4f -> new: %4.4f\n",
|
||||
PARAM_PRINT("%c %s: ",
|
||||
param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'),
|
||||
param_name(param),
|
||||
(double)f, (double)newval);
|
||||
param_name(param));
|
||||
PARAM_PRINT("curr: %4.4f", (double)f);
|
||||
param_set(param, &newval);
|
||||
PARAM_PRINT(" -> new: %4.4f\n", (double)newval);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue