projects [was: Re: Started doing the Multi - Filter component for dives.]

Robert Helling helling at atdotde.de
Fri Sep 26 01:03:35 PDT 2014


On 26.09.2014, at 02:18, Gaetan Bisson <bisson at archlinux.org> wrote:

> [2014-09-25 13:28:36 -0700] Dirk Hohndel:
>> See - this is not enough for someone to get started. Come up with a clear
>> vision of how things should work and go from there.
> 
> Fair enough but I do not have a clear vision of how things should work.
> How about the following? It should require minimal changes to the UI and
> code while still allowing basic closed circuit dive planning.
> 
> Attached are pictures of how this would work from a user perspective,
> but let me detail this a little bit here:
> 
> We add a cylinder type called "CCR" (closed circuit rebreather) for
> which the fields "Size", "Work press", and "He%"are ignored. The field
> "Switch at" works as usual and the field "O2%" expects a setpoint, that
> is, the constant PPO2 the diver will be exposed to; they are usually
> expressed in bars but using 120% to denote 1.2 seems natural.
> 
> Just like other cylinders, this special cylinder can be used in dive
> planner points. Its label would be "CCR SP=1.2" where "1.2" is the
> setpoint.
> 
> We add a checkbox in the "Dive notes" frame that reads "Compute deco on
> CCR". When it is unchecked, the decompression schedule is computed as
> normal, ignoring special CCR cylinders. When it is checked, the last
> used CCR of the dive planner points is used for deco.
> 
> Would that make sense?

Do you want to try to do that yourself? It should not be too hard. If you want, I will guide you through this (or at least say how I would attempt that).

The nice thing is really that a lot is already there so you can get quite far by copying existing similar things, in particular for the UI/Qt bit. And you cannot overestimate the usefulness of tools like 

git grep

and the “Find Usages” entry in the context menu of Qt Creator that opens when you right click on a variable or function (or should I say attribute and method?). And, really, Qt Creator is the editor of choice as it helps you with completion (and by this syntax checking etc, it is really quite clever).

So, let’s get started:

1) Let us begin with the UI, the CCR checkbox in particular. As you already placed it below the “verbatim plan” checkbox, I would recommend to copy that checkbox’s code. A first idea, you get by

git grep -i verb

In particular, it tells you, you want to open qt-ui/plannerSettings.ui in the graphical editor and wit cut and paste make a duplicate of that checkbox below it (and name it sensibly, e.g. planCCR). Actually, I think a checkbox is not optimal, rather use a ComboBox with the three options OC/SCR/CCR (we will handle the SCR case in the same go).

2) The above grep shows you also the .cpp and .h files that hook up the checkbox to a preference variable. Copy that code so that there is also a preference variable of type enum {OC, SCR, CCR} that is connected to the checkbox/combo box.

3) For the set point, you want to add a column to the cylinder table. That is handled by the CylindersModel object with code in qt-ui/models.cpp and .h. Adding a column SETPOINT should’t be too hard (bonus points if it is only visible when in CCR mode).

4) For the internal handling a cylinder is described by a struct cylinder_t defined in dive.h. Add a set point field for that as well. Use “Find Usage” to see where you have to add code for that field as well. struct divedatapoint already has a po2 field, make sure that gets filled with the correct set point data.

5) Finally, for the actual planning. This is done in planner.c. I guess, not much needs to be done there, as all calls to add_segment already have the po2 field set (just make sure, it has the set point data there).

6) Finally, fill_pressures does use the presence of the po2 variable to determine that it should assume CCR mode. Maybe you could change that as well to make it look at the dive_comp_type field (and of course set that from your planCCR preference variable when dive planning.

That should be it. It really does not require anything new, you can just work with what is already there.

Best
Robert

PS: I hope I will soon send a patch that adds code for fill_pressures for SCR mode.





-- 
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics
                      Scientific Coordinator
                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik
                      Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339
                      http://www.atdotde.de

Enhance your privacy, use cryptography! My PGP keys have fingerprints
A9D1 A01D 13A5 31FA 6515  BB44 0820 367C 36BC 0C1D    and
DCED 37B6 251C 7861 270D  5613 95C7 9D32 9A8D 9B8F




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140926/1e1bb7c2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140926/1e1bb7c2/attachment.sig>


More information about the subsurface mailing list