mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Profile: pass index instead of pointer to set_plot_pressure_data
Another plot-pressure-related function whose argument is converted to an index. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
fe6d3c8c38
commit
2fd4cb5fe1
3 changed files with 9 additions and 15 deletions
|
@ -442,7 +442,7 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s
|
||||||
// until we get back to this cylinder.
|
// until we get back to this cylinder.
|
||||||
if (cyl != sensor) {
|
if (cyl != sensor) {
|
||||||
current = NULL;
|
current = NULL;
|
||||||
set_plot_pressure_data(entry, SENSOR_PR, sensor, 0);
|
set_plot_pressure_data(pi, i, SENSOR_PR, sensor, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -599,9 +599,9 @@ static void populate_plot_entries(struct dive *dive, struct divecomputer *dc, st
|
||||||
entry->pressures.o2 = sample->setpoint.mbar / 1000.0;
|
entry->pressures.o2 = sample->setpoint.mbar / 1000.0;
|
||||||
}
|
}
|
||||||
if (sample->pressure[0].mbar)
|
if (sample->pressure[0].mbar)
|
||||||
set_plot_pressure_data(entry, SENSOR_PR, sample->sensor[0], sample->pressure[0].mbar);
|
set_plot_pressure_data(pi, idx, SENSOR_PR, sample->sensor[0], sample->pressure[0].mbar);
|
||||||
if (sample->pressure[1].mbar)
|
if (sample->pressure[1].mbar)
|
||||||
set_plot_pressure_data(entry, SENSOR_PR, sample->sensor[1], sample->pressure[1].mbar);
|
set_plot_pressure_data(pi, idx, SENSOR_PR, sample->sensor[1], sample->pressure[1].mbar);
|
||||||
if (sample->temperature.mkelvin)
|
if (sample->temperature.mkelvin)
|
||||||
entry->temperature = lasttemp = sample->temperature.mkelvin;
|
entry->temperature = lasttemp = sample->temperature.mkelvin;
|
||||||
else
|
else
|
||||||
|
@ -816,18 +816,12 @@ static void populate_secondary_sensor_data(const struct divecomputer *dc, struct
|
||||||
*/
|
*/
|
||||||
static void add_plot_pressure(struct plot_info *pi, int time, int cyl, pressure_t p)
|
static void add_plot_pressure(struct plot_info *pi, int time, int cyl, pressure_t p)
|
||||||
{
|
{
|
||||||
struct plot_data *entry;
|
|
||||||
if (pi->nr <= 0) {
|
|
||||||
fprintf(stderr, "add_plot_pressure(): called with pi->nr <= 0\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < pi->nr; i++) {
|
for (int i = 0; i < pi->nr; i++) {
|
||||||
entry = pi->entry + i;
|
if (i == pi->nr - 1 || pi->entry[i].sec >= time) {
|
||||||
|
set_plot_pressure_data(pi, i, SENSOR_PR, cyl, p.mbar);
|
||||||
if (entry->sec >= time)
|
return;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
set_plot_pressure_data(entry, SENSOR_PR, cyl, p.mbar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_gas_sensor_pressure(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi)
|
static void setup_gas_sensor_pressure(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi)
|
||||||
|
|
|
@ -107,9 +107,9 @@ static inline int get_plot_pressure_data(const struct plot_info *pi, int idx, en
|
||||||
return pi->entry[idx].pressure[cylinder][sensor];
|
return pi->entry[idx].pressure[cylinder][sensor];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_plot_pressure_data(struct plot_data *entry, enum plot_pressure sensor, int idx, int value)
|
static inline void set_plot_pressure_data(struct plot_info *pi, int idx, enum plot_pressure sensor, int cylinder, int value)
|
||||||
{
|
{
|
||||||
entry->pressure[idx][sensor] = value;
|
pi->entry[idx].pressure[cylinder][sensor] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int get_plot_sensor_pressure(const struct plot_info *pi, int idx, int cylinder)
|
static inline int get_plot_sensor_pressure(const struct plot_info *pi, int idx, int cylinder)
|
||||||
|
|
Loading…
Add table
Reference in a new issue