From 8f494dfa05917457bb18775c1a720370be8d4c91 Mon Sep 17 00:00:00 2001
From: Marcel Peterkau <marcel@peterkau.de>
Date: Mon, 15 Jan 2024 23:57:00 +0100
Subject: [PATCH] added echo for serial debugger and some more commands

---
 Software/src/debugger.cpp | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/Software/src/debugger.cpp b/Software/src/debugger.cpp
index 5ef90f5..4781ecb 100644
--- a/Software/src/debugger.cpp
+++ b/Software/src/debugger.cpp
@@ -73,6 +73,7 @@ void Debug_Process()
             inputBuffer[inputCnt] = 0; // terminate the String
             inputCnt = 0;
             InputProcessed = CMD_COMPLETE;
+            Serial.write(inputChar);
             break;
 
         case 0x1B: // Esc
@@ -84,6 +85,7 @@ void Debug_Process()
         case 0x21 ... 0x7E: // it's a real letter or sign and not some control-chars
             inputBuffer[inputCnt] = inputChar;
             inputCnt++;
+            Serial.write(inputChar);
             break;
 
         default:
@@ -117,6 +119,10 @@ void Debug_Process()
     default:
         break;
     }
+    
+    if (InputProcessed != IDLE)
+        Serial.print(">");
+
     InputProcessed = IDLE;
 }
 /**
@@ -152,7 +158,7 @@ void Debug_pushMessage(const char *format, ...)
     if ((DebuggerStatus[dbg_Serial] == enabled) || (DebuggerStatus[dbg_Webui] == enabled))
     {
         char buff[128]; // Buffer to hold the formatted message
-        va_list arg;   // Variable argument list for vsnprintf
+        va_list arg;    // Variable argument list for vsnprintf
         va_start(arg, format);
 
         // Format the message and store it in the buffer
@@ -257,6 +263,14 @@ void processCmdDebug(String command)
         MaintainDTC(DTC_FAKE_DTC_WARN, true, millis());
     else if (command == "dtc_info")
         MaintainDTC(DTC_FAKE_DTC_INFO, true, millis());
+    else if (command == "notify_error")
+        Websocket_PushNotification("Debug Error Notification", error);
+    else if (command == "notify_warning")
+        Websocket_PushNotification("Debug Warning Notification", warning);
+    else if (command == "notify_success")
+        Websocket_PushNotification("Debug Success Notification", success);
+    else if (command == "notify_info")
+        Websocket_PushNotification("Debug Info Notification", info);
     else
         Debug_pushMessage("unknown Command\n");
 }