1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Added UAVObject sorting to make UAVObj structs align to word-boundaries. Else copying to / from UAVObjects will fail on Cortex M4 with an alignment error, since the proper alignment is not visible to the compiler in a line like this: float* data = UAVObj.Roll; data[2] = yaw;

This commit is contained in:
LM 2011-11-14 08:39:45 +01:00 committed by Mike Smith
parent 084b175290
commit 30b6ae90f3
2 changed files with 10 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
# Exclude temporary and system files
.DS_Store
# /flight/
/flight/*.pnproj

View File

@ -111,6 +111,11 @@ int UAVObjectParser::getNumBytes(int objIndex)
}
}
bool fieldTypeLessThan(const FieldInfo* f1, const FieldInfo* f2)
{
return f1->numBytes > f2->numBytes;
}
/**
* Parse supplied XML file
* @param xml The xml text
@ -200,6 +205,9 @@ QString UAVObjectParser::parseXML(QString& xml, QString& filename)
// Get next element
childNode = childNode.nextSibling();
}
// Sort all fields according to size
qStableSort(info->fields.begin(), info->fields.end(), fieldTypeLessThan);
// Make sure that required elements were found
if ( !accessFound )