-
Notifications
You must be signed in to change notification settings - Fork 198
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
QGC Parameters #265
QGC Parameters #265
Changes from 3 commits
e0e0dd5
b23da9b
250e003
e51759b
142cbc8
52da3f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,6 @@ def get_original_filename(default_value, new_file_suffix): | |
print("DB access failed:", sys.exc_info()[0], sys.exc_info()[1]) | ||
return default_value | ||
|
||
|
||
if download_type == '1': # download the parameters | ||
ulog = load_ulog_file(log_file_name) | ||
param_keys = sorted(ulog.initial_parameters.keys()) | ||
|
@@ -155,6 +154,75 @@ def kml_colors(flight_mode): | |
except: | ||
pass | ||
|
||
elif download_type == '4': # download QGC parameters | ||
ulog = load_ulog_file(log_file_name) | ||
param_keys = sorted(ulog.initial_parameters.keys()) | ||
|
||
self.set_header("Content-Type", "text/plain") | ||
self.set_header('Content-Disposition', 'inline; filename=vehicle.params') | ||
|
||
delimiter = ' ' | ||
for param_key in param_keys: | ||
self.write("1") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comment that this is the sysid (and compid below)? |
||
self.write(delimiter) | ||
self.write("1") | ||
self.write(delimiter) | ||
self.write(param_key) | ||
self.write(delimiter) | ||
self.write(str(ulog.initial_parameters[param_key])) | ||
|
||
#if the value is an int write a 6, if not write a 9 | ||
if(type(ulog.initial_parameters[param_key]) == int): | ||
self.write(delimiter) | ||
self.write("6") | ||
else: | ||
self.write(delimiter) | ||
self.write("9") | ||
|
||
self.write('\n') | ||
|
||
elif download_type == '5': # download non-default parameters for QGC | ||
ulog = load_ulog_file(log_file_name) | ||
param_keys = sorted(ulog.initial_parameters.keys()) | ||
|
||
self.set_header("Content-Type", "text/plain") | ||
self.set_header('Content-Disposition', 'inline; filename=vehicle-nondefault.params') | ||
delimiter = ' ' | ||
|
||
# Use defaults from log if available | ||
if ulog.has_default_parameters: | ||
system_defaults = ulog.get_default_parameters(0) | ||
airframe_defaults = ulog.get_default_parameters(1) | ||
for param_key in param_keys: | ||
try: | ||
param_value = ulog.initial_parameters[param_key] | ||
is_default = True | ||
if param_key in airframe_defaults: | ||
is_default = param_value == airframe_defaults[param_key] | ||
elif param_key in system_defaults: | ||
is_default = param_value == system_defaults[param_key] | ||
|
||
if not is_default: | ||
self.write("1") | ||
self.write(delimiter) | ||
self.write("1") | ||
self.write(delimiter) | ||
self.write(param_key) | ||
self.write(delimiter) | ||
self.write(str(param_value)) | ||
|
||
#if the value is an int write a 6, if not write a 9 | ||
if(type(param_value) == int): | ||
self.write(delimiter) | ||
self.write("6") | ||
else: | ||
self.write(delimiter) | ||
self.write("9") | ||
|
||
self.write('\n') | ||
except: | ||
pass | ||
|
||
else: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
default_params = get_default_parameters() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this option (but keep the implementation), and just offer the QGC versions.