Added gcode in/out logging possibility

This commit is contained in:
Nikolay Kopitonenko 2024-03-14 03:37:21 +03:00
parent cfe89d7c63
commit b07cfbeede
1 changed files with 2 additions and 0 deletions

View File

@ -411,6 +411,7 @@ class GCodeIO:
# Read input, separate by newline, and add to pending_commands # Read input, separate by newline, and add to pending_commands
try: try:
data = str(os.read(self.fd, 4096).decode()) data = str(os.read(self.fd, 4096).decode())
#logging.info("KLP:in: '"+data+"'")
except (os.error, UnicodeDecodeError): except (os.error, UnicodeDecodeError):
logging.exception("Read g-code") logging.exception("Read g-code")
return return
@ -455,6 +456,7 @@ class GCodeIO:
self._process_data) self._process_data)
def _respond_raw(self, msg): def _respond_raw(self, msg):
if self.pipe_is_active: if self.pipe_is_active:
#logging.info("KLP:out: '"+msg+"\n"+"'")
try: try:
os.write(self.fd, (msg+"\n").encode()) os.write(self.fd, (msg+"\n").encode())
except os.error: except os.error: