Add a macro for the default density and atmospheric pressure
Replace the hardcoded default values with a macro defined in a central location. This makes it much easier to adjust the values if necessary.
This commit is contained in:
parent
7fb943ae7f
commit
18f06ea585
@ -75,7 +75,7 @@ atomics_cobalt_parser_create (dc_parser_t **out, dc_context_t *context)
|
||||
}
|
||||
|
||||
// Set the default values.
|
||||
parser->hydrostatic = 1025.0 * GRAVITY;
|
||||
parser->hydrostatic = DEF_DENSITY_SALT * GRAVITY;
|
||||
|
||||
*out = (dc_parser_t*) parser;
|
||||
|
||||
|
||||
@ -25,6 +25,10 @@
|
||||
#include <libdivecomputer/context.h>
|
||||
#include <libdivecomputer/parser.h>
|
||||
|
||||
#define DEF_DENSITY_FRESH 1000.0
|
||||
#define DEF_DENSITY_SALT 1025.0
|
||||
#define DEF_ATMOSPHERIC ATM
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -80,8 +80,8 @@ reefnet_sensus_parser_create (dc_parser_t **out, dc_context_t *context, unsigned
|
||||
}
|
||||
|
||||
// Set the default values.
|
||||
parser->atmospheric = ATM;
|
||||
parser->hydrostatic = 1025.0 * GRAVITY;
|
||||
parser->atmospheric = DEF_ATMOSPHERIC;
|
||||
parser->hydrostatic = DEF_DENSITY_SALT * GRAVITY;
|
||||
parser->devtime = devtime;
|
||||
parser->systime = systime;
|
||||
parser->cached = 0;
|
||||
|
||||
@ -79,8 +79,8 @@ reefnet_sensuspro_parser_create (dc_parser_t **out, dc_context_t *context, unsig
|
||||
}
|
||||
|
||||
// Set the default values.
|
||||
parser->atmospheric = ATM;
|
||||
parser->hydrostatic = 1025.0 * GRAVITY;
|
||||
parser->atmospheric = DEF_ATMOSPHERIC;
|
||||
parser->hydrostatic = DEF_DENSITY_SALT * GRAVITY;
|
||||
parser->devtime = devtime;
|
||||
parser->systime = systime;
|
||||
parser->cached = 0;
|
||||
|
||||
@ -79,8 +79,8 @@ reefnet_sensusultra_parser_create (dc_parser_t **out, dc_context_t *context, uns
|
||||
}
|
||||
|
||||
// Set the default values.
|
||||
parser->atmospheric = ATM;
|
||||
parser->hydrostatic = 1025.0 * GRAVITY;
|
||||
parser->atmospheric = DEF_ATMOSPHERIC;
|
||||
parser->hydrostatic = DEF_DENSITY_SALT * GRAVITY;
|
||||
parser->devtime = devtime;
|
||||
parser->systime = systime;
|
||||
parser->cached = 0;
|
||||
|
||||
@ -245,8 +245,8 @@ shearwater_common_parser_create (dc_parser_t **out, dc_context_t *context, unsig
|
||||
}
|
||||
parser->divemode = M_OC_TEC;
|
||||
parser->units = METRIC;
|
||||
parser->density = 1025;
|
||||
parser->atmospheric = ATM / (BAR / 1000);
|
||||
parser->density = DEF_DENSITY_SALT;
|
||||
parser->atmospheric = DEF_ATMOSPHERIC / (BAR / 1000);
|
||||
|
||||
*out = (dc_parser_t *) parser;
|
||||
|
||||
@ -307,8 +307,8 @@ shearwater_predator_parser_set_data (dc_parser_t *abstract, const unsigned char
|
||||
}
|
||||
parser->divemode = M_OC_TEC;
|
||||
parser->units = METRIC;
|
||||
parser->density = 1025;
|
||||
parser->atmospheric = ATM / (BAR / 1000);
|
||||
parser->density = DEF_DENSITY_SALT;
|
||||
parser->atmospheric = DEF_ATMOSPHERIC / (BAR / 1000);
|
||||
|
||||
return DC_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user