Skip to content

Commit

Permalink
rc: fix K2P led color
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Aug 31, 2023
1 parent 86d229a commit f307115
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
9 changes: 5 additions & 4 deletions trunk/user/rc/src/detect_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ dl_on_timer(void)
static void
dl_update_leds(void)
{
LED_CONTROL(LED_PWR, LED_ON);
LED_CONTROL(LED_WIFI, LED_ON);
LED_CONTROL(LED_SW2G, LED_ON);
LED_CONTROL(LED_SW5G, LED_ON);

int front_led_x;
int dl_state;

Expand Down Expand Up @@ -301,10 +306,6 @@ dl_update_leds(void)
}
#endif

LED_CONTROL(LED_WIFI, LED_ON);
LED_CONTROL(LED_PWR, LED_ON);
LED_CONTROL(LED_SW2G, LED_ON);
LED_CONTROL(LED_SW5G, LED_ON);
LED_CONTROL(LED_ROUTER, (dl_is_ap_mode) ? LED_OFF : LED_ON);
}

Expand Down
30 changes: 30 additions & 0 deletions trunk/user/rc/src/rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,38 @@ setkernel_tz(void)
settimeofday(tvp, &tz);
}

#if defined (BOARD_K2P)
static void led_control(int gpio_led, int flag);

void
LED_CONTROL(int gpio_led, int flag)
{
switch (gpio_led)
{
case LED_PWR:
led_control(LED_WIFI, !flag);
led_control(LED_WAN, 0);
break;
case LED_WIFI:
led_control(LED_PWR, !flag);
led_control(LED_WAN, 0);
break;
case LED_WAN:
led_control(LED_PWR, 0);
led_control(LED_WIFI, !flag);
break;
default:
break;
}
led_control(gpio_led, flag);
}

static void
led_control(int gpio_led, int flag)
#else
void
LED_CONTROL(int gpio_led, int flag)
#endif
{
int front_led_x = 1;

Expand Down

0 comments on commit f307115

Please sign in to comment.