From 55b95e1eacf4a4125f4957199a2a0598dcb6622f Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Mon, 14 Feb 2022 09:20:59 +0100
Subject: [PATCH] Doc

---
 ampel-firmware/wifi_util.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ampel-firmware/wifi_util.cpp b/ampel-firmware/wifi_util.cpp
index 1c86ff5..2252e6f 100644
--- a/ampel-firmware/wifi_util.cpp
+++ b/ampel-firmware/wifi_util.cpp
@@ -19,8 +19,17 @@ namespace wifi {
     return WiFi.status() == WL_CONNECTED;
   }
 
+  /*
+   * Connection attempt, called in blocking mode by setup(). This way, LED effects can be shown
+   * without needing callbacks, but only during wifi_timeout seconds.
+   * If connection fails, access point will be started indefinitely, and corresponding
+   * LED effects will be shown during 5 seconds.
+   *
+   * Afterwards, the non-blocking web_config::update() will be called inside loop, and the ampel
+   * can display CO2 levels.
+   */
   void tryConnection() {
-    for (int i = 0; i <= config::wifi_timeout + 10; i++) {
+    for (int i = 0; i <= config::wifi_timeout + 5; i++) {
       web_config::update();
       if (WiFi.getMode() == WIFI_AP){
         led_effects::alert(0x1cff68);
-- 
GitLab