From 12ce051b552d301cd76bb7269011a50ef548ed6e Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Fri, 28 Apr 2017 17:15:39 -0500
Subject: [PATCH] Add a function to output spaces to serial

---
 Marlin/serial.cpp | 2 ++
 Marlin/serial.h   | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/Marlin/serial.cpp b/Marlin/serial.cpp
index 9b5ae139e4..797c6107ac 100644
--- a/Marlin/serial.cpp
+++ b/Marlin/serial.cpp
@@ -32,3 +32,5 @@ void serial_echopair_P(const char* s_P, long v)          { serialprintPGM(s_P);
 void serial_echopair_P(const char* s_P, float v)         { serialprintPGM(s_P); SERIAL_ECHO(v); }
 void serial_echopair_P(const char* s_P, double v)        { serialprintPGM(s_P); SERIAL_ECHO(v); }
 void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
+
+void serial_spaces(uint8_t count) { while (count--) MYSERIAL.write(' '); }
diff --git a/Marlin/serial.h b/Marlin/serial.h
index b6e7add430..62e06c9892 100644
--- a/Marlin/serial.h
+++ b/Marlin/serial.h
@@ -84,6 +84,11 @@ FORCE_INLINE void serial_echopair_P(const char* s_P, uint16_t v) { serial_echopa
 FORCE_INLINE void serial_echopair_P(const char* s_P, bool v) { serial_echopair_P(s_P, (int)v); }
 FORCE_INLINE void serial_echopair_P(const char* s_P, void *v) { serial_echopair_P(s_P, (unsigned long)v); }
 
+void serial_spaces(uint8_t count);
+#define SERIAL_ECHO_SP(C)     serial_spaces(C)
+#define SERIAL_ERROR_SP(C)    serial_spaces(C)
+#define SERIAL_PROTOCOL_SP(C) serial_spaces(C)
+
 //
 // Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
 //
-- 
GitLab