Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: param_metadata: do not emit Legacy fields to rst/Wiki #28006

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Tools/autotest/param_metadata/ednemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def emit(self, g):
# remove any keys we don't really care to share
for key in self.remove_keys:
output_dict.pop(key, None)
for key in list(output_dict.keys()):
if not self.should_emit_field(param, key):
output_dict.pop(key, None)

# rearrange bitmasks to be a vector with nil's if the bit doesn't have meaning
if "bitmask" in output_dict:
Expand Down
3 changes: 3 additions & 0 deletions Tools/autotest/param_metadata/emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ def start_libraries(self):

def emit(self, g):
pass

def should_emit_field(self, param, field):
return field not in ['Legacy']
2 changes: 2 additions & 0 deletions Tools/autotest/param_metadata/htmlemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def emit(self, g):
t += "<ul>\n"

for field in param.__dict__.keys():
if not self.should_emit_field(param, field):
continue
if field not in ['name', 'DisplayName', 'Description', 'User', 'SortValues'] and field in known_param_fields:
if field == 'Values' and Emit.prog_values_field.match(param.__dict__[field]):
values = (param.__dict__[field]).split(',')
Expand Down
3 changes: 3 additions & 0 deletions Tools/autotest/param_metadata/jsonemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def emit(self, g):
name = name.split(':')[1]

# Remove various unwanted keys
for key in list(param.__dict__.keys()):
if not self.should_emit_field(param, key):
param.__dict__.pop(key)
for key in 'real_path', 'SortValues', '__field_text':
try:
param.__dict__.pop(key)
Expand Down
2 changes: 2 additions & 0 deletions Tools/autotest/param_metadata/mdemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def emit(self, g):
t += "\n\n%s" % param.Description

for field in param.__dict__.keys():
if not self.should_emit_field(param, field):
continue
if field not in ['name', 'DisplayName', 'Description', 'User', 'SortValues'] and field in known_param_fields:
if field == 'Values' and Emit.prog_values_field.match(param.__dict__[field]):
values = (param.__dict__[field]).split(',')
Expand Down
3 changes: 2 additions & 1 deletion Tools/autotest/param_metadata/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def has_param(self, pname):
'ReadOnly',
'Calibration',
'Vector3Parameter',
'SortValues'
'SortValues',
'Legacy',
]

# Follow SI units conventions from:
Expand Down
5 changes: 5 additions & 0 deletions Tools/autotest/param_metadata/rstemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ def emit(self, g):
reference=reference)

for param in g.params:
if getattr(param, "Legacy", False):
# do not emit legacy parameters to the Wiki
continue
if not hasattr(param, 'DisplayName') or not hasattr(param, 'Description'):
continue
d = param.__dict__
Expand Down Expand Up @@ -263,6 +266,8 @@ def emit(self, g):
headings = []
row = []
for field in sorted(param.__dict__.keys()):
if not self.should_emit_field(param, field):
continue
if (field not in ['name', 'DisplayName', 'Description', 'User', 'SortValues', 'RebootRequired'] and
field in known_param_fields):
headings.append(field)
Expand Down
2 changes: 2 additions & 0 deletions Tools/autotest/param_metadata/xmlemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def emit(self, g):

# Add values as chidren of this node
for field in param.__dict__.keys():
if not self.should_emit_field(param, field):
continue
if field not in ['name', 'DisplayName', 'Description', 'User', 'SortValues'] and field in known_param_fields:
if field == 'Values' and Emit.prog_values_field.match(param.__dict__[field]):
xml_values = etree.SubElement(xml_param, 'values')
Expand Down
1 change: 1 addition & 0 deletions libraries/AP_GPS/AP_GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2002,6 +2002,7 @@ bool AP_GPS::gps_yaw_deg(uint8_t instance, float &yaw_deg, float &accuracy_deg,
// @Values: 0:None,1:AUTO,2:uBlox,5:NMEA,6:SiRF,7:HIL,8:SwiftNav,9:DroneCAN,10:SBF,11:GSOF,13:ERB,14:MAV,15:NOVA,16:HemisphereNMEA,17:uBlox-MovingBaseline-Base,18:uBlox-MovingBaseline-Rover,19:MSP,20:AllyStar,21:ExternalAHRS,22:DroneCAN-MovingBaseline-Base,23:DroneCAN-MovingBaseline-Rover,24:UnicoreNMEA,25:UnicoreMovingBaselineNMEA,26:SBF-DualAntenna
// @RebootRequired: True
// @User: Advanced
// @Legacy: only included here so GCSs running stable can get the description. Omitted in the Wiki.

// @Param: _TYPE2
// @CopyFieldsFrom: GPS_TYPE
Expand Down
Loading