mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-29 19:57:12 +08:00
docs: put RC modules into their own category (#24847)
This commit is contained in:
@@ -40,25 +40,25 @@ The generated files will be written to the `modules` directory.
|
|||||||
## Categories
|
## Categories
|
||||||
"""
|
"""
|
||||||
for category in sorted(module_groups):
|
for category in sorted(module_groups):
|
||||||
result += "- [%s](modules_%s.md)\n" % (category.capitalize(), category)
|
result += f"- [{category.capitalize()}](modules_{category}.md)\n"
|
||||||
|
|
||||||
self._outputs['main'] = result
|
self._outputs['main'] = result
|
||||||
|
|
||||||
for category in sorted(module_groups):
|
for category in sorted(module_groups):
|
||||||
result = "# Modules Reference: %s\n" % category.capitalize()
|
result = f"# Modules Reference: {category.capitalize()}\n\n"
|
||||||
subcategories = module_groups[category]
|
subcategories = module_groups[category]
|
||||||
|
|
||||||
if len(subcategories) > 1:
|
if len(subcategories) > 1:
|
||||||
result += 'Subcategories:\n'
|
result += 'Subcategories:\n\n'
|
||||||
for subcategory in subcategories:
|
for subcategory in sorted(subcategories):
|
||||||
if subcategory == '':
|
if subcategory == '':
|
||||||
continue
|
continue
|
||||||
subcategory_label = subcategory.replace('_', ' ').title()
|
subcategory_label = subcategory.replace('_', ' ').title()
|
||||||
subcategory_file_name = category+'_'+subcategory
|
subcategory_file_name = category+'_'+subcategory
|
||||||
result += '- [%s](modules_%s.md)\n' % (subcategory_label, subcategory_file_name)
|
result += f'- [{subcategory_label}](modules_{subcategory_file_name}.md)\n'
|
||||||
|
|
||||||
# add a sub-page for the subcategory
|
# add a sub-page for the subcategory
|
||||||
result_subpage = '# Modules Reference: %s (%s)\n' % \
|
result_subpage = f'# Modules Reference: {subcategory_label} ({category.capitalize()})\n'
|
||||||
(subcategory_label, category.capitalize())
|
|
||||||
result_subpage += self._ProcessModules(subcategories[subcategory])
|
result_subpage += self._ProcessModules(subcategories[subcategory])
|
||||||
self._outputs[subcategory_file_name] = result_subpage
|
self._outputs[subcategory_file_name] = result_subpage
|
||||||
|
|
||||||
@@ -68,14 +68,14 @@ The generated files will be written to the `modules` directory.
|
|||||||
def _ProcessModules(self, module_list):
|
def _ProcessModules(self, module_list):
|
||||||
result = ''
|
result = ''
|
||||||
for module in module_list:
|
for module in module_list:
|
||||||
result += "## %s\n" % module.name()
|
result += f"\n## {module.name()}\n\n"
|
||||||
result += "Source: [%s](https://github.com/PX4/PX4-Autopilot/tree/main/src/%s)\n\n" % (module.scope(), module.scope())
|
result += f"Source: [{module.scope()}](https://github.com/PX4/PX4-Autopilot/tree/main/src/{module.scope()})\n\n"
|
||||||
doc = module.documentation()
|
doc = module.documentation()
|
||||||
if len(doc) > 0:
|
if len(doc) > 0:
|
||||||
result += "%s\n" % doc
|
result += f"{doc}\n"
|
||||||
usage_string = module.usage_string()
|
usage_string = module.usage_string()
|
||||||
if len(usage_string) > 0:
|
if len(usage_string) > 0:
|
||||||
result += '<a id="%s_usage"></a>\n### Usage\n```\n%s\n```\n' % (module.name(), usage_string)
|
result += f'### Usage {{#{module.name()}_usage}}\n\n```\n{usage_string}\n```\n'
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def Save(self, dirname):
|
def Save(self, dirname):
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ class ModuleDocumentation(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# If you add categories or subcategories, they also need to be added to the
|
# If you add categories or subcategories, they also need to be added to the
|
||||||
# TOC in https://github.com/PX4/PX4-user_guide/blob/main/en/SUMMARY.md
|
# TOC in https://github.com/PX4/PX4-Autopilot/blob/main/docs/en/SUMMARY.md
|
||||||
valid_categories = ['driver', 'estimator', 'controller', 'system',
|
valid_categories = ['driver', 'estimator', 'controller', 'system',
|
||||||
'communication', 'command', 'template', 'simulation', 'autotune']
|
'communication', 'command', 'template', 'simulation', 'autotune']
|
||||||
valid_subcategories = ['', 'camera', 'distance_sensor', 'imu', 'ins', 'airspeed_sensor',
|
valid_subcategories = ['', 'camera', 'distance_sensor', 'imu', 'ins', 'airspeed_sensor',
|
||||||
'magnetometer', 'baro', 'optical_flow', 'rpm_sensor', 'transponder']
|
'magnetometer', 'baro', 'optical_flow', 'radio_control','rpm_sensor', 'transponder']
|
||||||
|
|
||||||
max_line_length = 80 # wrap lines that are longer than this
|
max_line_length = 80 # wrap lines that are longer than this
|
||||||
|
|
||||||
|
|||||||
@@ -526,6 +526,7 @@ This module parses the CRSF RC uplink protocol and generates CRSF downlink telem
|
|||||||
)DESCR_STR");
|
)DESCR_STR");
|
||||||
|
|
||||||
PRINT_MODULE_USAGE_NAME("crsf_rc", "driver");
|
PRINT_MODULE_USAGE_NAME("crsf_rc", "driver");
|
||||||
|
PRINT_MODULE_USAGE_SUBCATEGORY("radio_control");
|
||||||
PRINT_MODULE_USAGE_COMMAND("start");
|
PRINT_MODULE_USAGE_COMMAND("start");
|
||||||
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
||||||
|
|
||||||
|
|||||||
@@ -399,6 +399,7 @@ This module does Spektrum DSM RC input parsing.
|
|||||||
)DESCR_STR");
|
)DESCR_STR");
|
||||||
|
|
||||||
PRINT_MODULE_USAGE_NAME("dsm_rc", "driver");
|
PRINT_MODULE_USAGE_NAME("dsm_rc", "driver");
|
||||||
|
PRINT_MODULE_USAGE_SUBCATEGORY("radio_control");
|
||||||
PRINT_MODULE_USAGE_COMMAND("start");
|
PRINT_MODULE_USAGE_COMMAND("start");
|
||||||
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
||||||
|
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ This module does Ghost (GHST) RC input parsing.
|
|||||||
)DESCR_STR");
|
)DESCR_STR");
|
||||||
|
|
||||||
PRINT_MODULE_USAGE_NAME("ghst_rc", "driver");
|
PRINT_MODULE_USAGE_NAME("ghst_rc", "driver");
|
||||||
|
PRINT_MODULE_USAGE_SUBCATEGORY("radio_control");
|
||||||
PRINT_MODULE_USAGE_COMMAND("start");
|
PRINT_MODULE_USAGE_COMMAND("start");
|
||||||
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
||||||
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
|
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ This module does SBUS RC input parsing.
|
|||||||
)DESCR_STR");
|
)DESCR_STR");
|
||||||
|
|
||||||
PRINT_MODULE_USAGE_NAME("sbus_rc", "driver");
|
PRINT_MODULE_USAGE_NAME("sbus_rc", "driver");
|
||||||
|
PRINT_MODULE_USAGE_SUBCATEGORY("radio_control");
|
||||||
PRINT_MODULE_USAGE_COMMAND("start");
|
PRINT_MODULE_USAGE_COMMAND("start");
|
||||||
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
||||||
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
|
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
|
||||||
|
|||||||
@@ -1018,6 +1018,7 @@ This module does the RC input parsing and auto-selecting the method. Supported m
|
|||||||
)DESCR_STR");
|
)DESCR_STR");
|
||||||
|
|
||||||
PRINT_MODULE_USAGE_NAME("rc_input", "driver");
|
PRINT_MODULE_USAGE_NAME("rc_input", "driver");
|
||||||
|
PRINT_MODULE_USAGE_SUBCATEGORY("radio_control");
|
||||||
PRINT_MODULE_USAGE_COMMAND("start");
|
PRINT_MODULE_USAGE_COMMAND("start");
|
||||||
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS3", "<file:dev>", "RC device", true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user