aboutsummaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Rick Walsh <rickmwalsh@gmail.com>2015-07-04 23:10:34 +1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-05 06:50:48 -0700
commit17ef6774e050fd4974d13d1a75d1d8d607de34c0 (patch)
treef64142396f0534d11292fbfffa1aec8ab9f962e7 /planner.c
parent8c4e1e6bfadaaa90c3f084c606a4ddf0bd30a95b (diff)
downloadsubsurface-17ef6774e050fd4974d13d1a75d1d8d607de34c0.tar.gz
Planner deco stops are at 10ft increments when measured in feet
When using feet as depth unit, deco stop levels should be at 10 ft rather than 3 m increments. For shallow stops, rounding means the difference is not apparent. However, with stops deeper than 30 feet, using 3 m increments leads stops at 39ft, 49ft, ..., 98ft, etc. Apart from making plans look messy, the old behaviour makes it harder to benchmark the planner against published profiles in imperial units. This revised patch uses the help macro M_OR_FT(6, 20) to set the last stop at the correct depth. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/planner.c b/planner.c
index 606fd1aab..507cea03a 100644
--- a/planner.c
+++ b/planner.c
@@ -17,12 +17,20 @@
#define TIMESTEP 2 /* second */
#define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */
-int decostoplevels[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000, 27000,
+int decostoplevels_metric[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000, 27000,
30000, 33000, 36000, 39000, 42000, 45000, 48000, 51000, 54000, 57000,
60000, 63000, 66000, 69000, 72000, 75000, 78000, 81000, 84000, 87000,
90000, 100000, 110000, 120000, 130000, 140000, 150000, 160000, 170000,
180000, 190000, 200000, 220000, 240000, 260000, 280000, 300000,
320000, 340000, 360000, 380000 };
+int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 21336, 24384, 27432,
+ 30480, 33528, 36576, 39624, 42672, 45720, 48768, 51816, 54864, 57912,
+ 60960, 64008, 67056, 70104, 73152, 76200, 79248, 82296, 85344, 88392,
+ 91440, 101600, 111760, 121920, 132080, 142240, 152400, 162560, 172720,
+ 182880, 193040, 203200, 223520, 243840, 264160, 284480, 304800,
+ 325120, 345440, 365760, 386080 };
+int decostoplevels[sizeof(decostoplevels_metric) / sizeof(int)];
+
double plangflow, plangfhigh;
bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions;
@@ -883,12 +891,15 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
diveplan->surface_pressure = SURFACE_PRESSURE;
create_dive_from_plan(diveplan, is_planner);
- if (prefs.last_stop) {
- decostoplevels[1] = 6000;
+ if (prefs.units.length == METERS ) {
+ memcpy(decostoplevels, decostoplevels_metric, sizeof(decostoplevels_metric));
} else {
- decostoplevels[1] = 3000;
+ memcpy(decostoplevels, decostoplevels_imperial, sizeof(decostoplevels_imperial));
}
+ if (prefs.last_stop)
+ decostoplevels[1] = M_OR_FT(6,20);
+
/* Let's start at the last 'sample', i.e. the last manually entered waypoint. */
sample = &displayed_dive.dc.sample[displayed_dive.dc.samples - 1];