From: Gerhard Sittig Date: Sat, 3 Dec 2022 06:49:47 +0000 (+0100) Subject: input/csv: unbreak assignment of zero values to analog channels X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;ds=inline;h=e7ed37042611345fdcd47dbd6b9e3ec6fc38919a;hp=e7ed37042611345fdcd47dbd6b9e3ec6fc38919a;p=libsigrok.git input/csv: unbreak assignment of zero values to analog channels Unconditionally assign the value of 0.0 to the current sample's position of analog data for the session feed. Not assigning that zero value could result in old data from previous chunks to transpire through, yielding invalid output from CSV import when analog data is involved. This amends commit 43bdef263420 which introduced support for analog channels in the CSV input module. And phrased the implementation for similarity with logic data's code paths, where bit manipulation is more complex, and only high bits get applied to a previously cleared sample memory. Which introduced that zero value ignoring issue. Depending on software versions which used single or double precision data types, either requires 2^20 or 2^19 samples to reproduce. input file content: CH1 5.1 5.2 5.3 5 ... 524280 more "5" values ... 5 0 0 0 ; last 0.0 sample 2^19 correctly imported as 0.0 0 ; wrongly imported as 5.1 (first sample from beginning) 0 ; wrongly imported as 5.2 (second sample from beginning) 0 ; wrongly imported as 5.3 (third sample from beginning) 5 5 5 command invocation: $ sigrok-cli -i example.csv -I csv:column_formats=a | tail incorrect output data: CH1: 5.000 CH1: 0.000 CH1: 0.000 CH1: 0.000 CH1: 5.100 CH1: 5.200 CH1: 5.300 CH1: 5.000 CH1: 5.000 CH1: 5.000 Reported-By: Markus Heidelberg ---