Skip to content

Commit

Permalink
remove unnessary wrapping of output with IOBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Dec 23, 2024
1 parent 8c2cbf1 commit 1b1a638
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/pi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ Runs a pigpio socket command.
function _pigpio_command(sl::SockLock, cmd::Integer, p1::Integer, p2::Integer, rl=true)
lock(sl.l)
Base.write(sl.s, UInt32.([cmd, p1, p2, 0]))
out = IOBuffer(Base.read(sl.s, _SOCK_CMD_LEN))
msg = reinterpret(Cuint, take!(out))[4]

out = Base.read(sl.s, _SOCK_CMD_LEN)
@debug "_pigpio_command" out
msg = reinterpret(Cuint, out)[4]
if rl
unlock(sl.l)
end
Expand All @@ -131,8 +133,9 @@ function _pigpio_command_ext(sl, cmd, p1, p2, p3, extents, rl=true)

lock(sl.l)
write(sl.s, ext)
out = IOBuffer(Base.read(sl.s, _SOCK_CMD_LEN))
res = reinterpret(Cuint, take!(out))[4]
out = Base.read(sl.s, _SOCK_CMD_LEN)
@debug "_pigpio_command_ext" out ext
res = reinterpret(Cuint, out)[4]
if rl
unlock(sl.l)
end
Expand Down

0 comments on commit 1b1a638

Please sign in to comment.