1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Merge branch 'next' of ssh://git.openpilot.org/OpenPilot into abeck/OP-1858-autotakeoff

This commit is contained in:
abeck70 2015-04-30 17:34:33 +10:00
commit 17b8ccd6bb
2 changed files with 20 additions and 10 deletions

View File

@ -376,49 +376,48 @@ UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connectionHandle
} }
uint8_t processedBytes = (*position); uint8_t processedBytes = (*position);
uint8_t count = 0;
// stop processing as soon as a complete packet is received, error is encountered or buffer is processed entirely // stop processing as soon as a complete packet is received, error is encountered or buffer is processed entirely
while ((count = length - (*position)) > 0 while ((length > (*position))
&& iproc->state != UAVTALK_STATE_COMPLETE && iproc->state != UAVTALK_STATE_COMPLETE
&& iproc->state != UAVTALK_STATE_ERROR) { && iproc->state != UAVTALK_STATE_ERROR) {
// Receive state machine // Receive state machine
if (iproc->state == UAVTALK_STATE_SYNC && if ((length > (*position)) && iproc->state == UAVTALK_STATE_SYNC &&
!UAVTalkProcess_SYNC(connection, iproc, rxbuffer, length, position)) { !UAVTalkProcess_SYNC(connection, iproc, rxbuffer, length, position)) {
break; break;
} }
if (iproc->state == UAVTALK_STATE_TYPE && if ((length > (*position)) && iproc->state == UAVTALK_STATE_TYPE &&
!UAVTalkProcess_TYPE(connection, iproc, rxbuffer, length, position)) { !UAVTalkProcess_TYPE(connection, iproc, rxbuffer, length, position)) {
break; break;
} }
if (iproc->state == UAVTALK_STATE_SIZE && if ((length > (*position)) && iproc->state == UAVTALK_STATE_SIZE &&
!UAVTalkProcess_SIZE(connection, iproc, rxbuffer, length, position)) { !UAVTalkProcess_SIZE(connection, iproc, rxbuffer, length, position)) {
break; break;
} }
if (iproc->state == UAVTALK_STATE_OBJID && if ((length > (*position)) && iproc->state == UAVTALK_STATE_OBJID &&
!UAVTalkProcess_OBJID(connection, iproc, rxbuffer, length, position)) { !UAVTalkProcess_OBJID(connection, iproc, rxbuffer, length, position)) {
break; break;
} }
if (iproc->state == UAVTALK_STATE_INSTID && if ((length > (*position)) && iproc->state == UAVTALK_STATE_INSTID &&
!UAVTalkProcess_INSTID(connection, iproc, rxbuffer, length, position)) { !UAVTalkProcess_INSTID(connection, iproc, rxbuffer, length, position)) {
break; break;
} }
if (iproc->state == UAVTALK_STATE_TIMESTAMP && if ((length > (*position)) && iproc->state == UAVTALK_STATE_TIMESTAMP &&
!UAVTalkProcess_TIMESTAMP(connection, iproc, rxbuffer, length, position)) { !UAVTalkProcess_TIMESTAMP(connection, iproc, rxbuffer, length, position)) {
break; break;
} }
if (iproc->state == UAVTALK_STATE_DATA && if ((length > (*position)) && iproc->state == UAVTALK_STATE_DATA &&
!UAVTalkProcess_DATA(connection, iproc, rxbuffer, length, position)) { !UAVTalkProcess_DATA(connection, iproc, rxbuffer, length, position)) {
break; break;
} }
if (iproc->state == UAVTALK_STATE_CS && if ((length > (*position)) && iproc->state == UAVTALK_STATE_CS &&
!UAVTalkProcess_CS(connection, iproc, rxbuffer, length, position)) { !UAVTalkProcess_CS(connection, iproc, rxbuffer, length, position)) {
break; break;
} }

View File

@ -115,6 +115,17 @@ $(INITFIELDS)
} }
} }
/**
* Returns a new instance of this UAVDataObject with default field
* values. This is intended to be used by 'reset to default' functionality.
*
* @return new instance of this class with default values.
*/
@Override
public UAVDataObject getDefaultInstance(){
return new $(NAME)();
}
/** /**
* Static function to retrieve an instance of the object. * Static function to retrieve an instance of the object.
*/ */