From 529bdef0d66ade01f7ae0c99d1f5577102bfe278 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 30 May 2019 20:51:30 +0200 Subject: Cleanup: create equipment.h header There is an equipment.c file, but no corresponding header. Move the corresponding functions into a newly created header. This does not improve compile time since, at least for now, equipment.h is included in dive.h. But it makes things more consistent. Signed-off-by: Berthold Stoeger --- core/equipment.h | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 core/equipment.h (limited to 'core/equipment.h') diff --git a/core/equipment.h b/core/equipment.h new file mode 100644 index 000000000..73e21b8ed --- /dev/null +++ b/core/equipment.h @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef EQUIPMENT_H +#define EQUIPMENT_H + +#include "units.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct dive; + +// o2 == 0 && he == 0 -> air +// o2 < 0 -> invalid +struct gasmix { + fraction_t o2; + fraction_t he; +}; +static const struct gasmix gasmix_invalid = { { -1 }, { -1 } }; +static const struct gasmix gasmix_air = { { 0 }, { 0 } }; + +enum cylinderuse {OC_GAS, DILUENT, OXYGEN, NOT_USED, NUM_GAS_USE}; // The different uses for cylinders + +typedef struct +{ + volume_t size; + pressure_t workingpressure; + const char *description; /* "LP85", "AL72", "AL80", "HP100+" or whatever */ +} cylinder_type_t; + +typedef struct +{ + cylinder_type_t type; + struct gasmix gasmix; + pressure_t start, end, sample_start, sample_end; + depth_t depth; + bool manually_added; + volume_t gas_used; + volume_t deco_gas_used; + enum cylinderuse cylinder_use; + bool bestmix_o2; + bool bestmix_he; +} cylinder_t; + +typedef struct +{ + weight_t weight; + const char *description; /* "integrated", "belt", "ankle" */ +} weightsystem_t; + +#define MAX_CYLINDERS (20) +#define MAX_WEIGHTSYSTEMS (6) +#define MAX_TANK_INFO (100) +#define MAX_WS_INFO (100) +#define W_IDX_PRIMARY 0 +#define W_IDX_SECONDARY 1 + +extern void add_cylinder_description(cylinder_type_t *); +extern void add_weightsystem_description(weightsystem_t *); +extern bool cylinder_nodata(const cylinder_t *cyl); +extern bool cylinder_none(const cylinder_t *cyl); +extern bool weightsystem_none(const weightsystem_t *ws); +extern void remove_cylinder(struct dive *dive, int idx); +extern void remove_weightsystem(struct dive *dive, int idx); +extern void reset_cylinders(struct dive *dive, bool track_gas); +#ifdef DEBUG_CYL +extern void dump_cylinders(struct dive *dive, bool verbose); +#endif + +void get_gas_string(struct gasmix gasmix, char *text, int len); +const char *gasname(struct gasmix gasmix); + +struct tank_info_t { + const char *name; + int cuft, ml, psi, bar; +}; +extern struct tank_info_t tank_info[MAX_TANK_INFO]; + +struct ws_info_t { + const char *name; + int grams; +}; +extern struct ws_info_t ws_info[MAX_WS_INFO]; + +#ifdef __cplusplus +} +#endif + +#endif // EQUIPMENT_H -- cgit v1.2.3-70-g09d2