Skip to content

Commit

Permalink
restored wifi status led
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaminwater committed Aug 13, 2021
1 parent 4cfff95 commit 3abdf37
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
12 changes: 0 additions & 12 deletions main/core/wifi/wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,14 @@ static esp_err_t event_handler(void *ctx, system_event_t *event) {
ESP_LOGI(SGO_LOG_EVENT, "@WIFI SYSTEM_EVENT_STA_START");
esp_wifi_connect();
set_wifi_status(CONNECTING);
#ifdef on_wifi_status_changed
on_wifi_status_changed();
#endif
break;
case SYSTEM_EVENT_STA_GOT_IP:
ESP_LOGI(SGO_LOG_EVENT, "@WIFI SYSTEM_EVENT_STA_GOT_IP");
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
xQueueSend(cmd, &CMD_STA_CONNECTED, 0);
set_wifi_status(CONNECTED);
#ifdef on_wifi_status_changed
on_wifi_status_changed();
#endif
set_ip(TCPIP_ADAPTER_IF_STA);
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
Expand All @@ -183,24 +179,18 @@ static esp_err_t event_handler(void *ctx, system_event_t *event) {
if (failed) {
xQueueSend(cmd, &CMD_STA_CONNECTION_FAILED, 0);
set_wifi_status(FAILED);
#ifdef on_wifi_status_changed
on_wifi_status_changed();
#endif
} else {
xQueueSend(cmd, &CMD_STA_DISCONNECTED, 0);
set_wifi_status(DISCONNECTED);
#ifdef on_wifi_status_changed
on_wifi_status_changed();
#endif
}
xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
break;
case SYSTEM_EVENT_AP_START:
xQueueSend(cmd, &CMD_AP_START, 0);
set_wifi_status(AP);
#ifdef on_wifi_status_changed
on_wifi_status_changed();
#endif
set_ip(TCPIP_ADAPTER_IF_AP);
break;
case SYSTEM_EVENT_AP_STACONNECTED:
Expand Down Expand Up @@ -293,9 +283,7 @@ static void wifi_task(void *param) {
ESP_LOGI(SGO_LOG_EVENT, "@WIFI Too many retries, start AP mode");
n_connection_failed = 0;
set_wifi_status(FAILED);
#ifdef on_wifi_status_changed
on_wifi_status_changed();
#endif
start_ap();
}
} else if (c == CMD_MDNS_CHANGED) {
Expand Down
2 changes: 2 additions & 0 deletions main/core_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ status_led_timeline connecting_timeline = {

status_led_timeline connected_timeline = {
.reset = true,
.loop = false,
.fade = false,
.step = 1,
.red = {LED_MIN_DUTY, LED_MIN_DUTY, LED_MIN_DUTY, LED_MIN_DUTY, LED_MIN_DUTY, LED_MIN_DUTY, LED_MIN_DUTY, LED_MIN_DUTY},
Expand All @@ -41,6 +42,7 @@ status_led_timeline connected_timeline = {

status_led_timeline connection_failed_timeline = {
.reset = true,
.loop = false,
.fade = false,
.step = 1,
.red = {LED_MAX_DUTY, LED_MAX_DUTY/10, LED_MAX_DUTY, LED_MAX_DUTY/10, LED_MAX_DUTY, LED_MAX_DUTY/10, LED_MAX_DUTY, LED_MAX_DUTY/10},
Expand Down
2 changes: 1 addition & 1 deletion sdkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CONFIG_FLASH_ENCRYPTION_ENABLED=
#
# Serial flasher config
#
CONFIG_ESPTOOLPY_PORT="/dev/ttyUSB0"
CONFIG_ESPTOOLPY_PORT="/dev/ttyUSB1"
CONFIG_ESPTOOLPY_BAUD_115200B=
CONFIG_ESPTOOLPY_BAUD_230400B=
CONFIG_ESPTOOLPY_BAUD_921600B=y
Expand Down

0 comments on commit 3abdf37

Please sign in to comment.