mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Merge branch 'amorale/OP-1232_eventsys_warn_on_high_telem_update_rate' into next
This commit is contained in:
commit
f9abb1d8c1
@ -128,6 +128,7 @@ int32_t CameraStabInitialize(void)
|
||||
.obj = AttitudeStateHandle(),
|
||||
.instId = 0,
|
||||
.event = 0,
|
||||
.lowPriority = false,
|
||||
};
|
||||
EventPeriodicCallbackCreate(&ev, attitudeUpdated, SAMPLE_PERIOD_MS / portTICK_RATE_MS);
|
||||
|
||||
|
@ -73,7 +73,12 @@ int32_t LoggingStart(void)
|
||||
FlightStatusConnectCallback(FlightStatusUpdatedCb);
|
||||
SettingsUpdatedCb(DebugLogSettingsHandle());
|
||||
|
||||
UAVObjEvent ev = { .obj = DebugLogSettingsHandle(), .instId = 0, .event = EV_UPDATED_PERIODIC };
|
||||
UAVObjEvent ev = {
|
||||
.obj = DebugLogSettingsHandle(),
|
||||
.instId = 0,
|
||||
.event = EV_UPDATED_PERIODIC,
|
||||
.lowPriority = true,
|
||||
};
|
||||
EventPeriodicCallbackCreate(&ev, StatusUpdatedCb, 1000);
|
||||
// invoke a periodic dispatcher callback - the event struct is a dummy, it could be filled with anything!
|
||||
StatusUpdatedCb(&ev);
|
||||
|
@ -268,6 +268,7 @@ static void registerObject(UAVObjHandle obj)
|
||||
.obj = obj,
|
||||
.instId = UAVOBJ_ALL_INSTANCES,
|
||||
.event = EV_UPDATED_PERIODIC,
|
||||
.lowPriority = true,
|
||||
};
|
||||
|
||||
// Get metadata
|
||||
|
@ -476,6 +476,7 @@ static int32_t setUpdatePeriod(UAVObjHandle obj, int32_t updatePeriodMs)
|
||||
ev.obj = obj;
|
||||
ev.instId = UAVOBJ_ALL_INSTANCES;
|
||||
ev.event = EV_UPDATED_PERIODIC;
|
||||
ev.lowPriority = true;
|
||||
|
||||
xQueueHandle targetQueue = UAVObjIsPriority(obj) ? priorityQueue : queue;
|
||||
|
||||
@ -502,6 +503,7 @@ static int32_t setLoggingPeriod(UAVObjHandle obj, int32_t updatePeriodMs)
|
||||
ev.obj = obj;
|
||||
ev.instId = UAVOBJ_ALL_INSTANCES;
|
||||
ev.event = EV_LOGGING_PERIODIC;
|
||||
ev.lowPriority = true;
|
||||
|
||||
xQueueHandle targetQueue = UAVObjIsPriority(obj) ? priorityQueue : queue;
|
||||
|
||||
|
@ -111,6 +111,7 @@ int32_t TxPIDInitialize(void)
|
||||
.obj = AccessoryDesiredHandle(),
|
||||
.instId = 0,
|
||||
.event = 0,
|
||||
.lowPriority = false,
|
||||
};
|
||||
EventPeriodicCallbackCreate(&ev, updatePIDs, SAMPLE_PERIOD_MS / portTICK_RATE_MS);
|
||||
|
||||
|
@ -55,6 +55,7 @@ typedef struct {
|
||||
UAVObjEvent ev; /** The actual event */
|
||||
UAVObjEventCallback cb; /** The callback function, or zero if none */
|
||||
xQueueHandle queue; /** The queue or zero if none */
|
||||
bool lowpriority; /** set to true for telemetry and other low priority stuffs, prevent raising warning */
|
||||
} EventCallbackInfo;
|
||||
|
||||
/**
|
||||
@ -341,7 +342,7 @@ static int32_t processPeriodicUpdates()
|
||||
}
|
||||
// Push event to queue, if one
|
||||
if (objEntry->evInfo.queue != 0) {
|
||||
if (xQueueSend(objEntry->evInfo.queue, &objEntry->evInfo.ev, 0) != pdTRUE) { // do not block if queue is full
|
||||
if (xQueueSend(objEntry->evInfo.queue, &objEntry->evInfo.ev, 0) != pdTRUE && !objEntry->evInfo.ev.lowPriority) { // do not block if queue is full
|
||||
if (objEntry->evInfo.ev.obj != NULL) {
|
||||
mStats.lastErrorID = UAVObjGetID(objEntry->evInfo.ev.obj);
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ typedef struct {
|
||||
UAVObjHandle obj;
|
||||
uint16_t instId;
|
||||
UAVObjEventType event;
|
||||
bool lowPriority; /* if true prevents raising warnings */
|
||||
} UAVObjEvent;
|
||||
|
||||
/**
|
||||
|
@ -1739,6 +1739,7 @@ static int32_t sendEvent(struct UAVOBase *obj, uint16_t instId, UAVObjEventType
|
||||
.obj = (UAVObjHandle)obj,
|
||||
.event = triggered_event,
|
||||
.instId = instId,
|
||||
.lowPriority = false,
|
||||
};
|
||||
|
||||
// Go through each object and push the event message in the queue (if event is activated for the queue)
|
||||
|
Loading…
Reference in New Issue
Block a user