Skip to content

Commit

Permalink
Update warning mode leds to show when arming is disabled.
Browse files Browse the repository at this point in the history
Idea and initial implementation by viktor80.  Closes multiwii#96.
  • Loading branch information
hydra committed Sep 26, 2014
1 parent 03a5a20 commit 10abdd3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/main/io/ledstrip.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ void applyLedModeLayer(void)
typedef enum {
WARNING_FLAG_NONE = 0,
WARNING_FLAG_LOW_BATTERY = (1 << 0),
WARNING_FLAG_FAILSAFE = (1 << 1)
WARNING_FLAG_FAILSAFE = (1 << 1),
WARNING_FLAG_ARMING_DISABLED = (1 << 2)
} warningFlags_e;

void applyLedWarningLayer(uint8_t warningState, uint8_t warningFlags)
Expand All @@ -579,14 +580,20 @@ void applyLedWarningLayer(uint8_t warningState, uint8_t warningFlags)
}

if (warningState == 0) {
if (warningFlashCounter == 0 && warningFlags & WARNING_FLAG_LOW_BATTERY) {
if (warningFlashCounter == 0 && warningFlags & WARNING_FLAG_ARMING_DISABLED) {
setLedHsv(ledIndex, &hsv_yellow);
}
if (warningFlashCounter == 1 && warningFlags & WARNING_FLAG_LOW_BATTERY) {
setLedHsv(ledIndex, &hsv_red);
}
if (warningFlashCounter > 1 && warningFlags & WARNING_FLAG_FAILSAFE) {
setLedHsv(ledIndex, &hsv_lightBlue);
}
} else {
if (warningFlashCounter == 0 && warningFlags & WARNING_FLAG_LOW_BATTERY) {
if (warningFlashCounter == 0 && warningFlags & WARNING_FLAG_ARMING_DISABLED) {
setLedHsv(ledIndex, &hsv_black);
}
if (warningFlashCounter == 1 && warningFlags & WARNING_FLAG_LOW_BATTERY) {
setLedHsv(ledIndex, &hsv_black);
}
if (warningFlashCounter > 1 && warningFlags & WARNING_FLAG_FAILSAFE) {
Expand Down Expand Up @@ -744,6 +751,9 @@ void updateLedStrip(void)
if (failsafe->vTable->hasTimerElapsed()) {
warningFlags |= WARNING_FLAG_FAILSAFE;
}
if (!ARMING_FLAG(ARMED) && !ARMING_FLAG(OK_TO_ARM)) {
warningFlags |= WARNING_FLAG_ARMING_DISABLED;
}

} else {
warningState = 0;
Expand Down

0 comments on commit 10abdd3

Please sign in to comment.