aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/diveplannermodel.cpp
AgeCommit message (Collapse)Author
2017-12-02In planner variations use variables for delta valuesGravatar Stefan Fuchs
Plus a small layout change: Add a colon behind "Stop time". Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-02Planner variations stop time calculation cover all stopsGravatar Stefan Fuchs
Simplify the sum up of the deco stop times for analysis of the planner variations. Plus rename define for deco stop variations debug output Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01Remove unnecessary #include and correct whitespaceGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Change #include line to make Linux builds happyGravatar Robert C. Helling
Let's see if this helps the Linux build on TravisCI. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Document background computation of variationsGravatar Robert C. Helling
Update changelog, update user manual, clarify meaning in dive notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Disable plan variation in recreational modeGravatar Rick Walsh
Calculating variations when in recreational mode doesn't make sense, and can prevent variations from being calculated when switching back to Buhlmann or VPM-B modes. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-12-01Add imperial units to variations computationGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Don't block profile updates in variations computationGravatar Robert C. Helling
We needed to prevent updates when we messed with the diveplannerpointsmodel as those would trigger starting planning from scratch causing infinite loops. Now, the variations calculation operates on a copy of the diveplan, so the model is no longer involved and we should not block recalculations (as those might be triggered by the UI). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Make background calculation optionalGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Actually compute variations in backgroundGravatar Robert C. Helling
This reenables the computation of plan variations but now in a separate thread. Once finieshed, a signal is sent to update the notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Hand planner variables to profileGravatar Robert C. Helling
Pass the planner state struct to the profile computation so it can use deco_time and first ceiling to display VPM-B ceiling. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Localize global planner stateGravatar Robert C. Helling
For UI responsiveness, we need to be able to run the planner in the background. This needs the planner state to be localized (and we need to pass a pointer around). In order to not let too many lines overrun (and to save typing in the future) I have renamed instances of struct deco_state to ds. Yes this should have gone to a separate commit but I accidentally commit --amend'ed it. Computing of planner variations is temporarily disabled. Unlock the planner when returning early So we don't deadlock in add dive and recreational mode (which use the planner without actually planning). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Run variations calculation in backgroundGravatar Robert C. Helling
but there are still side effects and thus it crashes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-19Fix indentationGravatar Berthold Stoeger
Fix an indentation issue in qt-models/diveplannermodel.cpp. An if was indented as if it were part of an outer if. Correct indentation confirmed by Stefan Fuchs <sfuchs@gmx.de>. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-10-20Silence random warningsGravatar Dirk Hohndel
None of these seem to point to actual issues, so let's quiet them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-18Planner: Autom. move first datapoint gas to first gaslist position p2Gravatar Stefan Fuchs
This is a amendment to 24bd5a8dcebec886b8fbbf077fabfb2106dc7dcd Move the cylinder also to first position if first planner datapoint cylinder change because a row is added or deleted to the dive datapoints. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18init_deco correctly identify previous dives and report overlapping divesGravatar Stefan Fuchs
When changing the date/time of a dive in the planner the dive may end up in a totaly new position in respect to date/time of other dives in dive list table. It can be moved to the past or the future before or after other existing dives. It also could overlap with an existing dive. This change enables identification of a new "virtual" dive list position and based on this starts looking for previous dives. Then it (as before the change) does init the deco calculation with any applicable previous dive and surface interval. If some of these applicable dives overlap it returns a neg. surface time which is then used in the planner notes to prohibit display of results. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Correctly name member function gasChange of DivePlannerPointsModelGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Planner: Autom. move first datapoint gas to first gaslist positionGravatar Stefan Fuchs
In the planner it is best practise to start the dive with the first gas in the gaslist. Otherwise one would get a gaschange event at the very beginning of a dive. This change implements the following feature: Automatically move a gas to position 0 in the gaslist if the user selects this gas for the first dive data point. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Update diveplannerpoints cylinderidx when deleting a cylinderGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Used gas in dive planner points: Support for multiple cyl with same gasGravatar Stefan Fuchs
In the planner if one adds two or more cylinders with the same gasmix (e.g. back gas and bottom stage 18/45) the drop down and data in the used gas column of the planner points table will be filled with a more verbose string mentioning also the cyl number and the cyl type description. Makes it easier in such a case to select the right cylinder. Introduces also a helper function which tells you if there is another cylinder with the same gasmix as the provided cylinder. This also has an option if it should consider unused cylinders or not. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-04Planner settings ascend and descende rate: Wire up UI elements correctlyGravatar Stefan Fuchs
Wire up the UI elements (QSpinBoxes) for ascend rates (4x) and descend rate (1x) correctly so that the profile and calculation is updated immediately after the value is changed (e.g. increased/decresed by 1) by clicking the QSpinBox arrows. Until now one had to click into the profile or change another planner preference first before the change became effective. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-01Use helper function dive_endtime() where apropriateGravatar Stefan Fuchs
Calculating dive.when + dive.duration doesn't always give the correct endtime of a dive especially when a dive has surface interval(s) in the middle. Using the helper function dive_endtime() fixes this issue. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-09-20Remove option to apply GFlow at maxdepthGravatar Robert C. Helling
This option should have never been there. This is not how gradient factors are supposed to work. It would only trick users to use the wrong value.. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-09-20Add a checkbox to turn off plan variationsGravatar Robert C. Helling
... as those come with a performance penalty Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-09-16Don't comput plan variations when not in the plannerGravatar Robert C. Helling
Fixes #565 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Show variations in Runtime stringGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Compute variations of plansGravatar Robert C. Helling
Print out partial derivatives of stop times with respect to variation of depth and duratin of last manual segment. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Store a table of deco stops in plannerGravatar Robert C. Helling
... in addition to struct diveplan which combines all kinds of information Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Make plan take dive and decotimestep as argumentsGravatar Robert C. Helling
...rather than use a global variable and a macro. This should be a no-op in preparation to allow planning several versions of a dive. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26Adopt planner state caching to new structGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-04-29Add SPDX header to Qt modelsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-24Deal with additional line break in dive notes from plannerGravatar Stefan Fuchs
With current code when re-planning a dive the planner output in the dive notes is always moved down by one line. This fix avoids that this additional line break is added. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-20Identify user provided notes in plain text in replanGravatar Robert C. Helling
This is another attept at the problem if identifying a potentially user supplied text in the dive notes upon replannig a dive. It gets rid of the user visable position markers (*!* and ***) and cirumvents problems with mark-up by first converting the old notes to plan text (assuming that user only enters plain text in the notes field as we do in other places as well). Then the automatically added part is identified by locating the disclaimer in the text (if the user edited/delted the disclaimer or changed langue in between it is her problem to manually delete the old plan). Everything from the disclaimer on is deleted and replaced by the new plan. If the disclaimer is not found, the new plan is appended to the old notes. This way we make sure no information gets automatically deleted. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-04-20Handle CCR setpoint when replanning a diveGravatar Jan Mulder
When replanning a dive, the setpoint information from the profile waypoints were reset to 0, resulting in a dive that has a dive mode of CCR, but only with OC legs in the profile. This is just wrong, and is corrected here. Notice that there is no averaging involved (in the reduction of a replanned real dive that has more than 100 waypoints) as is done for depth. This is just fine for setpoint data. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-16Handle notes from plannerGravatar Stefan Fuchs
New strategy to identify old planner output in notes when replanning a dive: Text anchors ("*!*" and "***") added for planner output For backwards compatibility: If there is no anchor but an old table delete everything. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-16Last added dive planner point for correct lenght not always addedGravatar Stefan Fuchs
Don't add the last stop with addstop for correcting the lenght of the dive if planner generated points can be removed when replanning. Otherwise this will not be deleted when replanning a dive. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-28Always show notes when replanningGravatar Robert C. Helling
... as per popular request. Plus adding const keyword to constant strings. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-28Handle notes in replanGravatar Robert C. Helling
Upon replanning a dive, we want to delete the old dive plan in the notes and replace it with the actual. This fixes a problem when we failed to detect the old plan due to the deco model name appearing in the disclaimer that was used as a marker for the notes. This patch also adds translation markers for the deco model name strings.. Fixes #285 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-13Correctly trigger update of cylinder table trash icons in plannerGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-11Merge branch 'master' of https://github.com/dje29/subsurfaceGravatar Dirk Hohndel
2017-03-11Use abbreviations with dots.Gravatar Martin Měřinský
2017-03-11Change type of divedatepoint.depth to depth_tGravatar Robert C. Helling
... for consistency, while we are at it. There are still some internal depth variables which are ints somebody might take a go at those. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-11Make depth conversion work for negative depthsGravatar Robert C. Helling
This is needed in the altitude pressure conversion as there negative altitudes are possible (for diving in the netherlands or the Dead Sea). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-11Minimum gas calculation - Calculations and UI parametersGravatar Stefan Fuchs
Add minimum gas calculation to planner output. Add the two UI parameters prefs.sacfactor and prefs.problemsolvingtime. Connect UI signals and slots for recalculation of diveplan. Disable minimum gas calculation if there was already a warning before. If minimum gas result is larger then cylinder start pressure give warning message instead of result. Add line break before pO2 warnings but only if warnings exist. Signed-off-by: Joachim Ritter <jritter@bitsenke.de> Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-08Change calls to rint into lrint avoiding conversion warningsGravatar Jeremie Guichard
Using gcc option "-Wfloat-conversion" is useful to catch potential conversion errors (where lrint should be used). rint returns double and still raises the same warning, this is why this change updates all rint calls to lrint. In few places, where input type is a float, corresponding lrinf is used. Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-05Don't clear plan when (re-) planningGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-04Initialize cylinder indexGravatar Dirk Hohndel
Otherwise it's possible for an uninitialized value to be used in addStop which can cause crashes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-04Ensure correct length of the created diveGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-04Only honor drop stone mode when planning a diveGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>