1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-1122 OP-1125 fixed defect raised in OPReview-593 : two occurences of connection->respObj clearing were removed when they should not have been removed

This commit is contained in:
Philippe Renon 2013-12-01 21:44:14 +01:00
parent f2115e270f
commit ab89d6a491

View File

@ -301,7 +301,9 @@ static int32_t objectTransaction(UAVTalkConnectionData *connection, uint8_t type
if (respReceived == pdFALSE) {
// Cancel transaction
xSemaphoreTakeRecursive(connection->lock, portMAX_DELAY);
xSemaphoreTake(connection->respSema, 0); // non blocking call to make sure the value is reset to zero (binary sema)
// non blocking call to make sure the value is reset to zero (binary sema)
xSemaphoreTake(connection->respSema, 0);
connection->respObjId = 0;
xSemaphoreGiveRecursive(connection->lock);
xSemaphoreGiveRecursive(connection->transLock);
return -1;
@ -814,8 +816,9 @@ static int32_t receiveObject(UAVTalkConnectionData *connection,
*/
static void updateAck(UAVTalkConnectionData *connection, uint8_t type, uint32_t objId, uint16_t instId)
{
if (connection->respType == type && connection->respObjId == objId && (connection->respInstId == instId || connection->respInstId == UAVOBJ_ALL_INSTANCES)) {
if ((connection->respType == type) && (connection->respObjId == objId) && ((connection->respInstId == instId) || (connection->respInstId == UAVOBJ_ALL_INSTANCES))) {
xSemaphoreGive(connection->respSema);
connection->respObjId = 0;
}
}