Skip to content

Confusing serial.readUntil behaviour #3355

Closed
@Parakleta

Description

@Parakleta

Describe the bug

When using serial.readUntil to read delimited data, the returned string doesn't line up with the delimiters. I cannot figure out how it chooses what data to return. I have tried several different delimiters and the result is always the same.

To Reproduce
Steps to reproduce the behavior:

Load the following program:

serial.setWriteLinePadding(0)
basic.forever(function () {
    serial.writeLine("||" + serial.readUntil(serial.delimiters(Delimiters.Colon)) + "##")
})

Then using a terminal program, send the following text ab:cd:ef:

Expected behavior

I should get back the following strings ||ab##, ||cd##, and ||ef##.

Screenshots

I get the following output in Termite:

61 62 3a 63 64 3a 65 66 3a                       ab:cd:ef:       
7c 7c 61 62 3a 63 23 23 0d 0a 7c 7c 23 23 0d 0a  ||ab:c##..||##..
7c 7c 65 66 23 23 0d 0a                          ||ef##..        

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions