diff options
-rw-r--r-- | libdivecomputer.c | 2 | ||||
-rw-r--r-- | parse-xml.c | 16 | ||||
-rw-r--r-- | qt-ui/diveplanner.cpp | 2 | ||||
-rw-r--r-- | uemis.c | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index bc2aea6d0..3f118cf04 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -203,7 +203,7 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata) sample->cylinderpressure.mbar = value.pressure.value * 1000 + 0.5; break; case DC_SAMPLE_TEMPERATURE: - sample->temperature.mkelvin = value.temperature * 1000 + ZERO_C_IN_MKELVIN + 0.5; + sample->temperature.mkelvin = C_to_mkelvin(value.temperature); break; case DC_SAMPLE_EVENT: handle_event(dc, sample, value); diff --git a/parse-xml.c b/parse-xml.c index 97c93fc6d..76a737f8f 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -424,7 +424,7 @@ static void pressure(char *buffer, void *_press) mbar = mbar * 1000; break; case PSI: - mbar = val.fp * 68.95; + mbar = psi_to_mbar(val.fp); break; } if (mbar > 5 && mbar < 500000) { @@ -462,7 +462,7 @@ static void depth(char *buffer, void *_depth) depth->mm = val.fp * 1000 + 0.5; break; case FEET: - depth->mm = val.fp * 304.8 + 0.5; + depth->mm = feet_to_mm(val.fp); break; } break; @@ -483,7 +483,7 @@ static void weight(char *buffer, void *_weight) weight->grams = val.fp * 1000 + 0.5; break; case LBS: - weight->grams = val.fp * 453.6 + 0.5; + weight->grams = lbs_to_grams(val.fp); break; } break; @@ -504,10 +504,10 @@ static void temperature(char *buffer, void *_temperature) temperature->mkelvin = val.fp * 1000; break; case CELSIUS: - temperature->mkelvin = val.fp * 1000 + ZERO_C_IN_MKELVIN + 0.5; + temperature->mkelvin = C_to_mkelvin(val.fp); break; case FAHRENHEIT: - temperature->mkelvin = (val.fp + 459.67) * 5000/9; + temperature->mkelvin = F_to_mkelvin(val.fp); break; } break; @@ -1862,9 +1862,9 @@ extern int dm4_dive(void *param, int columns, char **data, char **column) if (data[6]) cur_dive->dc.maxdepth.mm = atof(data[6]) * 1000; if (data[8]) - cur_dive->dc.airtemp.mkelvin = (atoi(data[8]) + 273.15) * 1000; + cur_dive->dc.airtemp.mkelvin = C_to_mkelvin(atoi(data[8])); if (data[9]) - cur_dive->dc.watertemp.mkelvin = (atoi(data[9]) + 273.15) * 1000; + cur_dive->dc.watertemp.mkelvin = C_to_mkelvin(atoi(data[9])); /* * TODO: handle multiple cylinders @@ -1904,7 +1904,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column) cur_sample->depth.mm = cur_dive->dc.maxdepth.mm; if (tempBlob) - cur_sample->temperature.mkelvin = (tempBlob[i] + 273.15) * 1000; + cur_sample->temperature.mkelvin = C_to_mkelvin(tempBlob[i]); if (data[19] && data[19][0]) cur_sample->cylinderpressure.mbar = pressureBlob[i] ; sample_end(); diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index e9a19ffea..5efac70a9 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -30,7 +30,7 @@ #define MAX_DEPTH M_OR_FT(150, 450) #define MIN_DEPTH M_OR_FT(20, 60) -#define M_OR_FT(_m,_f) ((prefs.units.length == units::METERS) ? ((_m) * 1000) : ((_f) * 304.8)) +#define M_OR_FT(_m,_f) ((prefs.units.length == units::METERS) ? ((_m) * 1000) : (feet_to_mm(_f))) QString gasToStr(const int o2Permille, const int hePermille) { uint o2 = (o2Permille + 5) / 10, he = (hePermille + 5) / 10; @@ -293,7 +293,7 @@ void uemis_parse_divelog_binary(char *base64, void *datap) { datalen = uemis_convert_base64(base64, &data); - dive->dc.airtemp.mkelvin = *(uint16_t *)(data + 45) * 100 + ZERO_C_IN_MKELVIN; + dive->dc.airtemp.mkelvin = C_to_mkelvin(*(uint16_t *)(data + 45)); dive->dc.surface_pressure.mbar = *(uint16_t *)(data + 43); if (*(uint8_t *)(data + 19)) dive->dc.salinity = SEAWATER_SALINITY; /* avg grams per 10l sea water */ @@ -351,7 +351,7 @@ void uemis_parse_divelog_binary(char *base64, void *datap) { sample = prepare_sample(dc); sample->time.seconds = u_sample->dive_time; sample->depth.mm = rel_mbar_to_depth(u_sample->water_pressure, dive); - sample->temperature.mkelvin = (u_sample->dive_temperature * 100) + ZERO_C_IN_MKELVIN; + sample->temperature.mkelvin = C_to_mkelvin(u_sample->dive_temperature); sample->sensor = active; sample->cylinderpressure.mbar = (u_sample->tank_pressure_high * 256 + u_sample->tank_pressure_low) * 10; |