mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Merge 7e3b171784
into be6b017534
This commit is contained in:
commit
6e756c1f8f
1 changed files with 12 additions and 14 deletions
|
@ -27,6 +27,8 @@
|
||||||
#include "qthelper.h"
|
#include "qthelper.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
//#define DEBUG_PLAN 255
|
||||||
|
|
||||||
static constexpr int base_timestep = 2; // seconds
|
static constexpr int base_timestep = 2; // seconds
|
||||||
|
|
||||||
static int decostoplevels_metric[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000, 27000,
|
static int decostoplevels_metric[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000, 27000,
|
||||||
|
@ -45,23 +47,19 @@ static int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 1828
|
||||||
#if DEBUG_PLAN
|
#if DEBUG_PLAN
|
||||||
void dump_plan(struct diveplan *diveplan)
|
void dump_plan(struct diveplan *diveplan)
|
||||||
{
|
{
|
||||||
struct divedatapoint *dp;
|
|
||||||
struct tm tm;
|
|
||||||
|
|
||||||
if (!diveplan) {
|
if (!diveplan) {
|
||||||
printf("Diveplan NULL\n");
|
printf("Diveplan NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
struct tm tm;
|
||||||
utc_mkdate(diveplan->when, &tm);
|
utc_mkdate(diveplan->when, &tm);
|
||||||
|
|
||||||
printf("\nDiveplan @ %04d-%02d-%02d %02d:%02d:%02d (surfpres %dmbar):\n",
|
printf("\nDiveplan @ %04d-%02d-%02d %02d:%02d:%02d (surfpres %dmbar):\n",
|
||||||
tm.tm_year, tm.tm_mon + 1, tm.tm_mday,
|
tm.tm_year, tm.tm_mon + 1, tm.tm_mday,
|
||||||
tm.tm_hour, tm.tm_min, tm.tm_sec,
|
tm.tm_hour, tm.tm_min, tm.tm_sec,
|
||||||
diveplan->surface_pressure.mbar);
|
diveplan->surface_pressure.mbar);
|
||||||
dp = diveplan->dp;
|
for (auto &dp: diveplan->dp) {
|
||||||
while (dp) {
|
printf("\t%3u:%02u: %6dmm cylid: %2d setpoint: %d\n", FRACTION_TUPLE(dp.time, 60), dp.depth.mm, dp.cylinderid, dp.setpoint);
|
||||||
printf("\t%3u:%02u: %6dmm cylid: %2d setpoint: %d\n", FRACTION_TUPLE(dp->time, 60), dp->depth, dp->cylinderid, dp->setpoint);
|
|
||||||
dp = dp->next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -209,7 +207,7 @@ static void create_dive_from_plan(struct diveplan &diveplan, struct dive *dive,
|
||||||
return;
|
return;
|
||||||
#if DEBUG_PLAN & 4
|
#if DEBUG_PLAN & 4
|
||||||
printf("in create_dive_from_plan\n");
|
printf("in create_dive_from_plan\n");
|
||||||
dump_plan(diveplan);
|
dump_plan(&diveplan);
|
||||||
#endif
|
#endif
|
||||||
dive->salinity = diveplan.salinity;
|
dive->salinity = diveplan.salinity;
|
||||||
// reset the cylinders and clear out the samples and events of the
|
// reset the cylinders and clear out the samples and events of the
|
||||||
|
@ -296,7 +294,7 @@ static void create_dive_from_plan(struct diveplan &diveplan, struct dive *dive,
|
||||||
dc->last_manual_time.seconds = last_manual_point;
|
dc->last_manual_time.seconds = last_manual_point;
|
||||||
|
|
||||||
#if DEBUG_PLAN & 32
|
#if DEBUG_PLAN & 32
|
||||||
save_dive(stdout, *dive);
|
save_dive(stdout, *dive, false);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -392,8 +390,8 @@ static std::vector<gaschanges> analyze_gaslist(const struct diveplan &diveplan,
|
||||||
#if DEBUG_PLAN & 16
|
#if DEBUG_PLAN & 16
|
||||||
for (size_t nr = 0; nr < gaschanges.size(); nr++) {
|
for (size_t nr = 0; nr < gaschanges.size(); nr++) {
|
||||||
int idx = gaschanges[nr].gasidx;
|
int idx = gaschanges[nr].gasidx;
|
||||||
printf("gaschange nr %d: @ %5.2lfm gasidx %d (%s)\n", nr, gaschanges[nr].depth / 1000.0,
|
printf("gaschange nr %zu: @ %5.2lfm gasidx %d (%s)\n", nr, gaschanges[nr].depth / 1000.0,
|
||||||
idx, dive.get_cylinder(idx)->gasmix.name().c_str());
|
idx, dive->get_cylinder(idx)->gasmix.name().c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return gaschanges;
|
return gaschanges;
|
||||||
|
@ -789,7 +787,7 @@ std::vector<decostop> plan(struct deco_state *ds, struct diveplan &diveplan, str
|
||||||
|
|
||||||
#if DEBUG_PLAN & 16
|
#if DEBUG_PLAN & 16
|
||||||
printf("switch to gas %d (%d/%d) @ %5.2lfm\n", best_first_ascend_cylinder,
|
printf("switch to gas %d (%d/%d) @ %5.2lfm\n", best_first_ascend_cylinder,
|
||||||
(get_o2(&gas) + 5) / 10, (get_he(&gas) + 5) / 10, gaschanges[best_first_ascend_cylinder].depth / 1000.0);
|
(get_o2(gas) + 5) / 10, (get_he(gas) + 5) / 10, gaschanges[best_first_ascend_cylinder].depth / 1000.0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -902,7 +900,7 @@ std::vector<decostop> plan(struct deco_state *ds, struct diveplan &diveplan, str
|
||||||
#if DEBUG_PLAN & 16
|
#if DEBUG_PLAN & 16
|
||||||
gas = dive->get_cylinder(current_cylinder)->gasmix;
|
gas = dive->get_cylinder(current_cylinder)->gasmix;
|
||||||
printf("switch to gas %d (%d/%d) @ %5.2lfm\n", gaschanges[gi].gasidx,
|
printf("switch to gas %d (%d/%d) @ %5.2lfm\n", gaschanges[gi].gasidx,
|
||||||
(get_o2(&gas) + 5) / 10, (get_he(&gas) + 5) / 10, gaschanges[gi].depth / 1000.0);
|
(get_o2(gas) + 5) / 10, (get_he(gas) + 5) / 10, gaschanges[gi].depth / 1000.0);
|
||||||
#endif
|
#endif
|
||||||
/* Stop for the minimum duration to switch gas unless we switch to o2 */
|
/* Stop for the minimum duration to switch gas unless we switch to o2 */
|
||||||
if (!last_segment_min_switch && get_o2(dive->get_cylinder(current_cylinder)->gasmix) != 1000) {
|
if (!last_segment_min_switch && get_o2(dive->get_cylinder(current_cylinder)->gasmix) != 1000) {
|
||||||
|
@ -956,7 +954,7 @@ std::vector<decostop> plan(struct deco_state *ds, struct diveplan &diveplan, str
|
||||||
#if DEBUG_PLAN & 16
|
#if DEBUG_PLAN & 16
|
||||||
gas = dive->get_cylinder(current_cylinder)->gasmix;
|
gas = dive->get_cylinder(current_cylinder)->gasmix;
|
||||||
printf("switch to gas %d (%d/%d) @ %5.2lfm\n", gaschanges[gi + 1].gasidx,
|
printf("switch to gas %d (%d/%d) @ %5.2lfm\n", gaschanges[gi + 1].gasidx,
|
||||||
(get_o2(&gas) + 5) / 10, (get_he(&gas) + 5) / 10, gaschanges[gi + 1].depth / 1000.0);
|
(get_o2(gas) + 5) / 10, (get_he(gas) + 5) / 10, gaschanges[gi + 1].depth / 1000.0);
|
||||||
#endif
|
#endif
|
||||||
/* Stop for the minimum duration to switch gas unless we switch to o2 */
|
/* Stop for the minimum duration to switch gas unless we switch to o2 */
|
||||||
if (!last_segment_min_switch && get_o2(dive->get_cylinder(current_cylinder)->gasmix) != 1000) {
|
if (!last_segment_min_switch && get_o2(dive->get_cylinder(current_cylinder)->gasmix) != 1000) {
|
||||||
|
|
Loading…
Reference in a new issue