Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Debug output says wifi connected, but WiFi.status() keeps returning 7

Đang mở
#9,060 10 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
embedded-iot, networking

Hướng nghiên cứu

Bắt đầu với sketch setup() và tái hiện hành vi mạng được báo cáo, đồng thời so sánh đầu ra nội bộ “connected with CASAS” với WiFi.status(). Theo dõi các chuyển trạng thái kết nối và DHCP được hiển thị trong log serial; hoàn tất khi xác định được liệu thông báo gỡ lỗi, giá trị trạng thái hay việc ngắt kết nối ngay lập tức có không nhất quán hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

This seems to happen randomly (but often) on some networks. I'm seeing this on a particular wifi network almost systematically (but not quite) while the same code on the same board had worked for ages on other networks.

This is my code (simplified):

void setup() {
  String client_ssid = "mySSID";
  String clien_password = "mypassword";

  WiFi.mode(WIFI_STA);
  WiFi.begin(client_ssid.c_str(), client_password.c_str());

  for (int i=0; i<20; i++) {
    Serial.println("Trying to connect to Wifi '%s' with password '%s'\n", client_ssid.c_str(), client_password.c_str());
    delay(1000)
    if (WiFi.status()==WL_CONNECTED) {
      Serial.println("...connected succesfully\n");
      // Here I would normally do stuff...

      return;
    }
  }
  Serial.println("Cannot connect to WiFi!\n");
  return;
}
fpm close 3 
mode : sta(80:7d:3a:3c:e2:1d)
add if0
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
scandone
state: 0 -> 2 (b0)
Trying to connect to Wifi 'CASAS' with password '******'
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 17
cnt 

connected with CASAS, channel 6
dhcp client start...
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
pm open,type:2 0
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Trying to connect to Wifi 'CASAS' with password '******'
Cannot connect to WiFi!

Note where it says "Connected to ... channel 6": that's not from my println()s, that's some internal output.

It was able to connect once or twice on the very same network, which is working fine and the password is correct, obviously.

I'm reporting it here because there's internal debug output that says "connected" and yet status() is returning WL_DISCONNECTED, so that's an inconsistency that is obviously in software. Either the debug output that says "connected" is bogus, or status() is returning the wrong value (or it connects and immediately loses connection, and there's no debug output for that which would be a bug too - but that seems pretty unlikely).

Ngôn ngữ chính
C++
Star
16.7k
Fork
13.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của esp8266/Arduino

Tất cả issue của esp8266/Arduino

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.