2017-04-27 18:18:03 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-04-08 03:20:25 +00:00
|
|
|
#ifndef PLANNER_H
|
|
|
|
#define PLANNER_H
|
|
|
|
|
2014-08-05 10:58:23 +00:00
|
|
|
#define LONGDECO 1
|
2015-03-31 12:52:37 +00:00
|
|
|
#define NOT_RECREATIONAL 2
|
2013-08-30 18:06:26 +00:00
|
|
|
|
2019-08-05 18:43:06 +00:00
|
|
|
#include "units.h"
|
|
|
|
#include "divemode.h"
|
|
|
|
|
2020-05-01 10:48:17 +00:00
|
|
|
#define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */
|
|
|
|
|
2019-08-05 18:43:06 +00:00
|
|
|
/* this should be converted to use our types */
|
|
|
|
struct divedatapoint {
|
|
|
|
int time;
|
|
|
|
depth_t depth;
|
|
|
|
int cylinderid;
|
|
|
|
pressure_t minimum_gas;
|
|
|
|
int setpoint;
|
|
|
|
bool entered;
|
|
|
|
struct divedatapoint *next;
|
|
|
|
enum divemode_t divemode;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct diveplan {
|
|
|
|
timestamp_t when;
|
|
|
|
int surface_pressure; /* mbar */
|
|
|
|
int bottomsac; /* ml/min */
|
|
|
|
int decosac; /* ml/min */
|
|
|
|
int salinity;
|
|
|
|
short gflow;
|
|
|
|
short gfhigh;
|
|
|
|
short vpmb_conservatism;
|
|
|
|
struct divedatapoint *dp;
|
|
|
|
int eff_gflow, eff_gfhigh;
|
|
|
|
int surface_interval;
|
|
|
|
};
|
|
|
|
|
2013-08-30 18:06:26 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-06-01 21:17:06 +00:00
|
|
|
extern int validate_gas(const char *text, struct gasmix *gas);
|
2013-04-08 03:20:25 +00:00
|
|
|
extern int validate_po2(const char *text, int *mbar_po2);
|
2016-07-06 12:40:28 +00:00
|
|
|
extern int get_cylinderid_at_time(struct dive *dive, struct divecomputer *dc, duration_t time);
|
2014-05-30 22:40:13 +00:00
|
|
|
extern bool diveplan_empty(struct diveplan *diveplan);
|
2017-05-25 10:57:06 +00:00
|
|
|
extern void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, int error);
|
2019-09-01 15:52:25 +00:00
|
|
|
extern const char *get_planner_disclaimer();
|
2019-09-10 13:29:03 +00:00
|
|
|
extern char *get_planner_disclaimer_formatted();
|
2013-04-08 03:20:25 +00:00
|
|
|
|
2014-08-19 16:41:09 +00:00
|
|
|
extern void free_dps(struct diveplan *diveplan);
|
2013-08-30 18:06:26 +00:00
|
|
|
|
2019-08-05 18:43:06 +00:00
|
|
|
struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode);
|
|
|
|
#if DEBUG_PLAN
|
|
|
|
void dump_plan(struct diveplan *diveplan);
|
|
|
|
#endif
|
|
|
|
struct decostop {
|
|
|
|
int depth;
|
|
|
|
int time;
|
|
|
|
};
|
|
|
|
extern bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int timestep, struct decostop *decostoptable, struct deco_state **cached_datap, bool is_planner, bool show_disclaimer);
|
|
|
|
|
2013-08-30 18:06:26 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // PLANNER_H
|