From: Uwe Hermann Date: Sat, 6 Jul 2019 21:22:47 +0000 (+0200) Subject: hantek-4032l: Fix broken triggering on low signal. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=80d349756971fe8c4e3326e0d0e38a45a82a6554;p=libsigrok.git hantek-4032l: Fix broken triggering on low signal. The trigger range/mask "compression" procedure is apparently not required and breaks triggering on a low line state. This has been verified to fix the issue on a Hantek 4032L with FPGA version 0x4303. It is possible that the procedure mentioned above might be required for other FPGA versions, though that is unknown. If you experience trigger issues with other FPGA versions, please contact us for further debugging and testing. This fixes bug #1402. --- diff --git a/src/hardware/hantek-4032l/api.c b/src/hardware/hantek-4032l/api.c index 3dc54ba5..26a9315e 100644 --- a/src/hardware/hantek-4032l/api.c +++ b/src/hardware/hantek-4032l/api.c @@ -587,25 +587,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) channel = channel->next; } - /* Compress range mask value and apply range settings. */ - if (range_mask) { - cmd_pkt->trigger[0].flags.data_range_enabled = 1; - cmd_pkt->trigger[0].data_range_mask |= range_mask; - - uint32_t new_range_value = 0; - uint32_t bit_mask = 1; - while (range_mask) { - if ((range_mask & 1) != 0) { - new_range_value <<= 1; - if ((range_value & 1) != 0) - new_range_value |= bit_mask; - bit_mask <<= 1; - } - range_mask >>= 1; - range_value >>= 1; - } - cmd_pkt->trigger[0].data_range_max |= range_value; - } + cmd_pkt->trigger[0].flags.data_range_enabled = 1; + cmd_pkt->trigger[0].data_range_mask |= range_mask; + cmd_pkt->trigger[0].data_range_max = range_value; } usb_source_add(sdi->session, drvc->sr_ctx, 1000,