Fix animation
This commit is contained in:
parent
20a6714bef
commit
f835aa0122
12
src/netman.h
12
src/netman.h
@ -103,8 +103,7 @@ bool netman::tryConnect() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to connect to a specific SSID with timeout
|
// Attempt to connect to a specific SSID with timeout, dot animation, and IP display
|
||||||
// Attempt to connect to a specific SSID with timeout and dot animation
|
|
||||||
bool netman::tryConnectToSsid(const char* ssid, const char* pass) {
|
bool netman::tryConnectToSsid(const char* ssid, const char* pass) {
|
||||||
WiFi.begin(ssid, pass);
|
WiFi.begin(ssid, pass);
|
||||||
unsigned long start = millis();
|
unsigned long start = millis();
|
||||||
@ -122,23 +121,24 @@ bool netman::tryConnectToSsid(const char* ssid, const char* pass) {
|
|||||||
|
|
||||||
// Check WiFi connection status
|
// Check WiFi connection status
|
||||||
if (WiFi.status() == WL_CONNECTED) {
|
if (WiFi.status() == WL_CONNECTED) {
|
||||||
// Success message
|
// Success message with IP address
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setCursor(0, 0);
|
display.setCursor(0, 0);
|
||||||
display.println("Connected!");
|
display.println("Connected!");
|
||||||
|
display.setCursor(0, 10);
|
||||||
|
display.print("IP: ");
|
||||||
|
display.println(WiFi.localIP());
|
||||||
display.display();
|
display.display();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animate by adding dots up to three, then reset
|
// Animate by adding dots up to three, then reset
|
||||||
display.setCursor(0, 20);
|
display.setCursor(0, 20);
|
||||||
display.print("Connecting");
|
|
||||||
for (int i = 0; i < dotCount; i++) {
|
for (int i = 0; i < dotCount; i++) {
|
||||||
display.print(".");
|
display.print(".");
|
||||||
}
|
}
|
||||||
display.display();
|
display.display();
|
||||||
|
dotCount = (dotCount + 1);
|
||||||
dotCount = (dotCount + 1) % 4; // Cycle dot count from 0 to 3
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connection failed
|
// Connection failed
|
||||||
|
Loading…
Reference in New Issue
Block a user