You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I run into following problem (on Windows 10, sbcl):
After a timeout when reading, the next byte/character is missing when reading the next bytes. I made a simple test with a loopback device:
(ql:quickload 'cserial-port)
(defvar *device* "COM3")
(defvar *serial-stream* nil)
(defun open-serial-stream ()
(unless *serial-stream*
(setq *serial-stream*
(cserial-port:open-serial *device*
;;:baud-rate 38400
:baud-rate 9600
:data-bits 8
:stop-bits 1
:parity :none)
)))
(defun close-serial-stream ()
(when *serial-stream*
(cserial-port:close-serial *serial-stream*)
(setq *serial-stream* nil)))
(defun send-x (b)
(cserial-port:write-serial-byte b *serial-stream*))
(defun read-x ()
(handler-case
(cserial-port:read-serial-byte *serial-stream* :timeout-ms 10)
(CSERIAL-PORT:TIMEOUT-ERROR () nil)))
;; test
(open-serial-stream)
(pprint "Write 117 followed by 118 and read them back")
(send-x 117)
(send-x 118)
(sleep 0.01)
(pprint (read-x))
(pprint (read-x))
(pprint "Read again, timeout:")
(pprint (read-x))
(sleep 0.01)
(pprint "Write 117 followed by 118 and read them back")
(send-x 117)
(send-x 118)
(sleep 0.01)
(pprint (read-x))
(pprint "first byte missing!")
;; (pprint (read-x))
(pprint "Write 117 followed by 118 and read them back")
(send-x 117)
(send-x 118)
(sleep 0.5)
(pprint (read-x))
(pprint (read-x))
(pprint "Works correctly again")
(close-serial-stream)
Following output:
"Write 117 followed by 118"
117
118
"Read again, timeout:"
NIL
"Write 117 followed by 118"
118
"first byte missing!"
"Write 117 followed by 118"
117
118
"Works correctly again"
The text was updated successfully, but these errors were encountered:
Hi, I run into following problem (on Windows 10, sbcl):
After a timeout when reading, the next byte/character is missing when reading the next bytes. I made a simple test with a loopback device:
Following output:
The text was updated successfully, but these errors were encountered: