diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-01-03 23:56:10 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-04 11:13:14 -0800 |
commit | 6dc247ff784d5fae6ba5721ff4c9683c1749999a (patch) | |
tree | 35b82513bbe864ee720d9ad94e0a54ba5eda38cc /gtk-gui.c | |
parent | 75b970f7accc2498289ea646b16d6f412efd1912 (diff) | |
download | subsurface-6dc247ff784d5fae6ba5721ff4c9683c1749999a.tar.gz |
Fix deco calculations to correctly use GF values and add CC support
The old implementation was broken in several ways.
For one thing the GF values are percentages, so they should normally be
0 < GF < 1 (well, some crazy people like to go above that).
With this most of the Bühlmann config constants were wrong.
Furthermore, after we adjust the pressure tolerance based on the gradient
factors, we need to convert this back into a depth (instead of passing
back the unmodified depth - oops).
Finally, this commit adds closed circuit support to the deco calculations.
Major progress and much more useful at this stage.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r-- | gtk-gui.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -36,7 +36,7 @@ struct preferences prefs = { SI_UNITS, { TRUE, FALSE, }, { FALSE, FALSE, FALSE, 1.6, 4.0, 13.0}, - FALSE, FALSE, FALSE, 30.0, 90.0 + FALSE, FALSE, FALSE, 0.30, 0.75 }; struct dcnicknamelist { @@ -821,7 +821,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data) gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 6); entry_gflow = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(entry_gflow), 4); - snprintf(threshold_text, sizeof(threshold_text), "%.0f", prefs.gflow); + snprintf(threshold_text, sizeof(threshold_text), "%.0f", prefs.gflow * 100); gtk_entry_set_text(GTK_ENTRY(entry_gflow), threshold_text); gtk_container_add(GTK_CONTAINER(frame), entry_gflow); gtk_widget_add_events(entry_gflow, GDK_FOCUS_CHANGE_MASK); @@ -831,7 +831,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data) gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 6); entry_gfhigh = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(entry_gfhigh), 4); - snprintf(threshold_text, sizeof(threshold_text), "%.0f", prefs.gfhigh); + snprintf(threshold_text, sizeof(threshold_text), "%.0f", prefs.gfhigh * 100); gtk_entry_set_text(GTK_ENTRY(entry_gfhigh), threshold_text); gtk_container_add(GTK_CONTAINER(frame), entry_gfhigh); gtk_widget_add_events(entry_gfhigh, GDK_FOCUS_CHANGE_MASK); @@ -858,6 +858,8 @@ static void preferences_dialog(GtkWidget *w, gpointer data) sscanf(gflow_text, "%lf", &prefs.gflow); gfhigh_text = gtk_entry_get_text(GTK_ENTRY(entry_gfhigh)); sscanf(gfhigh_text, "%lf", &prefs.gfhigh); + prefs.gflow /= 100.0; + prefs.gfhigh /= 100.0; set_gf(prefs.gflow, prefs.gfhigh); update_screen(); @@ -1316,12 +1318,14 @@ void init_ui(int *argcp, char ***argvp) conf_value = subsurface_get_conf("gflow", PREF_STRING); if (conf_value) { sscanf(conf_value, "%lf", &prefs.gflow); + prefs.gflow /= 100.0; set_gf(prefs.gflow, -1.0); free((void *)conf_value); } conf_value = subsurface_get_conf("gfhigh", PREF_STRING); if (conf_value) { sscanf(conf_value, "%lf", &prefs.gfhigh); + prefs.gfhigh /= 100.0; set_gf(-1.0, prefs.gfhigh); free((void *)conf_value); } |