Skip to content

Document that sys.stdout.write() and print() replaces a New line character with Carriage Return and New line characters. #553

@tballas

Description

@tballas

This issue might serve as partial documentation.

This took a lot of digging to find. A carriage return sent over usb serial is replaced with a new line character when sent e.g. sys.stdout.write('String\n'), print('String\n', end='') or print('String') becomes 'String\r\n' on the pc side.

The source of the change seems to be the mp_hal_stdout_tx_strn_cooked() function in \lib\utils\stdout_helpers.c
It has the comment:

"Send "cooked" string of given length, where every occurrence of LF character is replaced with CR LF."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions