diff --git a/src/client/julia/Project.toml b/src/client/julia/Project.toml index 371820a9..40e9d7ef 100644 --- a/src/client/julia/Project.toml +++ b/src/client/julia/Project.toml @@ -4,30 +4,18 @@ authors = ["Tobias Knopp "] version = "0.6.0" [deps] -#Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" -#GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26" -#LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -#OpenSSH_jll = "9bd350c2-7e96-507f-8002-3f2e150b4e1b" -ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -#Scratch = "6c6a2e73-6563-6170-7368-637461726353" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -#URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" -#ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea" [compat] -#GitHub = "5" -ProgressMeter = "1" -#Scratch = "1" -#URIs = "1" -#ZipFile = "0.9, 0.10" julia = "1.7" [extras] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "Random"] +test = ["Aqua", "Test", "Random"] diff --git a/src/client/julia/src/ADC.jl b/src/client/julia/src/ADC.jl index 6952a501..e6073519 100644 --- a/src/client/julia/src/ADC.jl +++ b/src/client/julia/src/ADC.jl @@ -1,7 +1,7 @@ export TriggerMode, INTERNAL, EXTERNAL, ADCPerformanceData, RPStatus, PerformanceData, RPPerformance, RPInfo, decimation, decimation!, numChan, samplesPerPeriod, samplesPerPeriod!, periodsPerFrame, periodsPerFrame!, currentWP, currentPeriod, currentFrame, masterTrigger, masterTrigger!, keepAliveReset, keepAliveReset!, -triggerMode, triggerMode!, startADC, stopADC, overwritten, corrupted, serverStatus, performanceData, +triggerMode, triggerMode!, overwritten, corrupted, serverStatus, performanceData, readSamples, startPipelinedData, stopTransmission, triggerPropagation, triggerPropagation! """ diff --git a/src/client/julia/src/ClusterView.jl b/src/client/julia/src/ClusterView.jl index 0abaa7ba..d8a15a4c 100644 --- a/src/client/julia/src/ClusterView.jl +++ b/src/client/julia/src/ClusterView.jl @@ -1,4 +1,4 @@ -export RedPitayaClusterView, master, readDataPeriods, numChan, readDataSlow, readFrames, readPeriods, readPipelinedSamples, startPipelinedData, collectSamples!, readData, readDataPeriods, modeDAC, viewToCluster, clusterToView +export RedPitayaClusterView, master, numChan, readFrames, readPeriods, startPipelinedData, collectSamples!, viewToCluster, clusterToView import Base: length, iterate, getindex, firstindex, lastindex diff --git a/src/client/julia/src/RedPitayaDAQServer.jl b/src/client/julia/src/RedPitayaDAQServer.jl index db7b2a55..78e0845d 100644 --- a/src/client/julia/src/RedPitayaDAQServer.jl +++ b/src/client/julia/src/RedPitayaDAQServer.jl @@ -12,7 +12,7 @@ import LinearAlgebra: normalize import Base: reset, iterate, length, push!, pop! -export RedPitaya, send, receive, query, start, stop, disconnect, ServerMode, serverMode, serverMode!, CONFIGURATION, ACQUISITION, TRANSMISSION, getLog, ScpiBatch, execute!, clear!, @add_batch +export RedPitaya, send, receive, query, disconnect, ServerMode, serverMode, serverMode!, CONFIGURATION, ACQUISITION, TRANSMISSION, getLog, ScpiBatch, execute!, clear!, @add_batch # TODO: The update stuff increases load times quite a bit. Should we move this to a script? # using ProgressMeter @@ -139,7 +139,7 @@ function query(rp::RedPitaya, cmd::String, T::Type, timeout::Number=getTimeout() end # connect with timeout implementation -function Sockets.connect(host, port::Integer, timeout::Number) +function connectTimeout(host, port::Integer, timeout::Number) s = TCPSocket() t = Timer(_ -> close(s), timeout) try @@ -156,8 +156,8 @@ end function connect(rp::RedPitaya) if !rp.isConnected begin - rp.socket = connect(rp.host, rp.port, getTimeout()) - rp.dataSocket = connect(rp.host, rp.dataPort, getTimeout()) + rp.socket = connectTimeout(rp.host, rp.port, getTimeout()) + rp.dataSocket = connectTimeout(rp.host, rp.dataPort, getTimeout()) rp.isConnected = true updateCalib!(rp) temp = findall([calibDACScale(rp, 1) < _scaleWarning, calibDACScale(rp, 2) < _scaleWarning]) diff --git a/src/client/julia/src/Sequence.jl b/src/client/julia/src/Sequence.jl index b9d46b0e..b83a8649 100644 --- a/src/client/julia/src/Sequence.jl +++ b/src/client/julia/src/Sequence.jl @@ -121,8 +121,8 @@ struct SimpleSequence <: AbstractSequence return new(SequenceLUT(lut, repetitions), enable) end end -SimpleSequence(lut::Array, repetitions::Integer, enable=nothing) = SimpleSequence(map(Float32, lut), repetitions, enable) -SimpleSequence(lut::Vector, repetitions::Integer, enable=nothing) = SimpleSequence(reshape(lut, 1, :), repetitions, enable) +SimpleSequence(lut::Array{T}, repetitions::Integer, enable::Union{Array{Bool}, Nothing}=nothing) where T <: Real = SimpleSequence(map(Float32, lut), repetitions, enable) +SimpleSequence(lut::Vector{T}, repetitions::Integer, enable::Union{Array{Bool}, Nothing}=nothing) where T <: Real = SimpleSequence(reshape(lut, 1, :), repetitions, enable) enableLUT(seq::SimpleSequence) = seq.enable valueLUT(seq::SimpleSequence) = seq.lut @@ -179,8 +179,8 @@ struct HoldBorderRampingSequence <: RampingSequence end end -HoldBorderRampingSequence(lut::Array, repetitions::Integer, rampingSteps::Integer, enable=nothing) = HoldBorderRampingSequence(map(Float32, lut), repetitions, rampingSteps, enable) -HoldBorderRampingSequence(lut::Vector, repetitions::Integer, rampingSteps::Integer, enable=nothing) = HoldBorderRampingSequence(reshape(lut, 1, :), repetitions, rampingSteps, enable) +HoldBorderRampingSequence(lut::Array{T}, repetitions::Integer, rampingSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) where T <: Real = HoldBorderRampingSequence(map(Float32, lut), repetitions, rampingSteps, enable) +HoldBorderRampingSequence(lut::Vector{T}, repetitions::Integer, rampingSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) where T <: Real = HoldBorderRampingSequence(reshape(lut, 1, :), repetitions, rampingSteps, enable) function HoldBorderRampingSequence(rp::RedPitaya, lut, repetitions, enable=nothing) rampTime = maximum([rampingDAC(rp,i) for i=1:2 if enableRamping(rp, i)]) @@ -197,7 +197,7 @@ struct ConstantRampingSequence <: RampingSequence lut::SequenceLUT enable::Union{Array{Bool}, Nothing} ramping::SequenceLUT - function ConstantRampingSequence(lut::Array{Float32}, repetitions::Integer, rampingValue::Float32, rampingSteps::Integer, enable::Union{Array{Bool}, Nothing} = nothing) + function ConstantRampingSequence(lut::Array{Float32}, repetitions::Integer, rampingValue::Float32, rampingSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) if !isnothing(enable) && size(lut) != size(enable) throw(DimensionMismatch("Size of enable LUT does not match size of value LUT")) end @@ -205,9 +205,9 @@ struct ConstantRampingSequence <: RampingSequence return new(SequenceLUT(lut, repetitions), enable, rampingLut) end end - -ConstantRampingSequence(lut::Array, repetitions, rampingValue, rampingSteps, enable=nothing) = ConstantRampingSequence(map(Float32, lut), repetitions, Float32(rampingValue), rampingSteps, enable) -ConstantRampingSequence(lut::Vector, repetitions, rampingValue, rampingSteps, enable=nothing) = ConstantRampingSequence(reshape(lut, 1, :), repetitions, rampingValue, rampingSteps, enable) +ConstantRampingSequence(lut::Array{T}, repetitions::Integer, rampingValue::Real, rampingSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) where T <: Real = ConstantRampingSequence(map(Float32, lut), repetitions, Float32(rampingValue), rampingSteps, enable) +ConstantRampingSequence(lut::Vector{Float32}, repetitions::Integer, rampingValue::Float32, rampingSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) = ConstantRampingSequence(reshape(lut, 1, :), repetitions, rampingValue, rampingSteps, enable) +ConstantRampingSequence(lut::Vector{T}, repetitions::Integer, rampingValue::Real, rampingSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) where T <: Real = ConstantRampingSequence(reshape(lut, 1, :), repetitions, rampingValue, rampingSteps, enable) enableLUT(seq::ConstantRampingSequence) = seq.enable valueLUT(seq::ConstantRampingSequence) = seq.lut @@ -240,10 +240,9 @@ struct StartUpSequence <: RampingSequence return new(SequenceLUT(lut, repetitions), enable, up, down) end end - - -StartUpSequence(lut::Array, repetitions::Integer, rampingSteps::Integer, startUpSteps::Integer, enable=nothing) = StartUpSequence(map(Float32, lut), repetitions, rampingSteps, startUpSteps, enable) -StartUpSequence(lut::Vector, repetitions::Integer, rampingSteps::Integer, startUpSteps::Integer, enable=nothing) = StartUpSequence(reshape(lut, 1, :), repetitions, rampingSteps, startUpSteps, enable) +StartUpSequence(lut::Array{T}, repetitions::Integer, rampingSteps::Integer, startUpSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) where T <: Real = StartUpSequence(map(Float32, lut), repetitions, rampingSteps, startUpSteps, enable) +#StartUpSequence(lut::Vector{Float32}, repetitions::Integer, rampingSteps::Integer, startUpSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) = StartUpSequence(reshape(lut, 1, :), repetitions, rampingSteps, startUpSteps, enable) +StartUpSequence(lut::Vector{T}, repetitions::Integer, rampingSteps::Integer, startUpSteps::Integer, enable::Union{Array{Bool}, Nothing}=nothing) where T <: Real = StartUpSequence(reshape(lut, 1, :), repetitions, rampingSteps, startUpSteps, enable) enableLUT(seq::StartUpSequence) = seq.enable valueLUT(seq::StartUpSequence) = seq.lut diff --git a/src/client/julia/test/runtests.jl b/src/client/julia/test/runtests.jl index 0c4352c4..1ada1dc8 100644 --- a/src/client/julia/test/runtests.jl +++ b/src/client/julia/test/runtests.jl @@ -1,5 +1,9 @@ using RedPitayaDAQServer using Test +using Aqua -# write your own tests here -@test 1 == 1 +@testset "RedPitayaDAQServer" begin + @testset "Aqua" begin + Aqua.test_all(RedPitayaDAQServer) + end +end \ No newline at end of file