diff options
24 files changed, 183 insertions, 83 deletions
diff --git a/Documentation/images/DiveListOptions.jpg b/Documentation/images/DiveListOptions.jpg Binary files differindex 38bfa37a8..785548ce1 100644 --- a/Documentation/images/DiveListOptions.jpg +++ b/Documentation/images/DiveListOptions.jpg diff --git a/Documentation/images/facebook1.jpg b/Documentation/images/facebook1.jpg Binary files differnew file mode 100644 index 000000000..f4a118c4c --- /dev/null +++ b/Documentation/images/facebook1.jpg diff --git a/Documentation/images/facebook1_f20.jpg b/Documentation/images/facebook1_f20.jpg Binary files differdeleted file mode 100644 index b446534ac..000000000 --- a/Documentation/images/facebook1_f20.jpg +++ /dev/null diff --git a/Documentation/images/facebook2.jpg b/Documentation/images/facebook2.jpg Binary files differnew file mode 100644 index 000000000..a527a45e6 --- /dev/null +++ b/Documentation/images/facebook2.jpg diff --git a/Documentation/images/facebook2_f20.jpg b/Documentation/images/facebook2_f20.jpg Binary files differdeleted file mode 100644 index 827557d0b..000000000 --- a/Documentation/images/facebook2_f20.jpg +++ /dev/null diff --git a/Documentation/images/icons/duringPhoto.png b/Documentation/images/icons/duringPhoto.png Binary files differnew file mode 100644 index 000000000..c91aa201a --- /dev/null +++ b/Documentation/images/icons/duringPhoto.png diff --git a/Documentation/images/icons/inAndOutPhoto.png b/Documentation/images/icons/inAndOutPhoto.png Binary files differnew file mode 100644 index 000000000..6693e0b05 --- /dev/null +++ b/Documentation/images/icons/inAndOutPhoto.png diff --git a/Documentation/images/icons/outsidePhoto.png b/Documentation/images/icons/outsidePhoto.png Binary files differnew file mode 100644 index 000000000..fb1d5882a --- /dev/null +++ b/Documentation/images/icons/outsidePhoto.png diff --git a/Documentation/images/profile_symbols.jpg b/Documentation/images/profile_symbols.jpg Binary files differnew file mode 100644 index 000000000..b4be48cbc --- /dev/null +++ b/Documentation/images/profile_symbols.jpg diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 8d5aa2871..e5fc49faa 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -3,8 +3,8 @@ // :author: Manual authors: Jacco van Koll, Dirk Hohndel, Reinout Hoornweg, // Linus Torvalds, Miika Turkia, Amit Chaudhuri, Jan Schubert, Willem // Ferguson, Salvador Cuñat, Pedro Neves -// :revnumber: 4.5 -// :revdate: October 2015 +// :revnumber: 4.6 +// :revdate: January 2017 :icons: :toc2: :toc-placement: manual @@ -18,8 +18,7 @@ image::images/Subsurface4Banner.jpg["Banner",align="center"] *Manual authors*: Willem Ferguson, Jacco van Koll, Dirk Hohndel, Reinout Hoornweg, Linus Torvalds, Miika Turkia, Amit Chaudhuri, Jan Schubert, Salvador Cuñat, Pedro Neves -[blue]#_Version 4.5, October 2015_# - +[blue]#_Version 4.6, January 2017_# Welcome as a user of _Subsurface_, an advanced dive logging program with extensive infrastructure to describe, organize, interpret and print scuba @@ -28,6 +27,7 @@ software solutions: - Do you need a flexible way of logging dives using recreational equipment, even without a dive computer? + - Do you wish to seamlessly include GPS locations of dive sites into your dive log? - Do you use two different dive computer brands, each with its own proprietary software for downloading dive logs? Do you dive with rebreathers as well as open circuit or recreational equipment? Do you use a Reefnet Sensus time-depth @@ -35,15 +35,17 @@ software solutions: interface for downloading dive logs from all of these different pieces of equipment, storing and analyzing the dive logs within a unified system. - Do you use more than one operating system? _Subsurface_ is fully compatible - with Mac, Linux and Windows, letting you access your dive log on each - operating system using a single application. - - Do you use Linux or Mac, but your dive computer has only Windows- based software - for downloading dive information (e.g. Mares)? _Subsurface_ provides a way of + with Mac, Linux and Windows, letting you access your dive log on a range of + operating systems using a single application. + - Do you use Linux or Mac, but your dive computer has only Windows-based software + for downloading dive information (e.g. Mares or Scubapro)? _Subsurface_ provides a way of downloading and analyzing your dive logs on other operating systems. - Do you need an intuitive graphical dive planner that integrates with, and takes into account, dives you’ve already logged? - Do you need a way of storing or backing up your dive log on the Internet, letting you view your dive log from anywhere using an Internet browser? + - Do you wish to access or modify your dive log using a mobile phone? + _Subsurface_ binaries are available for Windows PCs (Win XP or later), Intel based Macs (OS/X) and many Linux distributions. _Subsurface_ can be built for many more hardware platforms and software environments where Qt and @@ -909,6 +911,7 @@ select the dives into which this information is to be pasted. Then, from the main menu, select _Log -> Paste dive components_. All the selected dives now contain the data initially selected in the original source dive log. +[[S_Bookmarks]] ==== Adding Bookmarks to a dive Many divers wish to annotate dives with text that indicate particular events, @@ -991,7 +994,7 @@ available, as in dialogue *B*, above. Currently these are: - XML-formatted dive logs (DivingLog 5.0, MacDive and several other dive log systems) - Cochran dive logs - - UDDF-formatted dive logs (e.g. Kenozoooid) + - UDDF-formatted dive logs (e.g. Kenozooid) - UDCF-formatted dive logs - Poseidon MkVI CCR logs - APD Inspiration/Evolution CCR logs @@ -1000,6 +1003,8 @@ available, as in dialogue *B*, above. Currently these are: - OSTC Tools logs - JDiveLog - Suunto Dive Manager (DM3, DM4, DM5) + - DL7 files used by Diver's Alert network (DAN) + - Underwater technologies AV1 dive logs - CSV (text-based and spreadsheet-based) dive logs, including APD CCR logs Selecting the appropriate format and then the specific log file in the large window @@ -1082,7 +1087,7 @@ into _Subsurface_. [[S_ImportingCSVDives]] ===== Importing dives in CSV format from dive computers or other dive log software - _CSV_ files can be viewed using an ordinary text editor. A _CSV_ file is normally organized into +_CSV_ files can be viewed using an ordinary text editor. A _CSV_ file is normally organized into a single line that provides the headers (or _field names_ or _column headings_) of the data columns, followed by the data, one record per line. @@ -1807,6 +1812,12 @@ program shows a small white dot where each photo should be on the dive profile. In addition the _Photos_ tab shows only the file names of the photos. If the external drive with the photos is re-connected, the photos can be seen in the normal way. +==== Finding out which dives have associated photos. +Inspecting each individual dive in order to determine whether there are associated photos can be time consuming. There is a +rapid way of seeing which dives have associated photos and which not: activate the _Photos_ checkbox in the dropdown +list obtained by right-clicking on the header bar of the *Divelist*. In the *Divelist*, all dives with associated photographs +have an icon indicating whether the photographs were taken during the dive, just before/after the dive or both during and before/after the dive. More information is provided in the section dealing with <<S_Divelist_columns, photo icons on the *Divelist*>>. + [[S_FindMovedImages]] ==== Moving photographs among directories, hard disks or computers @@ -1851,7 +1862,6 @@ _Subsurface_ automatically checks and, if necessary, updates the fingerprints as **** - === Logging special types of dives This section gives examples of the versatility of _Subsurface_ as a dive logging tool. @@ -2157,7 +2167,6 @@ increases the size of the dive profile to fill the area of the panel. *Water temperature* is shown as a blue line with temperature values placed adjacent to significant changes. - [[S_InfoBox]] ==== The *Information Box* The Information box displays a large range of information about the dive @@ -2234,6 +2243,7 @@ air diving at a depth equalling the END. Figure (*B*) above shows an information box with a nearly complete set of data. + [[S_gas_pressure_graph]] ===== The Gas Pressure Bar Graph @@ -2295,6 +2305,30 @@ during a dive can be seen on the right hand side of the above figure for a diver The pressures in the fast compartments do not approach the GFHigh value any more and the diver is safer than in the situation indicated in graph *D*. +==== Computer-reported events during dive +Many dive computers record events during a dive. For instance, +most dive computers report alarms relating to high partial pressures of oxygen, +to rapid ascents or the exceeding of no-deco limits (NDL). +On the other hand, other events are classified as warnings and, for instance, occur when +the remaining gas in a cylinder falls below a predetermined limit, a deep stop needs to be performed or +the need to change gas during multicylinder dives. Some dive computers also report notifications, +e.g. when a safety stop is initiated or terminated or when a predetermined amount of OTUs have been incurred. +The alarms, warnings and notifications differs from one dive computer to another: some dive computers do not +report any of the above events, while others provide an extensive log of events. The reporting of events +is therefore a function of the dive computer used. In addition, _Subsurface_ does not always +have the ability to detect all the events reported by a specific dive computer. + +Events are indicated by symbols on the dive profile. Notifications are shown as a white, round symbol with a letter _i_; +warnings are indicated by a yellow triangle and alarms by a red triangle. By moving the cursor over a symbol, +the explanation is given in the bottom-most line of the _Information Box_ (see image below, where the cursor is positioned +over the alarm that was reported). + +image::images/profile_symbols.jpg["FIGURE: Profile notification symbols",align="center"] + +Some dive computers report _bookmarks_ that the diver has set during the dive. These are indicated as +a small red flag on the profile and are discussed more fully in the section on +<<S_Bookmarks,_inserting bookmarks_>>. + ==== The Profile Toolbar The dive profile can include graphs of the *partial pressures* @@ -2555,17 +2589,37 @@ image::images/ContextMenu.jpg["Figure: Context Menu",align="center"] The context menu is used in many functions described below. +[[S_Divelist_columns]] ==== Customizing the columns showed in the *Dive List* panel image::images/DiveListOptions.jpg["Example: Dive list info options",align="center"] The default information in the *Dive List* includes, for each dive, Dive_number, Date, Rating, Dive_depth, Dive_duration and Dive_location. This information can be controlled and changed by right-clicking on the -header bar of the *Dive List*. For instance, a right-click on the 'Date' header brings up a list of items -that can be shown in the dive list (see above). Select an item to be included in the *Dive List* or to be -deleted (reflected by the check symbols) and the list is immediately updated. Preferences for information +header bar of the *Dive List*, bringing up a list of columns +that can be shown in the dive list (see above). Check an items to be included in the *Dive List*. +The list is immediately updated. Preferences for information shown in the *Dive List* are saved and used when _Subsurface_ is re-opened. +[[S_Photos_divelist]] + +By selecting the _Photos_ checkbox in the dropdown list, an icon is shown indicating whether any photos +are associated with a particular dive. There are three icons: + +[icon="images/icons/duringPhoto.png"] +[NOTE] +This dive has photographs taken during the dive, typically using an underwater camera. + +[icon="images/icons/outsidePhoto.png"] +[NOTE] +This dive has photographs taken immediately before or immediately after the dive. This is useful for +finding photos of dive teams or boats just before/after the dive, whales or other surface animals seen +just before or after the dive, or of landscapes as seen from the boat. + +[icon="images/icons/inAndOutPhoto.png"] +[NOTE] +This dive has photographs taken both during the dive and immdiately before or after the dive. + [[S_Renumber]] === Renumbering the dives @@ -2750,38 +2804,37 @@ There are two ways to export dive information from Subsurface: Export of dives to _Facebook_ is handled differently from other types of export because a connection to _Facebook_ is required, needing a _Facebook_ userID and password. -If, from the *Main Menu*, you select _Share on -> Connect to -> Facebook_, a login screen comes up. -(image *A* to the left, below). Provide a _Facebook_ userID and password. -Once logged into to _Facebook_ , the panel -in image *B*, below is shown, including a _Disconnect from Facebook_ button to close the -_Facebook_ connection. - -image::images/facebook1_f20.jpg["Figure: Facebook login",align="center"] - -From the _Subsurface_ window it’s easy to determine whether _Subsurface_ has a valid connection to _Facebook_ -From the *Main Menu*, select _Share on_ (image *A*, below). Normally, the _Facebook_ option is greyed out. But +From the *Main Menu*, select _Share on -> Connect to -> Facebook_ (image *A* below) +A _Facebook_ login screen appears (image *B* below). Provide a _Facebook_ userID and password. +From the _Subsurface_ window it’s easy to determine whether _Subsurface_ has a valid connection to _Facebook_: +from the *Main Menu*, select _Share on_ (image *A*, below). Normally, the _Facebook_ option is greyed out. But if there is a connection to _Facebook_, this option is active (i.e. in black color and can be selected). -Having established a login to _Facebook_, transferring a dive profileto a _Facebook_ timeline is easy. -Ensure that the dive to be transferred to the timeline is shown in the _Subsurface_ *Dive Profile* panel. If, from the *Main Menu*, you -select _Share on -> Facebook_ (see image *A* below), a dialogue box is shown, determining the amount of additional information transferred along -with the dive profile (image *B*, below). To transfer a dive profile to _Facebook_, the name of a -_Facebook_ album is needed. The checkboxes on the left hand side let you decide how much -additional information should be transferred with the dive profile. This information is shown in the text box -on the right hand side of the panel (image *B*, below). You can easily edit the message that will be posted -with the dive profile. After specifying the additional information and verifying the text, select -the _OK_ button that triggers the transfer to _Facebook_. After the transfer +Once logged into to _Facebook_ , a panel is shown with a message: +"_To disconnect Subsurface from your Facebook account, use the 'Share on' menu entry_." +Close this message panel. + +image::images/facebook1.jpg["Figure: Facebook login",align="center"] + +Having established a login to _Facebook_, transferring a dive profile to a _Facebook_ timeline is easy. +In the _Subsurface_ *Dive Profile* panel, highlight the dive to be transferred. A dialogue box +is shown, determining the amount of additional information to be transferred +with the dive profile (image *A*, below). To transfer a dive profile to _Facebook_, the name of a +_Facebook_ album is needed. The checkboxes on the left hand side determine how much +additional information is added to the dive profile, shown in the text box +on the right hand side of the panel (image *A*, below). Customise the message that will be posted +with the dive profile by editing any of the information. After specifying additional information +and verifying the text, select the _OK_ button that triggers the transfer to _Facebook_. After the transfer is done, an acknowledgement dialogue appears, indicating it was successful. -Both the album created and the post to your timeline will be marked as -private. In order for friends to be able to see it, -change its permissions from a regular Facebook login either in a -browser or a Facebook app. +Both the album created and the post to your timeline are marked as +private. In order for friends to be able to see the post, +log into _Facebook_ using a browser or Facebook app and change its permissions. -image::images/facebook2_f20.jpg["Figure: Facebook login",align="center"] +image::images/facebook2.jpg["Figure: Facebook data submission",align="center"] -If required, then close the _Facebook_ connection by either closing _Subsurface_ or by selecting _File -> Preferences -> Facebook_ from -the Main Menu, and clicking the appropriate button on the Facebook Preferences panel. +If required, then close the _Facebook_ connection by selecting, from the *Main Menu*, +_Share on -> Disconnect from -> Facebook_ (image *B* above). [[S_Export_other]] === Export dive information to other destinations or formats @@ -2959,6 +3012,39 @@ _Open_ button. Several paid services exist on the Internet (e.g. Google, Amazon) where the same process could be used for the Cloud-based storage of dive logs. +== Several _Subsurface_ users on one desktop computer +A frequent need is for two or more persons to use _Subsurface_ on the same desktop computer. For instance +members of a household may use the same computer. There are two approaches for doing this. + +*A)* If the different users of a desktop computer do not log onto the desktop/laptop under different user names + then the simplest way is for each person to use her/his own divelog file within Subsurface. In this case John + would work with the _Subsurface_ file _johns-divelog_ and Joan would use _joans-divelog_. Select + the appropriate dive log by selecting, from the *Main Menu*, _File -> Open logbook_ and then select your own + dive log file from the list of files lower down in the menu. However, a problem arises if the users + prefer different settings for _Subsurface_. For instance, one diver may prefer to see the dive ceiling in the + *Profile Panel* and photos icons in the *Dive List*, while the other may not have these preferences. In addition, + the cloud connection is normally unique for each _Subsurface_ installation and if more than one user wishes to save + dive data on the cloud, it is inconvenient to open the *Preferences* and change the user-ID data every time + the cloud is accessed. To solve these problems, launch _Subsurface_ with a _--user=<user name>_ command-line option. + John can then activate _Subsurface_ with this command-line instruction: + + subsurface --user=John + +while Joan can launch _Subsurface_ using: + + subsurface --user=Joan + +In this case, each user's preferences, settings and cloud access information are stored separately, allowing + each diver to interact with _Subsurface_ in her/his preferred way and with individual cloud access. The above + process can be made user-friendly by creating a link/shortcut with a desktop icon that executes the above + command-line instruction. Use of the _--user=_ option therefore enables each user to create, maintain and + backup a separate dive log within a personalised user interface. This way, when each diver launches _Subsurface_, + it opens with the correct dive log as well as the appropriate display and backup preferences, and each diver + can access their own divelog on a mobile device using https://subsurface-divelog.org/documentation/subsurface-mobile-user-manual[_Subsurface-Mobile_]. + +*B)* On the other hand, if the users log onto the same computer using different userIDs and passwords (i.e. users each +have a separate user space), _Subsurface_ is available independently to each user and every diver automatically has a separate +user profile and settings, including unique cloud and _Subsurface-Mobile_ access. [[S_PrintDivelog]] == Printing a dive log diff --git a/core/deco.c b/core/deco.c index a445c2539..dd5cfa056 100644 --- a/core/deco.c +++ b/core/deco.c @@ -21,6 +21,7 @@ #include "dive.h" #include <assert.h> #include "core/planner.h" +#include "qthelperfromc.h" #define cube(x) (x * x * x) @@ -258,7 +259,7 @@ double tissue_tolerance_calc(const struct dive *dive, double pressure) buehlmann_inertgas_b[ci] = ((buehlmann_N2_b[ci] * tissue_n2_sat[ci]) + (buehlmann_He_b[ci] * tissue_he_sat[ci])) / tissue_inertgas_saturation[ci]; } - if (prefs.deco_mode != VPMB) { + if (decoMode() != VPMB) { for (ci = 0; ci < 16; ci++) { /* tolerated = (tissue_inertgas_saturation - buehlmann_inertgas_a) * buehlmann_inertgas_b; */ @@ -381,7 +382,7 @@ double he_factor(int period_in_seconds, int ci) double calc_surface_phase(double surface_pressure, double he_pressure, double n2_pressure, double he_time_constant, double n2_time_constant) { - double inspired_n2 = (surface_pressure - ((in_planner() && (prefs.deco_mode == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * NITROGEN_FRACTION; + double inspired_n2 = (surface_pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * NITROGEN_FRACTION; if (n2_pressure > inspired_n2) return (he_pressure / he_time_constant + (n2_pressure - inspired_n2) / n2_time_constant) / (he_pressure + n2_pressure - inspired_n2); @@ -522,7 +523,7 @@ void add_segment(double pressure, const struct gasmix *gasmix, int period_in_sec int ci; struct gas_pressures pressures; - fill_pressures(&pressures, pressure - ((in_planner() && (prefs.deco_mode == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE), + fill_pressures(&pressures, pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE), gasmix, (double) ccpo2 / 1000.0, dive->dc.divemode); if (buehlmann_config.gf_low_at_maxdepth && pressure > gf_low_pressure_this_dive) @@ -541,7 +542,7 @@ void add_segment(double pressure, const struct gasmix *gasmix, int period_in_sec tissue_inertgas_saturation[ci] = tissue_n2_sat[ci] + tissue_he_sat[ci]; } - if(prefs.deco_mode == VPMB) + if(decoMode() == VPMB) calc_crushing_pressure(pressure); return; } @@ -562,7 +563,7 @@ void clear_deco(double surface_pressure) { int ci; for (ci = 0; ci < 16; ci++) { - tissue_n2_sat[ci] = (surface_pressure - ((in_planner() && (prefs.deco_mode == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * N2_IN_AIR / 1000; + tissue_n2_sat[ci] = (surface_pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * N2_IN_AIR / 1000; tissue_he_sat[ci] = 0.0; max_n2_crushing_pressure[ci] = 0.0; max_he_crushing_pressure[ci] = 0.0; diff --git a/core/planner.c b/core/planner.c index cb11bfbaa..118ad751d 100644 --- a/core/planner.c +++ b/core/planner.c @@ -14,6 +14,7 @@ #include "planner.h" #include "gettext.h" #include "libdivecomputer/parser.h" +#include "qthelperfromc.h" #define TIMESTEP 2 /* second */ #define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */ @@ -173,7 +174,7 @@ unsigned int tissue_at_end(struct dive *dive, char **cached_datap) * portion of the dive. * Remember the value for later. */ - if ((prefs.deco_mode == VPMB) && (lastdepth.mm > sample->depth.mm)) { + if ((decoMode() == VPMB) && (lastdepth.mm > sample->depth.mm)) { pressure_t ceiling_pressure; nuclear_regeneration(t0.seconds); vpmb_start_gradient(); @@ -548,7 +549,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool plan_display_duration = prefs.display_duration; plan_display_transitions = prefs.display_transitions; - if (prefs.deco_mode == VPMB) { + if (decoMode() == VPMB) { deco = "VPM-B"; } else { deco = "BUHLMANN"; @@ -579,10 +580,10 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool } len = show_disclaimer ? snprintf(buffer, sz_buffer, "<div><b>%s<b></div><br>", disclaimer) : 0; - if (prefs.deco_mode == BUEHLMANN){ + if (decoMode() == BUEHLMANN){ snprintf(temp, sz_temp, translate("gettextFromC", "based on Bühlmann ZHL-16C with GFlow = %d and GFhigh = %d"), diveplan->gflow, diveplan->gfhigh); - } else if (prefs.deco_mode == VPMB){ + } else if (decoMode() == VPMB){ int temp_len; if (diveplan->vpmb_conservatism == 0) temp_len = snprintf(temp, sz_temp, "%s", translate("gettextFromC", "based on VPM-B at nominal conservatism")); @@ -592,7 +593,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool temp_len += snprintf(temp + temp_len, sz_temp - temp_len, translate("gettextFromC", ", effective GF=%d/%d"), diveplan->eff_gflow , diveplan->eff_gfhigh); - } else if (prefs.deco_mode == RECREATIONAL){ + } else if (decoMode() == RECREATIONAL){ snprintf(temp, sz_temp, translate("gettextFromC", "recreational mode based on Bühlmann ZHL-16B with GFlow = %d and GFhigh = %d"), diveplan->gflow, diveplan->gfhigh); } @@ -938,7 +939,7 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time // For consistency with other VPM-B implementations, we should not start the ascent while the ceiling is // deeper than the next stop (thus the offgasing during the ascent is ignored). // However, we still need to make sure we don't break the ceiling due to on-gassing during ascent. - if (prefs.deco_mode == VPMB && (deco_allowed_depth(tissue_tolerance_calc(&displayed_dive, + if (decoMode() == VPMB && (deco_allowed_depth(tissue_tolerance_calc(&displayed_dive, depth_to_bar(stoplevel, &displayed_dive)), surface_pressure, &displayed_dive, 1) > stoplevel)) return false; @@ -1096,7 +1097,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool nuclear_regeneration(clock); vpmb_start_gradient(); - if(prefs.deco_mode == RECREATIONAL) { + if(decoMode() == RECREATIONAL) { bool safety_stop = prefs.safetystop && max_depth >= 10000; track_ascent_gas(depth, &displayed_dive.cylinder[current_cylinder], avg_depth, bottom_time, safety_stop); // How long can we stay at the current depth and still directly ascent to the surface? @@ -1172,7 +1173,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool //CVA do { - is_final_plan = (prefs.deco_mode == BUEHLMANN) || (previous_deco_time - deco_time < 10); // CVA time converges + is_final_plan = (decoMode() == BUEHLMANN) || (previous_deco_time - deco_time < 10); // CVA time converges if (deco_time != 10000000) vpmb_next_gradient(deco_time, diveplan->surface_pressure / 1000.0); @@ -1372,7 +1373,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool } while (!is_final_plan); plan_add_segment(diveplan, clock - previous_point_time, 0, current_cylinder, po2, false); - if(prefs.deco_mode == VPMB) { + if(decoMode() == VPMB) { diveplan->eff_gfhigh = rint(100.0 * regressionb()); diveplan->eff_gflow = rint(100*(regressiona() * first_stop_depth + regressionb())); } diff --git a/core/pref.h b/core/pref.h index 78d49b11a..293899ab6 100644 --- a/core/pref.h +++ b/core/pref.h @@ -143,7 +143,7 @@ struct preferences { short cloud_verification_status; bool cloud_background_sync; geocoding_prefs_t geocoding; - enum deco_mode deco_mode; + enum deco_mode planner_deco_mode; short vpmb_conservatism; int time_threshold; int distance_threshold; diff --git a/core/profile.c b/core/profile.c index abe1757c4..01c1c0235 100644 --- a/core/profile.c +++ b/core/profile.c @@ -16,6 +16,7 @@ #include "libdivecomputer/parser.h" #include "libdivecomputer/version.h" #include "membuffer.h" +#include "qthelperfromc.h" //#define DEBUG_GAS 1 @@ -950,7 +951,7 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru int deco_time = 0, prev_deco_time = 10000000; char *cache_data_initial = NULL; /* For VPM-B outside the planner, cache the initial deco state for CVA iterations */ - if (prefs.deco_mode == VPMB && !in_planner()) + if (decoMode() == VPMB && !in_planner()) cache_deco_state(&cache_data_initial); /* For VPM-B outside the planner, iterate until deco time converges (usually one or two iterations after the initial) * Set maximum number of iterations to 10 just in case */ @@ -982,7 +983,7 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru entry->ceiling = (entry - 1)->ceiling; } else { /* Keep updating the VPM-B gradients until the start of the ascent phase of the dive. */ - if (prefs.deco_mode == VPMB && !in_planner() && (entry - 1)->ceiling >= first_ceiling && first_iteration == true) { + if (decoMode() == VPMB && !in_planner() && (entry - 1)->ceiling >= first_ceiling && first_iteration == true) { nuclear_regeneration(t1); vpmb_start_gradient(); /* For CVA calculations, start by guessing deco time = dive time remaining */ @@ -995,7 +996,7 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru else current_ceiling = entry->ceiling; /* If using VPM-B outside the planner, take first_ceiling_pressure as the deepest ceiling */ - if (prefs.deco_mode == VPMB && !in_planner()) { + if (decoMode() == VPMB && !in_planner()) { if (current_ceiling > first_ceiling) { time_deep_ceiling = t1; first_ceiling = current_ceiling; @@ -1027,8 +1028,8 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru * We don't for print-mode because this info doesn't show up there * If the ceiling hasn't cleared by the last data point, we need tts for VPM-B CVA calculation * It is not necessary to do these calculation on the first VPMB iteration, except for the last data point */ - if ((prefs.calcndltts && !print_mode && (prefs.deco_mode != VPMB || in_planner() || !first_iteration)) || - (prefs.deco_mode == VPMB && !in_planner() && i == pi->nr - 1)) { + if ((prefs.calcndltts && !print_mode && (decoMode() != VPMB || in_planner() || !first_iteration)) || + (decoMode() == VPMB && !in_planner() && i == pi->nr - 1)) { /* only calculate ndl/tts on every 30 seconds */ if ((entry->sec - last_ndl_tts_calc_time) < 30 && i != pi->nr - 1) { struct plot_data *prev_entry = (entry - 1); @@ -1044,14 +1045,14 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru char *cache_data = NULL; cache_deco_state(&cache_data); calculate_ndl_tts(entry, dive, surface_pressure); - if (prefs.deco_mode == VPMB && !in_planner() && i == pi->nr - 1) + if (decoMode() == VPMB && !in_planner() && i == pi->nr - 1) final_tts = entry->tts_calc; /* Restore "real" deco state for next real time step */ restore_deco_state(cache_data); free(cache_data); } } - if (prefs.deco_mode == VPMB && !in_planner()) { + if (decoMode() == VPMB && !in_planner()) { prev_deco_time = deco_time; // Do we need to update deco_time? if (final_tts > 0) diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 088067f26..1034316bb 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -1437,6 +1437,11 @@ extern "C" bool in_planner() return (currentApplicationState == "PlanDive" || currentApplicationState == "EditPlannedDive"); } +extern "C" enum deco_mode decoMode() +{ + return in_planner() ? prefs.planner_deco_mode : prefs.display_deco_mode; +} + void init_proxy() { QNetworkProxy proxy; diff --git a/core/qthelper.h b/core/qthelper.h index 357626bfc..4d39ad368 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -40,6 +40,7 @@ bool parseGpsText(const QString &gps_text, double *latitude, double *longitude); QByteArray getCurrentAppState(); void setCurrentAppState(QByteArray state); extern "C" bool in_planner(); +extern "C" enum deco_mode decoMode(); extern "C" void subsurface_mkdir(const char *dir); void init_proxy(); QString getUUID(); diff --git a/core/qthelperfromc.h b/core/qthelperfromc.h index 32aed8949..c23065a28 100644 --- a/core/qthelperfromc.h +++ b/core/qthelperfromc.h @@ -18,5 +18,6 @@ char *cloud_url(); char *hashfile_name_string(); char *picturedir_string(); const char *subsurface_user_agent(); +enum deco_mode decoMode(); #endif // QTHELPERFROMC_H diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 34fe3dd45..dfb486065 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -319,7 +319,7 @@ bool TechnicalDetailsSettings::calcndltts() const bool TechnicalDetailsSettings::buehlmann() const { - return (prefs.deco_mode == BUEHLMANN); + return (prefs.planner_deco_mode == BUEHLMANN); } int TechnicalDetailsSettings::gflow() const @@ -524,12 +524,12 @@ void TechnicalDetailsSettings::setCalcndltts(bool value) void TechnicalDetailsSettings::setBuehlmann(bool value) { - if (value == (prefs.deco_mode == BUEHLMANN)) + if (value == (prefs.planner_deco_mode == BUEHLMANN)) return; QSettings s; s.beginGroup(group); s.setValue("buehlmann", value); - prefs.deco_mode = value ? BUEHLMANN : VPMB; + prefs.planner_deco_mode = value ? BUEHLMANN : VPMB; emit buehlmannChanged(value); } @@ -1277,7 +1277,7 @@ int DivePlannerSettings::decoSac() const deco_mode DivePlannerSettings::decoMode() const { - return prefs.deco_mode; + return prefs.planner_deco_mode; } void DivePlannerSettings::setLastStop(bool value) @@ -1527,13 +1527,13 @@ void DivePlannerSettings::setDecoSac(int value) void DivePlannerSettings::setDecoMode(deco_mode value) { - if (value == prefs.deco_mode) + if (value == prefs.planner_deco_mode) return; QSettings s; s.beginGroup(group); s.setValue("deco_mode", value); - prefs.deco_mode = value; + prefs.planner_deco_mode = value; emit decoModeChanged(value); } @@ -2286,7 +2286,7 @@ void SettingsObjectWrapper::load() GET_INT("bottomsac", bottomsac); GET_INT("decosac", decosac); - prefs.deco_mode = deco_mode(s.value("deco_mode", default_prefs.deco_mode).toInt()); + prefs.planner_deco_mode = deco_mode(s.value("deco_mode", default_prefs.planner_deco_mode).toInt()); s.endGroup(); s.beginGroup("DiveComputer"); @@ -2340,7 +2340,7 @@ void SettingsObjectWrapper::sync() s.setValue("min_switch_duration", prefs.min_switch_duration); s.setValue("bottomsac", prefs.bottomsac); s.setValue("decosac", prefs.decosac); - s.setValue("deco_mode", int(prefs.deco_mode)); + s.setValue("deco_mode", int(prefs.planner_deco_mode)); s.endGroup(); } diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c index 200e23bef..7bff43750 100644 --- a/core/subsurfacestartup.c +++ b/core/subsurfacestartup.c @@ -86,7 +86,7 @@ struct preferences default_prefs = { .locale = { .use_system_language = true, }, - .deco_mode = BUEHLMANN, + .planner_deco_mode = BUEHLMANN, .vpmb_conservatism = 3, .distance_threshold = 1000, .time_threshold = 600, @@ -185,6 +185,8 @@ static void print_help() printf("\n --verbose|-v Verbose debug (repeat to increase verbosity)"); printf("\n --version Prints current version"); printf("\n --survey Offer to submit a user survey"); + printf("\n --user=<test> Choose configuration space for user <test>"); + printf("\n --cloud-timeout=<nr> Set timeout for cloud connection (0 < timeout < 60)"); printf("\n --win32console Create a dedicated console if needed (Windows only). Add option before everything else\n\n"); } diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index ee85d12bc..0eee95ebf 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -303,10 +303,10 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.drop_stone_mode->setChecked(prefs.drop_stone_mode); ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop); ui.min_switch_duration->setValue(prefs.min_switch_duration / 60); - ui.recreational_deco->setChecked(prefs.deco_mode == RECREATIONAL); - ui.buehlmann_deco->setChecked(prefs.deco_mode == BUEHLMANN); - ui.vpmb_deco->setChecked(prefs.deco_mode == VPMB); - disableDecoElements((int) prefs.deco_mode); + ui.recreational_deco->setChecked(prefs.planner_deco_mode == RECREATIONAL); + ui.buehlmann_deco->setChecked(prefs.planner_deco_mode == BUEHLMANN); + ui.vpmb_deco->setChecked(prefs.planner_deco_mode == VPMB); + disableDecoElements((int) prefs.planner_deco_mode); // should be the same order as in dive_comp_type! rebreather_modes << tr("Open circuit") << tr("CCR") << tr("pSCR"); diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp index e55ceb269..4b422fe81 100644 --- a/profile-widget/divetooltipitem.cpp +++ b/profile-widget/divetooltipitem.cpp @@ -8,6 +8,7 @@ #include <QSettings> #include <QGraphicsView> #include <QStyleOptionGraphicsItem> +#include "core/qthelper.h" void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon, const QPixmap& pixmap) { @@ -267,7 +268,7 @@ void ToolTipItem::refresh(const QPointF &pos) Q_ASSERT(view); painter.setPen(QColor(0, 0, 0, 255)); - if ((view->currentState == ProfileWidget2::PLAN && prefs.deco_mode == BUEHLMANN) || prefs.display_deco_mode == BUEHLMANN) + if (decoMode() == BUEHLMANN) painter.drawLine(0, 60 - entry->gfline / 2, 16, 60 - entry->gfline / 2); painter.drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2, 16, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure /2); diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 44e06eafb..f0df220e3 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -19,6 +19,7 @@ #include "desktop-widgets/diveplanner.h" #include "desktop-widgets/simplewidgets.h" #include "desktop-widgets/divepicturewidget.h" +#include "core/qthelper.h" #endif #include <libdivecomputer/parser.h> @@ -558,7 +559,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) // this copies the dive and makes copies of all the relevant additional data copy_dive(d, &displayed_dive); #ifndef SUBSURFACE_MOBILE - if ((currentState == PLAN && prefs.deco_mode == VPMB) || prefs.display_deco_mode == VPMB) + if (decoMode() == VPMB) decoModelParameters->setText(QString("VPM-B +%1").arg(prefs.vpmb_conservatism)); else decoModelParameters->setText(QString("GF %1/%2").arg(prefs.gflow).arg(prefs.gfhigh)); @@ -570,7 +571,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) plannerModel->deleteTemporaryPlan(); return; } - if ((currentState == PLAN && prefs.deco_mode == VPMB) || prefs.display_deco_mode == VPMB) + if (decoMode() == VPMB) decoModelParameters->setText(QString("VPM-B +%1").arg(diveplan.vpmb_conservatism)); else decoModelParameters->setText(QString("GF %1/%2").arg(diveplan.gflow).arg(diveplan.gfhigh)); diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index defd2c9b2..6fe4ac003 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -495,7 +495,7 @@ void DivePlannerPointsModel::setDecoMode(int mode) { auto planner = SettingsObjectWrapper::instance()->planner_settings; planner->setDecoMode(deco_mode(mode)); - emit recreationChanged(mode == int(prefs.deco_mode)); + emit recreationChanged(mode == int(prefs.planner_deco_mode)); emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1)); } diff --git a/tests/testplan.cpp b/tests/testplan.cpp index 43473db7a..a3fb5240a 100644 --- a/tests/testplan.cpp +++ b/tests/testplan.cpp @@ -32,7 +32,7 @@ void setupPrefsVpmb() prefs.ascratelast6m = prefs.ascrate50; prefs.descrate = 99000 / 60; prefs.last_stop = false; - prefs.deco_mode = VPMB; + prefs.planner_deco_mode = VPMB; prefs.vpmb_conservatism = 0; } @@ -284,7 +284,7 @@ void TestPlan::testMetric() setupPrefs(); prefs.unit_system = METRIC; prefs.units.length = units::METERS; - prefs.deco_mode = BUEHLMANN; + prefs.planner_deco_mode = BUEHLMANN; struct diveplan testPlan = {}; setupPlan(&testPlan); @@ -320,7 +320,7 @@ void TestPlan::testImperial() setupPrefs(); prefs.unit_system = IMPERIAL; prefs.units.length = units::FEET; - prefs.deco_mode = BUEHLMANN; + prefs.planner_deco_mode = BUEHLMANN; struct diveplan testPlan = {}; setupPlan(&testPlan); |