Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phicomm K2&K2P LED Control Update #495

Merged
merged 20 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion trunk/user/rc/detect_internet.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,12 @@ di_on_timer(void)
nvram_set_int_temp("link_internet", link_internet);

#if defined (BOARD_GPIO_LED_WAN)
if (nvram_get_int("front_led_wan") == 3)
if (nvram_get_int("front_led_wan") == 3){
LED_CONTROL(BOARD_GPIO_LED_WAN, (link_internet) ? LED_ON : LED_OFF);
#if defined (BOARD_K2P) || defined (BOARD_PSG1218)
LED_CONTROL(BOARD_GPIO_LED_WIFI, (link_internet) ? LED_OFF : LED_ON);
#endif
}
#endif
if (di_poll_mode != 0 && !di_pause_received) {
long fail_delay = (long)nvram_safe_get_int("di_lost_delay", 10, 0, 600);
Expand Down
17 changes: 14 additions & 3 deletions trunk/user/rc/detect_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,18 @@ dl_handle_link_wan(void)
nvram_set_int_temp("link_wan", (dl_status_wan) ? 1 : 0);
#if defined (BOARD_GPIO_LED_WAN)
front_led_x = nvram_get_int("front_led_wan");
if (front_led_x == 1)
if (front_led_x == 1) {
LED_CONTROL(BOARD_GPIO_LED_WAN, (dl_status_wan) ? LED_ON : LED_OFF);
else if (front_led_x == 2) {
#if defined (BOARD_K2P) || defined (BOARD_PSG1218)
LED_CONTROL(BOARD_GPIO_LED_WIFI, (dl_status_wan) ? LED_OFF : LED_ON);
#endif
} else if (front_led_x == 2) {
if (!get_wan_wisp_active(NULL) && !get_usb_modem_wan(0)) {
int dl_state = (dl_status_wan && has_wan_gw4() && has_wan_ip4(1)) ? 1 : 0;
LED_CONTROL(BOARD_GPIO_LED_WAN, (dl_state) ? LED_ON : LED_OFF);
#if defined (BOARD_K2P) || defined (BOARD_PSG1218)
LED_CONTROL(BOARD_GPIO_LED_WIFI, (dl_state) ? LED_OFF : LED_ON);
#endif
}
}
#endif
Expand Down Expand Up @@ -184,6 +190,9 @@ dl_handle_link_wisp(void)
if (front_led_wan == 2) {
int dl_state = (dl_status_wisp && has_wan_gw4() && has_wan_ip4(1)) ? 1 : 0;
LED_CONTROL(BOARD_GPIO_LED_WAN, (dl_state) ? LED_ON : LED_OFF);
#if defined (BOARD_K2P) || defined (BOARD_PSG1218)
LED_CONTROL(BOARD_GPIO_LED_WIFI, (dl_state) ? LED_OFF : LED_ON);
#endif
}
#endif
}
Expand Down Expand Up @@ -335,7 +344,9 @@ dl_update_leds(void)
dl_handle_link_usb(1);
}
#endif
#if defined (BOARD_GPIO_LED_WIFI)
#if defined (BOARD_K2P) || defined (BOARD_PSG1218)
LED_CONTROL(BOARD_GPIO_LED_WIFI, (dl_state) ? LED_OFF : LED_ON);
#elif defined (BOARD_GPIO_LED_WIFI)
LED_CONTROL(BOARD_GPIO_LED_WIFI, LED_ON);
#endif
#if defined (BOARD_GPIO_LED_ALL)
Expand Down
6 changes: 6 additions & 0 deletions trunk/user/rc/net_wan.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,15 @@ control_wan_led_isp_state(int is_wan_up, int is_modem_unit)
has_link = get_wan_ether_link_cached();
}
LED_CONTROL(BOARD_GPIO_LED_WAN, (is_wan_up && has_link) ? LED_ON : LED_OFF);
#if defined (BOARD_K2P) || defined (BOARD_PSG1218)
LED_CONTROL(BOARD_GPIO_LED_WIFI, (is_wan_up && has_link) ? LED_OFF : LED_ON);
#endif
} else if (front_led_wan == 3) {
if (!is_wan_up)
LED_CONTROL(BOARD_GPIO_LED_WAN, LED_OFF);
#if defined (BOARD_K2P) || defined (BOARD_PSG1218)
LED_CONTROL(BOARD_GPIO_LED_WIFI, LED_ON);
#endif
}
#endif
}
Expand Down