Commit b7076b2a authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Julia debugging cleanup

parent 3613f613
......@@ -20,7 +20,7 @@ mutable struct AnalogIn
end
function close(ain::AnalogIn)
# println("closing $(ain)")
DEBUG && println("closing $(ain)")
checkOK(ccall((:moberg_analog_in_close, "libmoberg"),
Status,
(Moberg, Cint, AnalogInChannel),
......
......@@ -20,7 +20,7 @@ mutable struct AnalogOut
end
function close(aout::AnalogOut)
# println("closing $(aout)")
DEBUG && println("closing $(aout)")
checkOK(ccall((:moberg_analog_out_close, "libmoberg"),
Status,
(Moberg, Cint, AnalogOutChannel),
......
......@@ -20,7 +20,7 @@ mutable struct DigitalIn
end
function close(din::DigitalIn)
# println("closing $(din)")
DEBUG && println("closing $(din)")
checkOK(ccall((:moberg_digital_in_close, "libmoberg"),
Status,
(Moberg, Cint, DigitalInChannel),
......
......@@ -20,7 +20,7 @@ mutable struct DigitalOut
end
function close(dout::DigitalOut)
# println("closing $(dout)")
DEBUG && println("closing $(dout)")
checkOK(ccall((:moberg_digital_out_close, "libmoberg"),
Status,
(Moberg, Cint, DigitalOutChannel),
......
......@@ -20,7 +20,7 @@ mutable struct EncoderIn
end
function close(ein::EncoderIn)
# println("closing $(ein)")
DEBUG && println("closing $(ein)")
checkOK(ccall((:moberg_encoder_in_close, "libmoberg"),
Status,
(Moberg, Cint, EncoderInChannel),
......
module MobergIO
const DEBUG = false
struct Status
result::Clong
......@@ -23,6 +24,7 @@ function Moberg()
end
function close(h::Moberg)
DEBUG && println("Destroy $(h)")
ccall((:moberg_free, "libmoberg"), Nothing, (Moberg,), h)
end
......
......@@ -7,7 +7,7 @@ import MobergIO: read, write
function test()
m = MobergIO.Moberg()
println(m)
println(stderr,m)
for v in -10.0:2.0:10
for i in 0:1
......@@ -17,21 +17,23 @@ function test()
write(aout, value)
print("$value ")
catch ex
println("analog_out $i does not exist $(ex)")
println(stderr,"analog_out $i does not exist $(ex)")
end
end
println()
println(stderr)
flush(stderr)
sleep(0.01)
for j in 0:3
try
ain = MobergIO.AnalogIn(m, Unsigned(j))
println(read(ain))
println(stderr,read(ain))
catch ex
println("analog_in $j does not exist $(ex)")
println(stderr,"analog_in $j does not exist $(ex)")
end
flush(stderr)
end
println()
# GC.gc()
println(stderr)
flush(stderr)
end
for v in false:true
for i in 0:6
......@@ -41,27 +43,34 @@ function test()
write(dout, value)
print("$value ")
catch ex
println("digital_out $i does not exist $(ex)")
println(stderr,"digital_out $i does not exist $(ex)")
end
flush(stderr)
end
println()
println(stderr)
flush(stderr)
for i in 0:6
try
din = MobergIO.DigitalIn(m, Unsigned(i))
print("$(read(din)) ")
catch ex
println("digital_out $i does not exist $(ex)")
println(stderr,"digital_in $i does not exist $(ex)")
end
flush(stderr)
end
println()
println()
println(stderr)
println(stderr)
sleep(0.01)
end
end
test()
println("DONE")
println(stderr,"DONE")
flush(stderr)
GC.gc()
println(stderr,"....")
flush(stderr)
GC.gc() # See https://github.com/JuliaCI/BenchmarkTools.jl/blob/af35d0513fe1e336ad0d8b9a35f924e8461aefa2/src/execution.jl#L1
println("Really DONE")
println(stderr,"Really DONE")
flush(stderr)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment