[PATCH 0/2] Properly save and restore multiple pressure sensors

Linus Torvalds torvalds at linux-foundation.org
Tue Jul 25 19:24:36 PDT 2017


By "multiple" I obviously currently mean just two sensors for each sample, 
since that's our current limitation. But I have test-data that then 
alternates multiple sensors over those two slots, and the code is also 
written so that if people really end up wanting more than two concurrent 
pressure sensors, at least the saving and restoring should happily handle 
it.

Note that while saving and restoring can handle multiple sensors per 
sample, other parts of the code are still limited to just two (and some 
code only iterates over one single sensor). But with this code, I can at 
least save and load test-files with sensor data from multiple sensors, 
which will help me a lot. And from my (admittedly fairly limited) testing, 
we still save old-style data with no changes.

The first patch should introduce no changes at all, just moving one helper 
file and introducing another one. That prepares for a simpler and more 
legible second patch, which then actually looks at the dive sample data to 
see if it should be saved in the old legacy format or the new "pressure 
and cylinder index together" format.

For the git save format, we simply add a ":sensor" to the pressure reading 
to indicate which cylinder the pressure reading is from.

For the XML save format, we use "pressureN='xyz bar'" for cylinder N, 
since XML doesn't like having multiple nodes with the same name (so you 
can't just repeat "pressure=xyz" in XML and use the same trick we used for 
the git save format).

Linus Torvalds (2):
  Make sample pressure helper functions available to everybody
  Add support for loading and saving multiple pressure samples

 core/dive.c            | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++
 core/dive.h            |  2 ++
 core/libdivecomputer.c | 41 -------------------------
 core/load-git.c        |  7 ++++-
 core/parse-xml.c       | 22 +++++++++++++
 core/save-git.c        | 60 +++++++++++++++++++++++++-----------
 core/save-xml.c        | 45 +++++++++++++++++++--------
 7 files changed, 188 insertions(+), 72 deletions(-)

-- 
2.13.1.518.g0d864c4df



More information about the subsurface mailing list