• Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Yep, thanks. I did that.
    It's weird.
    When I run this against a terminal program on the other side where I type one character after another it works perfectly.
    No stalling.
    However, when I send a bunch of characters at once it hangs.
    The difference is that with the bunch of characters the number of available characters is read from the serial.
    Which is this code:
    Code:

    if q.Actual > 0 then do
    call SERRead(serial.Id, q.Actual)
    call SERWaitIO(serial.Id, "b2")
    end

    And it seems that for some reason a serial signal is raised after reading everything available so that the serial handler runs into the SERWaitIO() call in the next event loop iteration even though there is nothing anymore available on the serial.
    This signal doesn't seem to be raised when character by character is sent from the terminal.

    I've tried checking the available bytes in the serial buffer before the SERWaitIO() to avoid hanging there.
    Code:

    if serial.Post then do
    /* ... there is something on the air */
    SERQuery(serial.Id, "q")
    if q.Actual > 0 then do
    call SERWaitIO(serial.Id, "b1")
    ...
    end

    But then sending one character only doesn't work anymore. It seems to get swallowed because q.Actual is 0.

    The question now is why is the serial signal raised (again) after receiving >1 character.


    [ Edited by asrael22 06.01.2017 - 16:19 ]
  • »06.01.17 - 16:17
    Profile