diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-23 10:25:31 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-23 12:55:33 -0800 |
commit | b6c9301e584722b9b46dffd4d759e8c60df520ad (patch) | |
tree | 2f963ec75672389692e532a8264dc83396900eb2 /dive.h | |
parent | 3e5a508b15fe28083dfdf5a049d33e8769616395 (diff) | |
download | subsurface-b6c9301e584722b9b46dffd4d759e8c60df520ad.tar.gz |
Move more dive computer filled data to the divecomputer structure
This moves the fields 'duration', 'surfacetime', 'maxdepth',
'meandepth', 'airtemp', 'watertemp', 'salinity' and 'surface_pressure'
to the per-divecomputer data structure. They are filled in by the dive
computer, and normally not edited.
NOTE! All actual *use* of this data was then changed from dive->field to
dive->dc.field programmatically with a shell-script and sed, and the
result then edited for details. So while the XML save and restore code
has been updated, all the displaying etc will currently always just show
the first dive computer entry.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r-- | dive.h | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -284,6 +284,11 @@ struct event { */ struct divecomputer { timestamp_t when; + duration_t duration, surfacetime; + depth_t maxdepth, meandepth; + temperature_t airtemp, watertemp; + pressure_t surface_pressure; + int salinity; // kg per 10000 l const char *model; uint32_t deviceid, diveid; int samples, alloc_samples; @@ -327,12 +332,7 @@ struct dive { char *divemaster, *buddy; int rating; degrees_t latitude, longitude; - depth_t maxdepth, meandepth; - int salinity; // kg per 10000 l - duration_t duration, surfacetime; int visibility; /* 0 - 5 star rating */ - temperature_t airtemp, watertemp; - pressure_t surface_pressure; cylinder_t cylinder[MAX_CYLINDERS]; weightsystem_t weightsystem[MAX_WEIGHTSYSTEMS]; char *suit; @@ -354,10 +354,10 @@ static inline int depth_to_mbar(int depth, struct dive *dive) { double specific_weight = 1.03 * 0.981; int surface_pressure = SURFACE_PRESSURE; - if (dive->salinity) - specific_weight = dive->salinity / 10000.0 * 0.981; - if (dive->surface_pressure.mbar) - surface_pressure = dive->surface_pressure.mbar; + if (dive->dc.salinity) + specific_weight = dive->dc.salinity / 10000.0 * 0.981; + if (dive->dc.surface_pressure.mbar) + surface_pressure = dive->dc.surface_pressure.mbar; return depth / 10.0 * specific_weight + surface_pressure + 0.5; } @@ -369,8 +369,8 @@ static inline int rel_mbar_to_depth(int mbar, struct dive *dive) { int cm; double specific_weight = 1.03 * 0.981; - if (dive->salinity) - specific_weight = dive->salinity / 10000.0 * 0.981; + if (dive->dc.salinity) + specific_weight = dive->dc.salinity / 10000.0 * 0.981; /* whole mbar gives us cm precision */ cm = mbar / specific_weight + 0.5; return cm * 10; |