Skip to content

Commit ef5bc2c

Browse files
Fix build issue with status led (#2600)
1 parent 9b1e125 commit ef5bc2c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/rp2_common/pico_status_led/status_led.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static bool colored_status_led_on;
4343

4444
static PIO pio;
4545
static uint sm;
46-
static int offset = -1;
46+
static uint offset;
4747

4848
// Extract from 0xWWRRGGBB
4949
#define RED(c) (((c) >> 16) & 0xff)
@@ -52,7 +52,7 @@ static int offset = -1;
5252
#define WHITE(c) (((c) >> 24) && 0xff)
5353

5454
bool set_ws2812(uint32_t value) {
55-
if (offset > -1) {
55+
if (pio) {
5656
#if PICO_COLORED_STATUS_LED_USES_WRGB
5757
// Convert to 0xWWGGRRBB
5858
pio_sm_put_blocking(pio, sm, WHITE(value) << 24 | GREEN(value) << 16 | RED(value) << 8 | BLUE(value));
@@ -164,9 +164,9 @@ void status_led_deinit(void) {
164164
status_led_context = NULL;
165165
#endif
166166
#if COLORED_STATUS_LED_USING_WS2812_PIO
167-
if (offset >= 0) {
167+
if (pio) {
168168
pio_remove_program_and_unclaim_sm(&ws2812_program, pio, sm, offset);
169-
offset = -1;
169+
pio = NULL;
170170
}
171171
#ifdef PICO_DEFAULT_WS2812_POWER_PIN
172172
gpio_put(PICO_DEFAULT_WS2812_POWER_PIN, false);

0 commit comments

Comments
 (0)