From 30040e735dd2b51f3d6ec6d1831ca99b984a0a2e Mon Sep 17 00:00:00 2001
From: Timothe Jost <timothe.jost@wanadoo.fr>
Date: Thu, 4 Jul 2024 12:25:46 +0200
Subject: [PATCH] better heartbeat message

---
 sources/src/main.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/sources/src/main.c b/sources/src/main.c
index 6d0dc11..57afae4 100644
--- a/sources/src/main.c
+++ b/sources/src/main.c
@@ -174,16 +174,23 @@ void heartBeatHandler(int signum)
     }
 
     // Prints a changing heartbeat message to display that the program is still live if nothing is happening
-    static bool alternate = false;
-    if (alternate)
+    static uint8_t dot_count = 0;
+    switch (dot_count)
     {
-        printf("\theartbeat.  \t\t\r");
+    case 0:
+        printf("\theartbeat    \t\t\r");
+        break;
+    case 1:
+        printf("\theartbeat.   \t\t\r");
+        break;
+    case 2:
+        printf("\theartbeat..  \t\t\r");
+        break;
+    case 3:
+        printf("\theartbeat... \t\t\r");
+        break;
     }
-    else
-    {
-        printf("\theartbeat...\t\t\r");
-    }
-    alternate = !alternate;
+    dot_count = (dot_count + 1) % 4;
     fflush(stdout);
 }
 // Create Threads
-- 
GitLab