Well, now that I've got the csv output module working with multiple analog
values - sort of - it's time to talk about making this sane.

There are only a few drivers that send frames. Most of them are
oscilloscopes, but there are a few "power measurement" devices that send
voltage/amps/watts. Some of them send only a single sample in a frame. Not
sure if all of them do. Lots of things send analog values that don't use
frames, but it's not clear how many, if any, send multiple analog values.
Other than the demo driver, anyway.

As you may have noticed, I didn't need frames from the demo driver to deal
with multiple analog values. Of course, I made some assumptions based on
the demo drivers behavior that may not be true in general. But since I
can't seem to find accurate format documentation, I can ask, try it and see
if anything else breaks, or both. Given that I don't expect to break
anything that wasn't already broken, I did the latter and am doing the
former here.

What I did was just counted the channels I saw, accumulating data to
finally output it after I saw "them all". The initial version counted "them
all" as all the channels I had configured. This caused the extra analog
packets from the demo driver to generate warnings. Both a warning about a
partial packet being discarded if logic channels were expected, since there
were no matching logic samples, and warnings about those packets being
short if the last analog packet being sent wasn't used, as it was treated
as the start of the next sample.

I dealt with the latter issue by switching to counting all channels being
sent. That gets worked out by checking the channel list in the header
packet. Then each analog packet counts however many are in it's list of
channels (yes, the format allows for multiple channels in a single analog
packet, so long as they share the same meaning). Unfortunately, logic
packets don't say how many channels they contain. I expect that in
practice, it's just 8 times the unit size, but I can't see anything that
prevents a device with a unitsize of 1 having only 7 channels, or more
accurately only listing 7 channels in the header packet if one of them is
disabled. So I had to count the # of logic channels in the header packet so
I could keep accurate track of how many channels had been seen.

I don't know that I expect anything to be done about this. Updating the
wiki would be nice, especially since it lists fields in the df header
packet that aren't actually there, and doesn't list some df packet types
that are being used. But I did feel that this should be at least written
down somewhere, hopefully where google can find it.

I'm going to do some things not related to sigrok input/output modules
before tackling the cvs input module for analog values. That may cause
cahnges to the cvs output module, because I think I'd like the default
output format to match the default input format, and that may not be the
case just yet.
------------------------------------------------------------------------------
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to