Skip to content

Commit

Permalink
Fix led cli command when led strip feature is not enabled. Fixes mult…
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra committed Sep 26, 2014
1 parent 775d312 commit 6883a8f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/main/io/ledstrip.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,14 @@ void ledStripInit(ledConfig_t *ledConfigsToUse, hsvColor_t *colorsToUse, failsaf
ledConfigs = ledConfigsToUse;
colors = colorsToUse;
failsafe = failsafeToUse;
ledStripInitialised = false;
}

void ledStripEnable(void)
{
reevalulateLedConfig();
ledStripInitialised = true;

ws2811LedStripInit();
}
#endif
2 changes: 2 additions & 0 deletions src/main/io/ledstrip.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ void generateLedConfig(uint8_t ledIndex, char *ledConfigBuffer, size_t bufferSiz
bool parseColor(uint8_t index, char *colorConfig);
void applyDefaultColors(hsvColor_t *colors, uint8_t colorCount);

void ledStripEnable(void);

6 changes: 3 additions & 3 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "drivers/system.h"
#include "drivers/gpio.h"
#include "drivers/light_led.h"
#include "drivers/light_ws2811strip.h"
#include "drivers/sound_beeper.h"
#include "drivers/timer.h"
#include "drivers/serial.h"
Expand Down Expand Up @@ -248,9 +247,10 @@ void init(void)
#endif

#ifdef LED_STRIP
ledStripInit(masterConfig.ledConfigs, masterConfig.colors, failsafe);

if (feature(FEATURE_LED_STRIP)) {
ws2811LedStripInit();
ledStripInit(masterConfig.ledConfigs, masterConfig.colors, failsafe);
ledStripEnable();
}
#endif

Expand Down

0 comments on commit 6883a8f

Please sign in to comment.