From d922dbbd99d1da3b86bff5371dd10d32aec2ac61 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Mon, 9 Mar 2015 22:33:14 +0200 Subject: [PATCH] HTML: fix the value of cylinder gas in trimix dives Value of He must be showed in trimix dives, also fixes the format of the dive events table. Gas change should be something like O2: 50 - He 0 Signed-off-by: Gehad elrobey Signed-off-by: Dirk Hohndel --- save-html.c | 4 +++- theme/list_lib.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/save-html.c b/save-html.c index 13d2fd559..f9f1cf0d1 100644 --- a/save-html.c +++ b/save-html.c @@ -140,10 +140,12 @@ static void put_cylinder_HTML(struct membuffer *b, struct dive *dive) } if (cylinder->gasmix.o2.permille) { - put_format(b, "\"O2\":\"%u.%u%%\"", FRACTION(cylinder->gasmix.o2.permille, 10)); + put_format(b, "\"O2\":\"%u.%u%%\",", FRACTION(cylinder->gasmix.o2.permille, 10)); + put_format(b, "\"He\":\"%u.%u%%\"", FRACTION(cylinder->gasmix.he.permille, 10)); } else { write_attribute(b, "O2", "Air", ""); } + put_string(b, "}"); } diff --git a/theme/list_lib.js b/theme/list_lib.js index 72880dcd1..ceaa9c9bc 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -855,7 +855,14 @@ function get_cylinder_HTML(cylinder) cEPressure = Math.round(put_pressure_unit(nonZeroCEPressure)).toFixed(1) + " " + pressure_unit; } - return '' + cylinder.Type + '' + cylinder.Size + '' + cylinder.WPressure + '' + '' + cSPressure + '' + cEPressure + '' + cylinder.O2 + ''; + var pressure_string = cylinder.O2; + if (cylinder.O2 !== "Air") { + pressure_string = 'O2: ' + cylinder.O2; + } + if (cylinder.He && cylinder.He !== "0.0%") { + pressure_string += ' / He: ' + cylinder.He; + } + return '' + cylinder.Type + '' + cylinder.Size + '' + cylinder.WPressure + '' + '' + cSPressure + '' + cEPressure + '' + pressure_string + ''; } /** @@ -880,7 +887,7 @@ function get_event_value(event) if (event.type == 11 || event.type == 25) { // gas change var he = event.value >> 16; var o2 = event.value & 0xffff; - return 'He: ' + he + ' - O2: ' + o2; + return 'O2: ' + o2 + ' / He: ' + he; } if (event.type == 23) { // heading return event.value;