mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
OP-1212 handle priority queues for setUpdatePeriod and setLoggingPeriod
This commit is contained in:
parent
4a29db4983
commit
7a39d93952
@ -268,6 +268,7 @@ static void updateObject(UAVObjHandle obj, int32_t eventType)
|
|||||||
eventMask |= EV_LOGGING_MANUAL;
|
eventMask |= EV_LOGGING_MANUAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// note that all setting objects have implicitly IsPriority=true
|
||||||
if (UAVObjIsPriority(obj)) {
|
if (UAVObjIsPriority(obj)) {
|
||||||
UAVObjConnectQueue(obj, priorityQueue, eventMask);
|
UAVObjConnectQueue(obj, priorityQueue, eventMask);
|
||||||
} else {
|
} else {
|
||||||
@ -375,7 +376,7 @@ static void telemetryTxTask(__attribute__((unused)) void *parameters)
|
|||||||
*/
|
*/
|
||||||
#if defined(PIOS_TELEM_PRIORITY_QUEUE)
|
#if defined(PIOS_TELEM_PRIORITY_QUEUE)
|
||||||
// Loop forever
|
// Loop forever
|
||||||
while (xQueueReceive(priorityQueue, &ev, 1) == pdTRUE) {
|
while (xQueueReceive(priorityQueue, &ev, 0) == pdTRUE) {
|
||||||
// Process event
|
// Process event
|
||||||
processObjEvent(&ev);
|
processObjEvent(&ev);
|
||||||
}
|
}
|
||||||
@ -476,9 +477,11 @@ static int32_t setUpdatePeriod(UAVObjHandle obj, int32_t updatePeriodMs)
|
|||||||
ev.instId = UAVOBJ_ALL_INSTANCES;
|
ev.instId = UAVOBJ_ALL_INSTANCES;
|
||||||
ev.event = EV_UPDATED_PERIODIC;
|
ev.event = EV_UPDATED_PERIODIC;
|
||||||
|
|
||||||
ret = EventPeriodicQueueUpdate(&ev, queue, updatePeriodMs);
|
xQueueHandle targetQueue = UAVObjIsPriority(obj) ? priorityQueue : queue;
|
||||||
|
|
||||||
|
ret = EventPeriodicQueueUpdate(&ev, targetQueue, updatePeriodMs);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
ret = EventPeriodicQueueCreate(&ev, queue, updatePeriodMs);
|
ret = EventPeriodicQueueCreate(&ev, targetQueue, updatePeriodMs);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -500,9 +503,11 @@ static int32_t setLoggingPeriod(UAVObjHandle obj, int32_t updatePeriodMs)
|
|||||||
ev.instId = UAVOBJ_ALL_INSTANCES;
|
ev.instId = UAVOBJ_ALL_INSTANCES;
|
||||||
ev.event = EV_LOGGING_PERIODIC;
|
ev.event = EV_LOGGING_PERIODIC;
|
||||||
|
|
||||||
ret = EventPeriodicQueueUpdate(&ev, queue, updatePeriodMs);
|
xQueueHandle targetQueue = UAVObjIsPriority(obj) ? priorityQueue : queue;
|
||||||
|
|
||||||
|
ret = EventPeriodicQueueUpdate(&ev, targetQueue, updatePeriodMs);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
ret = EventPeriodicQueueCreate(&ev, queue, updatePeriodMs);
|
ret = EventPeriodicQueueCreate(&ev, targetQueue, updatePeriodMs);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user