diff --git a/src/log/hasp_debug.cpp b/src/log/hasp_debug.cpp index 3208e9b1..f367ec0a 100644 --- a/src/log/hasp_debug.cpp +++ b/src/log/hasp_debug.cpp @@ -279,7 +279,7 @@ void debugPrintSuffix(uint8_t tag, int level, Print* _logOutput) if(_logOutput == &Serial) { console_update_prompt(); } else { - _logOutput->print("hasp > "); + telnet_update_prompt(); } } diff --git a/src/sys/svc/hasp_telnet.cpp b/src/sys/svc/hasp_telnet.cpp index 4001dd3a..e953c563 100644 --- a/src/sys/svc/hasp_telnet.cpp +++ b/src/sys/svc/hasp_telnet.cpp @@ -6,6 +6,7 @@ #if HASP_USE_TELNET > 0 #include "ConsoleInput.h" +#include #include "hasp_debug.h" #include "hasp_config.h" @@ -32,12 +33,21 @@ static EthernetServer telnetServer(23); extern hasp_http_config_t http_config; #endif +// Create a new Stream that buffers all writes to telnetClient +WriteBufferingStream bufferedtelnetBufferedClientClient{telnetClient, 200}; + uint8_t telnetLoginState = TELNET_UNAUTHENTICATED; uint16_t telnetPort = 23; uint8_t telnetEnabled = true; // Enable telnet debug output uint8_t telnetLoginAttempt = 0; // Initial attempt ConsoleInput* telnetConsole; +void telnet_update_prompt() +{ + bufferedtelnetBufferedClientClient.print("hasp > "); + bufferedtelnetBufferedClientClient.flush(); +} + void telnetClientDisconnect() { Log.unregisterOutput(1); // telnetClient @@ -52,12 +62,12 @@ void telnetClientDisconnect() void telnetClientLogon() { telnetClient.println(); - debugPrintHaspHeader(&telnetClient); + debugPrintHaspHeader(&bufferedtelnetBufferedClientClient); telnetLoginState = TELNET_AUTHENTICATED; // User and Pass are correct telnetLoginAttempt = 0; // Reset attempt counter /* Now register logger for telnet */ - Log.registerOutput(1, &telnetClient, LOG_LEVEL_VERBOSE, true); + Log.registerOutput(1, &bufferedtelnetBufferedClientClient, LOG_LEVEL_VERBOSE, true); telnetClient.flush(); // telnetClient.setTimeout(10); diff --git a/src/sys/svc/hasp_telnet.h b/src/sys/svc/hasp_telnet.h index 1e4ebdbb..0a6da87d 100644 --- a/src/sys/svc/hasp_telnet.h +++ b/src/sys/svc/hasp_telnet.h @@ -17,6 +17,7 @@ void telnetStart(void); void telnetStop(void); /* ===== Special Event Processors ===== */ +void telnet_update_prompt(); /* ===== Getter and Setter Functions ===== */