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:
parent
084b175290
commit
30b6ae90f3
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
# Exclude temporary and system files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
# /flight/
|
# /flight/
|
||||||
/flight/*.pnproj
|
/flight/*.pnproj
|
||||||
|
@ -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
|
* Parse supplied XML file
|
||||||
* @param xml The xml text
|
* @param xml The xml text
|
||||||
@ -200,6 +205,9 @@ QString UAVObjectParser::parseXML(QString& xml, QString& filename)
|
|||||||
// Get next element
|
// Get next element
|
||||||
childNode = childNode.nextSibling();
|
childNode = childNode.nextSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort all fields according to size
|
||||||
|
qStableSort(info->fields.begin(), info->fields.end(), fieldTypeLessThan);
|
||||||
|
|
||||||
// Make sure that required elements were found
|
// Make sure that required elements were found
|
||||||
if ( !accessFound )
|
if ( !accessFound )
|
||||||
|
Loading…
Reference in New Issue
Block a user