[PATCH Rebreather] Notification: Changes to sample structure
willemferguson at zoology.up.ac.za
Sat May 10 00:39:13 PDT 2014
Below is a patch that has been applied to the rebreather branch. This is
a first step
in preparing for code changes to accommodate rebreathers.
It is not submitted for pushing to master but the patch message is
circulated here for comment.
Change sample structure for typed variables and RAM space reduction
In line with previous discussions, the structure of sample in dive.h
is changed as follows: some new typedefs:
1) A type of o2pressure_t is created with units .mbar.
This affects the variable po2.
2) A type of shortduration_t is created with units .seconds.
This affects variables ndl and stoptime.
3) A type of bearing_t is created with units .degrees.
This affects variable bearing.
4) The other integer variables are more strongly defined
as uint8_t (variables sensor, cns and heartbeat)
The way that these variables now need to addressed in the rest
of the source code, e.g:
sample.po2 now becomes sample.po2.mbar
sample.ndl becomes sample.ndl.seconds
Because of these needs, many places in the existing code base
need changing. In this patch the following files are affected:
dive h: functions: sampe, typedefs
dive.c: functions: merge_samples, fixup_pressure
divelist.c: functions: calculate_otu, calculate_cns, add_dive_to_deco
libdivecomputer.c: function: sample_cb
load-git.c: functions: parse_sample_keyvalue, get_shortduration,
parse-xml.c: functions: sample_start, sample_end,
planner.c: functions: tissue_at_end, create_dive_from_plan, plan
profile.c: functions: populate_plot_entries
save-git.c: functions: save_git, sample
The methodology was to address compilation errors that arose after changing
the sample structure in dive.h. In most cases it was a mechanical
e.g. sample-po2 changed to sample.po2.mbar; but this was not always
I checked easily checkable things like the xml export, but this cannot
be a conclusive test and that other bugs have not been introduced.
More information about the subsurface