mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
When the event system or object manager has an error store the object ID in the
SystemStats.
This commit is contained in:
parent
a319a6b14c
commit
f4663b98e4
@ -457,11 +457,21 @@ static void updateSystemAlarms()
|
||||
EventGetStats(&evStats);
|
||||
UAVObjClearStats();
|
||||
EventClearStats();
|
||||
if (objStats.eventErrors > 0 || evStats.eventErrors > 0) {
|
||||
if (objStats.eventCallbackErrors > 0 || objStats.eventQueueErrors > 0 || evStats.eventErrors > 0) {
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_EVENTSYSTEM, SYSTEMALARMS_ALARM_WARNING);
|
||||
} else {
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_EVENTSYSTEM);
|
||||
}
|
||||
|
||||
if (objStats.lastCallbackErrorID || objStats.lastQueueErrorID || evStats.lastErrorID) {
|
||||
SystemStatsData sysStats;
|
||||
SystemStatsGet(&sysStats);
|
||||
sysStats.EventSystemWarningID = evStats.lastErrorID;
|
||||
sysStats.ObjectManagerCallbackID = objStats.lastCallbackErrorID;
|
||||
sysStats.ObjectManagerQueueID = objStats.lastQueueErrorID;
|
||||
SystemStatsSet(&sysStats);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -350,6 +350,7 @@ static int32_t processPeriodicUpdates()
|
||||
{
|
||||
if ( xQueueSend(objEntry->evInfo.queue, &objEntry->evInfo.ev, 0) != pdTRUE ) // do not block if queue is full
|
||||
{
|
||||
stats.lastErrorID = UAVObjGetID(objEntry->evInfo.ev.obj);
|
||||
++stats.eventErrors;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
* Event dispatcher statistics
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t lastErrorID;
|
||||
uint32_t eventErrors;
|
||||
} EventStats;
|
||||
|
||||
|
@ -120,7 +120,10 @@ typedef void (*UAVObjInitializeCallback)(UAVObjHandle obj, uint16_t instId);
|
||||
* Event manager statistics
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t eventErrors;
|
||||
uint32_t eventQueueErrors;
|
||||
uint32_t eventCallbackErrors;
|
||||
uint32_t lastCallbackErrorID;
|
||||
uint32_t lastQueueErrorID;
|
||||
} UAVObjStats;
|
||||
|
||||
int32_t UAVObjInitialize();
|
||||
|
@ -1441,14 +1441,16 @@ static int32_t sendEvent(ObjectList * obj, uint16_t instId,
|
||||
if (eventEntry->queue != 0) {
|
||||
if (xQueueSend(eventEntry->queue, &msg, 0) != pdTRUE) // will not block
|
||||
{
|
||||
++stats.eventErrors;
|
||||
stats.lastQueueErrorID = UAVObjGetID(obj);
|
||||
++stats.eventQueueErrors;
|
||||
}
|
||||
}
|
||||
// Invoke callback (from event task) if a valid one is registered
|
||||
if (eventEntry->cb != 0) {
|
||||
if (EventCallbackDispatch(&msg, eventEntry->cb) != pdTRUE) // invoke callback from the event task, will not block
|
||||
{
|
||||
++stats.eventErrors;
|
||||
++stats.eventCallbackErrors;
|
||||
stats.lastCallbackErrorID = UAVObjGetID(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,9 @@
|
||||
<field name="IRQStackRemaining" units="bytes" type="uint16" elements="1"/>
|
||||
<field name="CPULoad" units="%" type="uint8" elements="1"/>
|
||||
<field name="CPUTemp" units="C" type="int8" elements="1"/>
|
||||
<field name="EventSystemWarningID" units="uavoid" type="uint32" elements="1"/>
|
||||
<field name="ObjectManagerCallbackID" units="uavoid" type="uint32" elements="1"/>
|
||||
<field name="ObjectManagerQueueID" units="uavoid" type="uint32" elements="1"/>
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user