Clean up Shearwater string handling
Dirk Hohndel
dirk at hohndel.org
Sat Jul 8 20:41:00 PDT 2017
My code is beautiful. And creative.
So there.
I'll look at this tomorrow. I'm done working on Subsurface for today.
--
>From my phone
-------- Original Message --------
From: Linus Torvalds <torvalds at linux-foundation.org>
Sent: Sat Jul 08 20:27:53 PDT 2017
To: Dirk Hohndel <dirk at hohndel.org>
Cc: Subsurface Mailing List <subsurface at subsurface-divelog.org>
Subject: Clean up Shearwater string handling
Dirk, you added that nasty and disgusting
SAMPLE_VENDOR_SHEARWATER_TRANSMITTERDATA
thing because you didn't realize how the Shearwater parsing actually works.
It parses the whole dive when it does the header, so it's quite easy
to actually make that part do the transmitter status too, and to just
return it as a proper string using the nice DC_FIELD_STRING interface.
Of course, the shearwater code didn't do that DC_FIELD_STRING thing
very nicely for any of the other data either, so I rewrote that logic
to just match what the EON Steel does. The EON Steel way is the right
way to do that thing - parse it once, and fill in the info, and then
the DC_FIELD_STRING fetching just picks out the string data directly.
We could try to share the "add_string()" and "add_string_fmt()"
functions between the two, but that's a separate cleanup thing (and it
requires us to come to some agreement about the string array sizes)
In the meantime, this patch gets rid of the nasty vendor sample thing,
and returns the transmitter battery info as a string. It also fixes
some ugly duplication of the other string values.
It WorksForMe(tm), but since my test dive on my Perdix AI doesn't have
any actual pressure data, thats' not really saying much.
Can you give this a try? If it works for your dives that actually have
transmitter data, please let me know, and I can commit it and push it
out.
And then you can remove that nasty hack from subsurface too. Eww.
Linus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20170708/f899032b/attachment.html>
More information about the subsurface
mailing list