Add Option NO_HELP for CONSTRAINED_FLASH system

This commit is contained in:
David Sidrane
2021-07-14 14:49:37 -07:00
committed by Daniel Agar
parent d08d0443bc
commit ced366b74e
2 changed files with 46 additions and 1 deletions
+39
View File
@@ -60,8 +60,12 @@ void PRINT_MODULE_DESCRIPTION(const char *description)
void PRINT_MODULE_USAGE_NAME(const char *executable_name, const char *category)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
PX4_INFO_RAW("Usage: %s <command> [arguments...]\n", executable_name);
PX4_INFO_RAW(" Commands:\n");
#else
PX4_INFO_RAW("Usage: %s See:" CONSTRAINED_FLASH_NO_HELP "\n", executable_name);
#endif
}
void PRINT_MODULE_USAGE_SUBCATEGORY(const char *subcategory)
@@ -71,26 +75,36 @@ void PRINT_MODULE_USAGE_SUBCATEGORY(const char *subcategory)
void PRINT_MODULE_USAGE_NAME_SIMPLE(const char *executable_name, const char *category)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
PX4_INFO_RAW("Usage: %s [arguments...]\n", executable_name);
#endif
}
void PRINT_MODULE_USAGE_COMMAND_DESCR(const char *name, const char *description)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
if (description) {
PX4_INFO_RAW("\n %-13s %s\n", name, description);
} else {
PX4_INFO_RAW("\n %s\n", name);
}
#endif
}
void PRINT_MODULE_USAGE_PARAM_COMMENT(const char *comment)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
PX4_INFO_RAW("\n %s\n", comment);
#endif
}
void PRINT_MODULE_USAGE_PARAMS_I2C_SPI_DRIVER(bool i2c_support, bool spi_support)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
// Note: this must be kept in sync with Tools/px4moduledoc/srcparser.py
if (i2c_support) {
PRINT_MODULE_USAGE_PARAM_FLAG('I', "Internal I2C bus(es)", true);
@@ -112,21 +126,28 @@ void PRINT_MODULE_USAGE_PARAMS_I2C_SPI_DRIVER(bool i2c_support, bool spi_support
PRINT_MODULE_USAGE_PARAM_INT('f', -1, 0, 100000, "bus frequency in kHz", true);
PRINT_MODULE_USAGE_PARAM_FLAG('q', "quiet startup (no message if no device found)", true);
#endif
}
void PRINT_MODULE_USAGE_PARAMS_I2C_ADDRESS(uint8_t default_address)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
PRINT_MODULE_USAGE_PARAM_INT('a', default_address, 0, 0xff, "I2C address", true);
#endif
}
void PRINT_MODULE_USAGE_PARAMS_I2C_KEEP_RUNNING_FLAG()
{
#ifndef CONSTRAINED_FLASH_NO_HELP
PRINT_MODULE_USAGE_PARAM_FLAG('k', "if initialization (probing) fails, keep retrying periodically", true);
#endif
}
void PRINT_MODULE_USAGE_PARAM_INT(char option_char, int default_val, int min_val, int max_val,
const char *description, bool is_optional)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
if (is_optional) {
PX4_INFO_RAW(" [-%c <val>] %s\n", option_char, description);
@@ -137,11 +158,15 @@ void PRINT_MODULE_USAGE_PARAM_INT(char option_char, int default_val, int min_val
} else {
PX4_INFO_RAW(" -%c <val> %s\n", option_char, description);
}
#endif
}
void PRINT_MODULE_USAGE_PARAM_FLOAT(char option_char, float default_val, float min_val, float max_val,
const char *description, bool is_optional)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
if (is_optional) {
PX4_INFO_RAW(" [-%c <val>] %s\n", option_char, description);
@@ -152,21 +177,29 @@ void PRINT_MODULE_USAGE_PARAM_FLOAT(char option_char, float default_val, float m
} else {
PX4_INFO_RAW(" -%c <val> %s\n", option_char, description);
}
#endif
}
void PRINT_MODULE_USAGE_PARAM_FLAG(char option_char, const char *description, bool is_optional)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
if (is_optional) {
PX4_INFO_RAW(" [-%c] %s\n", option_char, description);
} else {
PX4_INFO_RAW(" -%c %s\n", option_char, description);
}
#endif
}
void PRINT_MODULE_USAGE_PARAM_STRING(char option_char, const char *default_val, const char *values,
const char *description, bool is_optional)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
if (is_optional) {
PX4_INFO_RAW(" [-%c <val>] %s\n", option_char, description);
@@ -187,16 +220,22 @@ void PRINT_MODULE_USAGE_PARAM_STRING(char option_char, const char *default_val,
PX4_INFO_RAW(" default: %s\n", default_val);
}
}
#endif
}
void PRINT_MODULE_USAGE_ARG(const char *values, const char *description, bool is_optional)
{
#ifndef CONSTRAINED_FLASH_NO_HELP
if (is_optional) {
PX4_INFO_RAW(" [%-9s] %s\n", values, description);
} else {
PX4_INFO_RAW(" %-11s %s\n", values, description);
}
#endif
}