Serial interface: 'echo off' does not completely disable echo

Testing on the device with OS 2.4.2 – not seen on the simulator.

Steps to reproduce:
Send "echo off\n" on the serial connection, then commands like "msg hello\n" or "btn down\n" or "\n".

Expected result:
Nothing received on the serial connection beyond the initial echo of “echo off\r\n”.

Actual result:
After every msg or btn or empty command (and probably others, though these are the first ones I found that do not generate any output of their own), the device responds with "\r\n".

This happens both with my program running, and in the launcher with no code of mine involved.

In my application, the extra "\r\n" responses mess up the output I generate using playdate->system->logToConsole(). When I tell the device to turn off echo, I would like it to be totally quiet except for the things my code explicitly sends using logToConsole().

(Here is how I was testing using PySerial on macOS:

Python 3.9.6 (default, Sep 26 2022, 11:37:49) 
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> s = serial.Serial('/dev/cu.usbmodemPDU1_Y0035561', timeout=1)
>>> s.read(1000)
b''
>>> s.write(b'echo off\n')
9
>>> s.read(1000)
b'echo off\r\n'
>>> s.read(1000)
b''
>>> s.write(b'btn down\n')
6
>>> s.read(1000)
b'\r\n'
>>> s.read(1000)
b''
>>> s.write(b'msg hello\n')
10
>>> s.read(1000)
b'\r\n'
>>> s.read(1000)
b''
>>> s.write(b'\n')
1
>>> s.read(1000)
b'\r\n'
>>> s.close()
>>> ^D

)

1 Like