Commit graph

26 commits

Author SHA1 Message Date
jan Iversen
4066a65592 backend-shared: correct wrong comment
Remove comment that was very false (next line contradicted the comment).

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:27:07 -08:00
jan Iversen
74d13b0554 diveplanner: move mobile specific calc to diveplannermodel
setBottomSac, setDecoSac and setFactor in diveplannermodel
receives display value which are then converted.

subsurface-mobile have slightly different values, move the
correction of these from plannershared to diveplannermodel, in
order to keep the whole convert in one place.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:26:53 -08:00
jan Iversen
14931db0a9 dive-planner: removed unused QML interface
Remove Q_PROPERTY and signals from plannershared, since they are
no longer used (transferred to qmlinterface).

Unregister object plannershared, since it is no longer used in QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:26:33 -08:00
jan Iversen
ff360d28f5 diveplanner: add surface_segment to plannershared
Add surface_segment to plannerShared and then
update desktop-widgets.

Signed-off-by: jan Iversen <jan@casacondor.com>

desktop-widgets: use plannerShared for surface_segment

Change getter/setter for surface_segment to plannerShared, in
order to share the conversion with mobile diveplanner

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
86fd49f2d7 diveplanner: adjust sac-factor calculation.
The real values are 1.0 to 10.0, but QML needs int so mobile
gets values 10.0 to 100.0

add sacfactor() to QMLInterface and update QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
cd3c2266f9 dive planner: correct bottomsac/decosac calc.
Move conversion cuft <-> liter from desktop-widget/diveplanner.cpp
to plannerShared, to facilitate the same results in mobile
diveplanner

Use Backend for bottomsac/decosac and update to check
for switch LITER <-> CUFT

Add bottomsac/decosac to QMLinterface.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
e55c740d84 diveplanner: call planner model directly for simple variables.
Variables without conversion, do not need to pass plannerShared
(due to the QML interface).

Simple variables do not pass plannerShared, but diveplanner
in desktop-widgets and qmlinterface in mobile-widgets call the
implementation directly.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
663fe7f78b backendShared: remove length slot
Length variables are updated from the QML and desktop directly.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:21:28 -08:00
jan Iversen
b0e46c208d mobile: move dive planner notes access to pure interface
Make notes rates available to QML through the Backend interface.
Remove the corresponding variables from plannerShared.

Getters are from prefs. while setters are linked to diveplan model.

Remark: signals from qPrefDivePlanner is used, because the diveplanner model
sets qPrefDivePlanner but do not issue special signals.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:20:42 -08:00
jan Iversen
1f51251f1b backend-shared: remove asc/desc functions
Ascent/Descent rate functions are fully implemented in diveplannermodel,
therefore remove these functions.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:49:02 -08:00
jan Iversen
80be2b570b backend-shared: add slot to detect switch METER <-> FEET
This allows to update plannermodel etc. and thus avoiding a restart when
changing units for length.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-04 10:56:55 -08:00
jan Iversen
694fcffa6e backend: correct deco2() problem in plannerShared
Divided by 1000 (int) instead of 1000.0 (float)
which caused precision problems.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 04:32:34 +09:00
jan Iversen
b7730d3813 backendShared: correct set_verbatim_plan in plannerShared.
Correct copy/paste error, set_verbatim_plan() should not call
setSacFactor() but setVerbatim().

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-30 04:46:57 +09:00
jan Iversen
b6b514ea86 planner: correct rating calculations.
Test show that the ratings calculations were off by +/- 1, due
to rounding errors. Found due to test cases in tests (other commits)

The calculations are copied 1-1 from diveplanner.cpp, but are
used slightly different in plannerShared.cpp

Correct calculations, by securing the calculation is done
with float precision and the rounded with lrint().

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-28 06:53:12 +09:00
jan Iversen
55d856b0fd plannerShared: add notes variables
Add
	display_runtime
	display_duration
	display_transitions
	verbatim_plan
	display_variations

Get is direct from qPrefDivePlanner and set is plannerModel

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 09:59:19 -08:00
jan Iversen
738ee360ba desktop-widgets: replace o2narcotic from plannerModel to plannerShared
Use plannerShared setter to update o2narcotic. This will also signal
the cylindermodel to calculate a new bestmix.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 09:58:21 -08:00
jan Iversen
c4d9b737cd plannerShared: add o2narcotic
Add include of cylinderModel
Add o2narcotic

the set function is special because it first
informs the plannerModel that there is a new value
and then ask cylindermodel to calculate a new bestmix

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:46:01 -08:00
jan Iversen
d8780fdd89 plannerShared: add variables from plannerModel
the variables are set through set functions in DivePlannerPointsModel,
but read via getters from qPrefDivePlanner.

Variables:
bottomsac
decosac
problemsolvingtime
sacfactor

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:41:07 -08:00
jan Iversen
5b9014aeb7 plannerShared: add variables from plannerModel with conversion
the variables are set through set functions in DivePlannerPointsModel,
but read via getters from qPrefDivePlanner and converted

Variables:
min_switch_duration

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:58 -08:00
jan Iversen
0a7e673c5f plannerShared: add variables that reference qPrefDivePlanner
These are simple pass-through functions (normally optimized away
by the compiler), and serve to make a consistent backend interface
which have a simpler use especially in QML.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:39 -08:00
jan Iversen
6f3d1d3747 plannerShared: add variables from plannerModel
the variables are set through set functions in DivePlannerPointsModel,
but read via getters from qPrefDivePlanner.

Variables:
drop_stone_mode
last_stop
switch_at_req_stop

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:17 -08:00
jan Iversen
8d322218a8 plannerShared: add variables that reference qPrefDiveplanner
These are simple pass-through functions (normally optimized away
by the compiler), and serve to make a consistent backend interface
which have a simpler use especially in QML.

Variables:
dobailout

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:38:40 -08:00
jan Iversen
b877dd973c plannerShared: add variables from plannerModel
the variables are set through set functions in DivePlannerPointsModel,
but read via getters from qPrefDivePlanner.

Variables:
planner_deco_mode
reserveGas
safetyStop
gflow
gfhigh
vpmb_conservatism

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:38:27 -08:00
jan Iversen
7751ec1c78 build-system: move plannerShared to backend-shared
WARNING: multi directory commit, needed to secure it builds.

move the core/plannerShared.* to backend-shared.

update CMakeLists.txt to include backend-shared lib in link process.

update ios project to reflect new directory

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 08:44:23 +09:00
jan Iversen
9c52aaf043 build-system: move exportfuncs to backend-shared
WARNING: multi directory commit, needed to secure it builds.

move the core/exportfuncs.* to backend-shared.

update backend-shared/CMakeLists.txt to generate backend-shared lib

update CMakeLists.txt to include backend-shared lib in link process.

update ios project to reflect new directory

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 08:44:23 +09:00
jan Iversen
0ab8bd5eca build-system: add new root dir backend-shared
WARNING: multi directory commit, needed to secure it builds.

leaving the shared backend sources in core, imposes a severe limitation,
that they cannot make use of e.g. qt-models, because that is created
after core (first library to be created).

The shared backend uses functionality from core and qt-models, so it
must be created when those are available and before desktop-widgets
or mobile-widgets are created.

Make a new root directory "backend-shared" with empty CMakeLists.txt

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 08:44:23 +09:00