mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: make the plot-pressure type an enum
Sadly, this doesn't give any type safety. But at least it documents the function arguments. Make the last item in the enum as a number-of-pressure-entries sentinel. Use that to size the pressure-values array. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
39ede7e9e8
commit
f145b116f0
1 changed files with 10 additions and 10 deletions
|
@ -16,17 +16,20 @@ typedef enum {
|
||||||
CRAZY
|
CRAZY
|
||||||
} velocity_t;
|
} velocity_t;
|
||||||
|
|
||||||
|
enum plot_pressure {
|
||||||
|
SENSOR_PR = 0,
|
||||||
|
INTERPOLATED_PR = 1,
|
||||||
|
NUM_PLOT_PRESSURES = 2
|
||||||
|
};
|
||||||
|
|
||||||
struct membuffer;
|
struct membuffer;
|
||||||
struct divecomputer;
|
struct divecomputer;
|
||||||
struct plot_info;
|
struct plot_info;
|
||||||
struct plot_data {
|
struct plot_data {
|
||||||
unsigned int in_deco : 1;
|
unsigned int in_deco : 1;
|
||||||
int sec;
|
int sec;
|
||||||
/*
|
/* One pressure item per cylinder and pressure type */
|
||||||
* pressure[x][0] is sensor pressure for cylinder x
|
int pressure[MAX_CYLINDERS][NUM_PLOT_PRESSURES];
|
||||||
* pressure[x][1] is interpolated pressure
|
|
||||||
*/
|
|
||||||
int pressure[MAX_CYLINDERS][2];
|
|
||||||
int temperature;
|
int temperature;
|
||||||
/* Depth info */
|
/* Depth info */
|
||||||
int depth;
|
int depth;
|
||||||
|
@ -95,15 +98,12 @@ int get_maxtime(struct plot_info *pi);
|
||||||
* partial pressure graphs */
|
* partial pressure graphs */
|
||||||
int get_maxdepth(struct plot_info *pi);
|
int get_maxdepth(struct plot_info *pi);
|
||||||
|
|
||||||
#define SENSOR_PR 0
|
static inline int get_plot_pressure_data(const struct plot_data *entry, enum plot_pressure sensor, int idx)
|
||||||
#define INTERPOLATED_PR 1
|
|
||||||
|
|
||||||
static inline int get_plot_pressure_data(const struct plot_data *entry, int sensor, int idx)
|
|
||||||
{
|
{
|
||||||
return entry->pressure[idx][sensor];
|
return entry->pressure[idx][sensor];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_plot_pressure_data(struct plot_data *entry, int sensor, int idx, int value)
|
static inline void set_plot_pressure_data(struct plot_data *entry, enum plot_pressure sensor, int idx, int value)
|
||||||
{
|
{
|
||||||
entry->pressure[idx][sensor] = value;
|
entry->pressure[idx][sensor] = value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue