Repository navigation
Conversation
…nge DAC voltages throw - The read/write timeouts are re-armed before every command. LibSerialPort's timeout is a budget that every read spends; set once at openport, the 10 s budget ran out after a few thousand commands and one command failed and reset the port (rig, 400 Hz: about 1 in 2,500-5,000; 0 in 10,000 after the fix). - scope.lock (ReentrantLock) is held by every command function across its write and its reply read, so tasks that share one scope cannot take each other's replies. The old positional constructor still works. - volttooutput throws ArgumentError for a non-finite or out-of-range voltage before anything is sent; new exported dac_range_volts(range). A failed command's error names the port and the cause. - The serial calls go through four one-line wrappers, so test/triggerscope.jl runs the driver against a fake port that models the spent timeout budget (41 tests, included last). Ported from v0.3.0-rc4 (PR #83), without dac_output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Thanks. The diagnosis is right, and LibSerialPort's own code confirms it: Three changes before merge, plus one small pre-existing bug in a function this PR already touches:
Left for a follow-up, since this behavior is older than this PR:
For when it's on hardware (not part of the merge decision):
Please put the fixes in one push. |
…nder the lock, refuse only invalid codes, progttl - The constructor's SerialPort(portname) goes through a fifth wrapper, _new_port; the test replaces it with a never-opened SerialPort on a NULL port, so sp_get_port_by_name (SP_ERR_ARG on Linux) is never called. - setdac, progdac, progwave, setrange and the interface's DAC output/range setters do the range lookup or update, the encoding, the command and the write/reply in one locked transaction: a RANGE change can no longer land between a code's encoding and its write (5 V on 0-5 V sent as 65535 after RANGE to 0-10 V = 10 V). - volttooutput refuses only non-finite voltages and rounded codes outside 0-65535; every voltage keeps the code it gave before (nextfloat(5.0) on 0-5 V = 65535). - progttl stores the value in ttlvalues (it wrote ttloutputs, the channel count: MethodError), after the reply. Tests: test/triggerscope.jl 76/76 (was 41); with the old lock placement the new checks fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. All four are in one push (ce3cadc):
The CHANGELOG entries are updated to match. Tests: The follow-ups you listed (caches updated before the reply, replies not checked as acknowledgements, |
The three Triggerscope fixes from
v0.3.0-rc4(#83), as a standalone, non-breaking PR. PR #90 noted that this work was still owed. Left out:dac_output, since a Triggerscope modulator is planned separately. If your local branch already covers this, take what is useful and close this one.What it fixes
openport, the 10 s budget was spent after a few thousand commands, so a command failed and the port was reset, losing that DAC write.writecommandnow re-arms both timeouts before every command, sorwtimeoutis the limit of one command.scope.lock(aReentrantLock) is held by every command function across its write and its reply read, so tasks sharing one scope cannot take each other's replies (for example two LCC1620 attenuators on different DACs). The positional constructor without the lock still works.volttooutput, and sosetdac,progdac,progwaveand the DAC output setter, throwsArgumentErrorfor a non-finite or out-of-range voltage before anything is sent. Before, the code was sent anyway.dac_range_volts(range).Tests
_arm_timeouts!,_flush_port!,_send!,_receive!).test/triggerscope.jlreplaces them, plusopenport/closeport, with a recorder, the same seam astcube_fake_sdk.jl, so no test can open a real port.Pkg.test()): 3292 pass, 3 broken, 1 fail + 1 error. The failure isskills.jl's symlink testset, which on Windows needs administrator rights to create a symlink (EPERM). The same environmental failure appears on the companion SLM branch, which has no Triggerscope changes; it is not related to this PR.🤖 Generated with Claude Code