Skip to content

Commit

Permalink
PR2
Browse files Browse the repository at this point in the history
  • Loading branch information
BluemarkInnovations committed Mar 14, 2023
1 parent d9949ca commit b719587
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions RemoteIDModule/RemoteIDModule.ino
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static WebInterface webif;
#include "soc/rtc_cntl_reg.h"

static bool arm_check_ok = false; // goes true for LED arm check status
static bool pfst_check_ok = false;
static bool pfst_check_ok = false;

/*
setup serial ports
Expand Down Expand Up @@ -127,32 +127,32 @@ void setup()
*/
static const char *check_parse(void)
{
static char return_string[50];
static char return_string[50]; //if all errors would occur in this function, it will fit in 50 chars that is also the max for the arm status message
strcpy (return_string, "bad ");

{
ODID_Location_encoded encoded {};
if (encodeLocationMessage(&encoded, &UAS_data.Location) != ODID_SUCCESS) {
strcat(return_string, "LOCATION ");
strcat(return_string, "LOC ");
}
}
{
ODID_System_encoded encoded {};
if (encodeSystemMessage(&encoded, &UAS_data.System) != ODID_SUCCESS) {
strcat(return_string, "SYSTEM ");
strcat(return_string, "SYS ");
}
}
{
ODID_BasicID_encoded encoded {};
if (UAS_data.BasicIDValid[0] == 1) {
if (encodeBasicIDMessage(&encoded, &UAS_data.BasicID[0]) != ODID_SUCCESS) {
strcat(return_string, "BASIC_ID_1");
strcat(return_string, "ID_1 ");
}
}
memset(&encoded, 0, sizeof(encoded));
if (UAS_data.BasicIDValid[1] == 1) {
if (encodeBasicIDMessage(&encoded, &UAS_data.BasicID[1]) != ODID_SUCCESS) {
strcat(return_string, "BASIC_ID_2");
strcat(return_string, "ID_2 ");
}
}
}
Expand All @@ -165,11 +165,11 @@ static const char *check_parse(void)
{
ODID_OperatorID_encoded encoded {};
if (encodeOperatorIDMessage(&encoded, &UAS_data.OperatorID) != ODID_SUCCESS) {
strcat(return_string, "OPERATOR_ID ");
strcat(return_string, "OP_ID ");
}
}
if (strlen(return_string) > 4) { //only return error messag if one or more encoding functions failed
strcat(return_string, "data");
strcat(return_string, "data ");
return return_string;
}
return nullptr;
Expand Down Expand Up @@ -290,9 +290,7 @@ static void set_data(Transport &t)
}

const char *reason = check_parse();
if (reason == nullptr) {
t.arm_status_check(reason);
}
t.arm_status_check(reason);
t.set_parse_fail(reason);

arm_check_ok = (reason==nullptr);
Expand Down

0 comments on commit b719587

Please sign in to comment.