Example #1
0
void DivePlotDataModel::calculateDecompression()
{
	struct divecomputer *dc = select_dc(&displayed_dive);
	init_decompression(&displayed_dive);
	calculate_deco_information(&displayed_dive, dc, &pInfo, false);
	dataChanged(index(0, CEILING), index(pInfo.nr - 1, TISSUE_16));
}
Example #2
0
/*
 * Create a plot-info with smoothing and ranged min/max
 *
 * This also makes sure that we have extra empty events on both
 * sides, so that you can do end-points without having to worry
 * about it.
 */
void create_plot_info_new(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, bool fast)
{
	int o2, he, o2max;
#ifndef SUBSURFACE_MOBILE
	init_decompression(dive);
#endif
	/* Create the new plot data */
	free((void *)last_pi_entry_new);

	get_dive_gas(dive, &o2, &he, &o2max);
	if (dc->divemode == FREEDIVE){
		pi->dive_type = FREEDIVE;
	} else 	if (he > 0) {
		pi->dive_type = TRIMIX;
	} else {
		if (o2)
			pi->dive_type = NITROX;
		else
			pi->dive_type = AIR;
	}

	last_pi_entry_new = populate_plot_entries(dive, dc, pi);

	check_gas_change_events(dive, dc, pi);   /* Populate the gas index from the gas change events */
	check_setpoint_events(dive, dc, pi);     /* Populate setpoints */
	setup_gas_sensor_pressure(dive, dc, pi); /* Try to populate our gas pressure knowledge */
	if (!fast) {
		populate_pressure_information(dive, dc, pi, false);	/* .. calculate missing pressure entries for all gasses except o2 */
		if (dc->divemode == CCR)					/* For CCR dives.. */
			populate_pressure_information(dive, dc, pi, true); /* .. calculate missing o2 gas pressure entries */
	}
	fill_o2_values(dc, pi, dive);			 /* .. and insert the O2 sensor data having 0 values. */
	calculate_sac(dive, pi);			 /* Calculate sac */
#ifndef SUBSURFACE_MOBILE
	calculate_deco_information(dive, dc, pi, false); /* and ceiling information, using gradient factor values in Preferences) */
#endif
	calculate_gas_information_new(dive, pi);	 /* Calculate gas partial pressures */

#ifdef DEBUG_GAS
	debug_print_profiledata(pi);
#endif

	pi->meandepth = dive->dc.meandepth.mm;
	analyze_plot_info(pi);
}