X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=equipment.c;h=be544ab0830677a47e0be6b811aa1942f75c1372;hb=049b895d9beb33cba7d53985c4c382ab66d41cc3;hp=64a05d5b024d3500ffbc6ff666cd3726d3ce99aa;hpb=56980579514f2900e43441b483e435b3e3235266;p=ext%2Fsubsurface.git diff --git a/equipment.c b/equipment.c index 64a05d5..be544ab 100644 --- a/equipment.c +++ b/equipment.c @@ -71,12 +71,12 @@ static int convert_volume_pressure(int ml, int mbar, double *v, double *p) int decimals = 1; double volume, pressure; + volume = ml / 1000.0; if (mbar) { if (output_units.volume == CUFT) { volume = ml_to_cuft(ml); volume *= bar_to_atm(mbar / 1000.0); - } else - volume = ml / 1000.0; + } if (output_units.pressure == PSI) { pressure = mbar_to_PSI(mbar); @@ -283,18 +283,24 @@ static int cyl_nothing(cylinder_t *cyl) !cyl->type.description && !cyl->gasmix.o2.permille && !cyl->gasmix.he.permille && + !cyl->sample_start.mbar && + !cyl->sample_end.mbar && !cyl->start.mbar && !cyl->end.mbar; } static void set_one_cylinder(int index, cylinder_t *cyl, GtkListStore *model, GtkTreeIter *iter) { + unsigned int start, end; + + start = cyl->start.mbar ? : cyl->sample_start.mbar; + end = cyl->end.mbar ? : cyl->sample_end.mbar; gtk_list_store_set(model, iter, CYL_DESC, cyl->type.description ? : "", CYL_SIZE, cyl->type.size.mliter, CYL_WORKP, cyl->type.workingpressure.mbar, - CYL_STARTP, cyl->start.mbar, - CYL_ENDP, cyl->end.mbar, + CYL_STARTP, start, + CYL_ENDP, end, CYL_O2, cyl->gasmix.o2.permille, CYL_HE, cyl->gasmix.he.permille, -1); @@ -360,7 +366,7 @@ static void fill_cylinder_info(struct cylinder_widget *cylinder, cylinder_t *cyl } if (pressure && output_units.volume == CUFT) { - volume = cuft_to_ml(volume); + volume = cuft_to_l(volume); volume /= bar_to_atm(pressure); } @@ -464,7 +470,7 @@ static void fill_tank_list(GtkListStore *store) /* Is it in cuft and psi? */ if (psi) { double bar = psi_to_bar(psi); - double airvolume = cuft_to_ml(size); + double airvolume = cuft_to_l(size) * 1000.0; double atm = bar_to_atm(bar); ml = airvolume / atm + 0.5;