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

Option to not use or save BasicID info to parameters #125

Merged
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
22 changes: 20 additions & 2 deletions RemoteIDModule/RemoteIDModule.ino
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static void set_data(Transport &t)
don't persist the BasicID2 if provided via mavlink to allow
users to change BasicID2 on different days
*/
if (!g.have_basic_id_info()) {
if (!g.have_basic_id_info() && !(g.options & OPTIONS_DONT_SAVE_BASIC_ID_TO_PARAMETERS)) {
if (basic_id.ua_type != 0 &&
basic_id.id_type != 0 &&
strnlen((const char *)basic_id.uas_id, 20) > 0) {
Expand All @@ -205,7 +205,7 @@ static void set_data(Transport &t)
}

// BasicID
if (g.have_basic_id_info()) {
if (g.have_basic_id_info() && !(g.options & OPTIONS_DONT_SAVE_BASIC_ID_TO_PARAMETERS)) {
// from parameters
UAS_data.BasicID[0].UAType = (ODID_uatype_t)g.ua_type;
UAS_data.BasicID[0].IDType = (ODID_idtype_t)g.id_type;
Expand Down Expand Up @@ -235,6 +235,24 @@ static void set_data(Transport &t)
}
}

if (g.options & OPTIONS_DONT_SAVE_BASIC_ID_TO_PARAMETERS) {
if (basic_id.ua_type != 0 &&
basic_id.id_type != 0 &&
strnlen((const char *)basic_id.uas_id, 20) > 0) {
if (strcmp((const char*)UAS_data.BasicID[0].UASID, (const char*)basic_id.uas_id) != 0 && strnlen((const char *)basic_id.uas_id, 20) > 0) {
UAS_data.BasicID[1].UAType = (ODID_uatype_t)basic_id.ua_type;
UAS_data.BasicID[1].IDType = (ODID_idtype_t)basic_id.id_type;
ODID_COPY_STR(UAS_data.BasicID[1].UASID, basic_id.uas_id);
UAS_data.BasicIDValid[1] = 1;
} else {
UAS_data.BasicID[0].UAType = (ODID_uatype_t)basic_id.ua_type;
UAS_data.BasicID[0].IDType = (ODID_idtype_t)basic_id.id_type;
ODID_COPY_STR(UAS_data.BasicID[0].UASID, basic_id.uas_id);
UAS_data.BasicIDValid[0] = 1;
}
}
}

// OperatorID
if (strlen(operator_id.operator_id) > 0) {
UAS_data.OperatorID.OperatorIdType = (ODID_operatorIdType_t)operator_id.operator_id_type;
Expand Down
1 change: 1 addition & 0 deletions RemoteIDModule/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,6 @@ class Parameters {

// bits for OPTIONS parameter
#define OPTIONS_FORCE_ARM_OK 1U<<0
#define OPTIONS_DONT_SAVE_BASIC_ID_TO_PARAMETERS 1U<<1

extern Parameters g;
Loading