mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-1012 implement several messages for alarm led
This commit is contained in:
parent
49da1aca86
commit
354fdf4bdf
@ -167,7 +167,7 @@ static void systemTask(__attribute__((unused)) void *parameters)
|
|||||||
{
|
{
|
||||||
/* start the delayed callback scheduler */
|
/* start the delayed callback scheduler */
|
||||||
CallbackSchedulerStart();
|
CallbackSchedulerStart();
|
||||||
|
static uint8_t cycleCount;
|
||||||
/* create all modules thread */
|
/* create all modules thread */
|
||||||
MODULE_TASKCREATE_ALL;
|
MODULE_TASKCREATE_ALL;
|
||||||
|
|
||||||
@ -204,6 +204,7 @@ static void systemTask(__attribute__((unused)) void *parameters)
|
|||||||
while (1) {
|
while (1) {
|
||||||
// Update the system statistics
|
// Update the system statistics
|
||||||
updateStats();
|
updateStats();
|
||||||
|
cycleCount = cycleCount > 0 ? cycleCount - 1 : 3;
|
||||||
|
|
||||||
// Update the system alarms
|
// Update the system alarms
|
||||||
updateSystemAlarms();
|
updateSystemAlarms();
|
||||||
@ -220,26 +221,33 @@ static void systemTask(__attribute__((unused)) void *parameters)
|
|||||||
|
|
||||||
// Flash the heartbeat LED
|
// Flash the heartbeat LED
|
||||||
#if defined(PIOS_LED_HEARTBEAT)
|
#if defined(PIOS_LED_HEARTBEAT)
|
||||||
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
uint8_t armingStatus;
|
||||||
|
FlightStatusArmedGet(&armingStatus);
|
||||||
|
if ((armingStatus == FLIGHTSTATUS_ARMED_ARMED && (cycleCount & 0x1)) ||
|
||||||
|
(armingStatus != FLIGHTSTATUS_ARMED_ARMED && (cycleCount & 0x2))) {
|
||||||
|
PIOS_LED_On(PIOS_LED_HEARTBEAT);
|
||||||
|
} else {
|
||||||
|
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_MSG("+ 0x%08x\r\n", 0xDEADBEEF);
|
DEBUG_MSG("+ 0x%08x\r\n", 0xDEADBEEF);
|
||||||
#endif /* PIOS_LED_HEARTBEAT */
|
#endif /* PIOS_LED_HEARTBEAT */
|
||||||
|
|
||||||
// Turn on the error LED if an alarm is set
|
// Turn on the error LED if an alarm is set
|
||||||
#if defined(PIOS_LED_ALARM)
|
#if defined(PIOS_LED_ALARM)
|
||||||
if (AlarmsHasWarnings()) {
|
if (AlarmsHasCritical()) {
|
||||||
|
PIOS_LED_On(PIOS_LED_ALARM);
|
||||||
|
} else if( (AlarmsHasErrors() && (cycleCount & 0x1)) ||
|
||||||
|
(!AlarmsHasErrors() && AlarmsHasWarnings() && (cycleCount & 0x2))){
|
||||||
PIOS_LED_On(PIOS_LED_ALARM);
|
PIOS_LED_On(PIOS_LED_ALARM);
|
||||||
} else {
|
} else {
|
||||||
PIOS_LED_Off(PIOS_LED_ALARM);
|
PIOS_LED_Off(PIOS_LED_ALARM);
|
||||||
}
|
}
|
||||||
#endif /* PIOS_LED_ALARM */
|
#endif /* PIOS_LED_ALARM */
|
||||||
|
|
||||||
FlightStatusData flightStatus;
|
|
||||||
FlightStatusGet(&flightStatus);
|
|
||||||
|
|
||||||
UAVObjEvent ev;
|
UAVObjEvent ev;
|
||||||
int delayTime = flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED ?
|
int delayTime = SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS / (LED_BLINK_RATE_HZ);
|
||||||
SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS / (LED_BLINK_RATE_HZ * 2) :
|
|
||||||
SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS;
|
|
||||||
|
|
||||||
if (xQueueReceive(objectPersistenceQueue, &ev, delayTime) == pdTRUE) {
|
if (xQueueReceive(objectPersistenceQueue, &ev, delayTime) == pdTRUE) {
|
||||||
// If object persistence is updated call the callback
|
// If object persistence is updated call the callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user