summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-04-02 18:05:02 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-02 10:55:19 -0700
commit0b8462bd584c7606e3a9091947ccdbf04a32dea8 (patch)
treecb354f7506a570bb85b8956450a3ca72c509bbc1 /planner.c
parent218fd994eea9ea81ca202470843aad6b9a2d3720 (diff)
downloadsubsurface-0b8462bd584c7606e3a9091947ccdbf04a32dea8.tar.gz
planning: Add option to have last stop at 6m/20ft
When diving in areas where there are risk of boats passing above you, its common practise to do the last stop at 6m to better stay out of harms way. When doing o2-deco, it doesn't matter for the deco time if you are doing all the time at 6m, due to that you don't have any inert gas in your breathing gas. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/planner.c b/planner.c
index 68f444882..6e279b877 100644
--- a/planner.c
+++ b/planner.c
@@ -677,6 +677,12 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep)
record_dive(dive);
}
while (stopidx > 0) { /* this indicates that we aren't surfacing directly */
+ /* if we are in a double-step, eg, when 3m/10ft stop is disabled,
+ * just skip the first stop at that depth */
+ if (stoplevels[stopidx] == stoplevels[stopidx - 1]) {
+ stopidx--;
+ continue;
+ }
if (gi >= 0 && stoplevels[stopidx] == gaschanges[gi].depth) {
o2 = dive->cylinder[gaschanges[gi].gasidx].gasmix.o2.permille;
he = dive->cylinder[gaschanges[gi].gasidx].gasmix.he.permille;
@@ -1191,6 +1197,16 @@ static gboolean gf_focus_out_cb(GtkWidget *entry, GdkEvent * event, gpointer dat
return FALSE;
}
+static gboolean last_stop_toggled_cb(GtkWidget *entry, GdkEvent * event, gpointer data)
+{
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(entry)) == TRUE)
+ decostoplevels[1] = 6000;
+ else
+ decostoplevels[1] = 3000;
+ show_planned_dive();
+ return FALSE;
+}
+
static GtkWidget *add_gas_combobox_to_box(GtkWidget *box, const char *label, int idx)
{
GtkWidget *frame, *combo;
@@ -1319,6 +1335,16 @@ void input_plan()
add_entry_with_callback(hbox, 12, _("Dive starts when?"), "+60:00", starttime_focus_out_cb, NULL);
add_entry_with_callback(hbox, 12, _("Surface Pressure (mbar)"), SURFACE_PRESSURE_STRING, surfpres_focus_out_cb, NULL);
+ if (get_units()->length == METERS)
+ labeltext = _("Last stop at 6 Meters");
+ else
+ labeltext = _("Last stop at 20 Feet");
+
+ content = gtk_check_button_new_with_label(labeltext);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(content), 0);
+ gtk_box_pack_start(GTK_BOX(hbox), content, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(content), "toggled", G_CALLBACK(last_stop_toggled_cb), NULL);
+
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
if (get_units()->volume == CUFT) {