Modified parseCTRL and readCTRL to return a struct.

- Defined a new struct that contains the information sent by the CTRL command
 - Added some additional validation to parseCTRL.
 - Changed the return type of parseCTRL and removed now redundant pointer parameters.
 - Propagated return type change throughout the plugin code base.
This commit is contained in:
Jason Watkins
2015-04-06 12:40:26 -07:00
parent 04166d3bac
commit a05ddb42be
4 changed files with 72 additions and 45 deletions

View File

@@ -378,12 +378,9 @@ int printBufferToLog(struct XPCMessage & msg)
}
else if (strncmp(msg.head,"CTRL",4)==0)
{// Header = CTRL (Control)
float flaps;
float controls[4];
short gear;
flaps = parseCTRL(msg.msg,controls,&gear);
xpcCtrl ctrl = parseCTRL(msg.msg);
sprintf(logmsg,"%s (%f %f %f) %f %hi %f",logmsg, controls[0], controls[1], controls[2], controls[3] , gear, flaps);
sprintf(logmsg,"%s (%f %f %f) %f %hi %f",logmsg, ctrl.pitch, ctrl.roll, ctrl.yaw, ctrl.throttle, ctrl.gear, ctrl.flaps);
updateLog(logmsg,strlen(logmsg));