Hi Martin,

Martin Ling writes:
> Hi Mathias,
> 
> I have had a go at merging your code into a unified Rigol DS driver:
> 
> https://github.com/martinling/libsigrok/commits/rigol_ds_unified
> 
> There are two commits there, the first just renames rigol-ds1xx2 to
> rigol-ds and the second adds your code for the DS2xx2 scopes.
> 
> I have not tested this at all yet but I wanted you to get a look as soon
> as possible so I'm posting it now. I can test on the DS1052E/DS1102D
> later today or tomorrow probably.

I tested it and found a bug with the DS2000 series - it was in my code
originally. Basically it failed to properly handle 2 channels.

See the patch below. BTW, this is the first patch I created with git, is
it OK?


MGri


---
 hardware/rigol-ds/api.c      |    1 +
 hardware/rigol-ds/protocol.c |    5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c
index fb3a11f..bb91b7b 100644
--- a/hardware/rigol-ds/api.c
+++ b/hardware/rigol-ds/api.c
@@ -648,6 +648,7 @@ static int dev_acquisition_start(const struct sr_dev_inst 
*sdi, void *cb_data)
                devc->num_frame_bytes = 0;
        } else {
                if (devc->enabled_analog_probes) {
+                       devc->channel_frame = devc->enabled_analog_probes->data;
                        /* Assume there already was a trigger event - don't 
wait */
                        if (rigol_ds2xx2_acquisition_start(sdi, FALSE) != SR_OK)
                                return SR_ERR;
diff --git a/hardware/rigol-ds/protocol.c b/hardware/rigol-ds/protocol.c
index 5ba110f..d5dc017 100644
--- a/hardware/rigol-ds/protocol.c
+++ b/hardware/rigol-ds/protocol.c
@@ -169,8 +169,6 @@ SR_PRIV int rigol_ds2xx2_acquisition_start(const struct 
sr_dev_inst *sdi,
        if (!(devc = sdi->priv))
                return SR_ERR;
 
-       devc->channel_frame = devc->enabled_analog_probes->data;
-
        sr_dbg("Starting acquisition on channel %d",
                   devc->channel_frame->index + 1);
 
@@ -366,11 +364,11 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void 
*cb_data)
                                && devc->enabled_analog_probes->next != NULL) {
                        /* We got the frame for the first analog channel, but
                         * there's a second analog channel. */
+                        devc->channel_frame = 
devc->enabled_analog_probes->next->data;
                        if (devc->model->series == 2) {
                                /* Do not wait for trigger to try and keep 
channel data related. */
                                rigol_ds2xx2_acquisition_start(sdi, FALSE);
                        } else {
-                               devc->channel_frame = 
devc->enabled_analog_probes->next->data;
                                rigol_ds_send(sdi, ":WAV:DATA? CHAN%c",
                                                devc->channel_frame->name[2]);
                        }
@@ -388,6 +386,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void 
*cb_data)
                                /* Get the next frame, starting with the first 
analog channel. */
                                if (devc->model->series == 2) {
                                        if (devc->enabled_analog_probes) {
+                                               devc->channel_frame = 
devc->enabled_analog_probes->data;
                                                /* Must wait for trigger 
because at
                                                 * slow timebases the scope will
                                                 * return old data otherwise. */
-- 
1.7.10.4


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to