From f835aa01223a2679a01ff5a6687c84158ec85e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomislav=20Kopi=C4=87?= Date: Tue, 5 Nov 2024 13:13:32 +0100 Subject: [PATCH] Fix animation --- src/netman.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/netman.h b/src/netman.h index 4778398..3b1015f 100644 --- a/src/netman.h +++ b/src/netman.h @@ -103,12 +103,11 @@ bool netman::tryConnect() { return false; } -// Attempt to connect to a specific SSID with timeout -// Attempt to connect to a specific SSID with timeout and dot animation +// Attempt to connect to a specific SSID with timeout, dot animation, and IP display bool netman::tryConnectToSsid(const char* ssid, const char* pass) { WiFi.begin(ssid, pass); unsigned long start = millis(); - + // Clear display and set initial message display.clearDisplay(); display.setCursor(0, 0); @@ -122,23 +121,24 @@ bool netman::tryConnectToSsid(const char* ssid, const char* pass) { // Check WiFi connection status if (WiFi.status() == WL_CONNECTED) { - // Success message + // Success message with IP address display.clearDisplay(); display.setCursor(0, 0); display.println("Connected!"); + display.setCursor(0, 10); + display.print("IP: "); + display.println(WiFi.localIP()); display.display(); return true; } // Animate by adding dots up to three, then reset display.setCursor(0, 20); - display.print("Connecting"); for (int i = 0; i < dotCount; i++) { display.print("."); } display.display(); - - dotCount = (dotCount + 1) % 4; // Cycle dot count from 0 to 3 + dotCount = (dotCount + 1); } // Connection failed