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 <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad elrobey 2015-03-09 22:33:14 +02:00 committed by Dirk Hohndel
parent 1e81dff946
commit d922dbbd99
2 changed files with 12 additions and 3 deletions

View file

@ -140,10 +140,12 @@ static void put_cylinder_HTML(struct membuffer *b, struct dive *dive)
} }
if (cylinder->gasmix.o2.permille) { 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 { } else {
write_attribute(b, "O2", "Air", ""); write_attribute(b, "O2", "Air", "");
} }
put_string(b, "}"); put_string(b, "}");
} }

View file

@ -855,7 +855,14 @@ function get_cylinder_HTML(cylinder)
cEPressure = Math.round(put_pressure_unit(nonZeroCEPressure)).toFixed(1) + " " + pressure_unit; cEPressure = Math.round(put_pressure_unit(nonZeroCEPressure)).toFixed(1) + " " + pressure_unit;
} }
return '<tr><td class="Cyl">' + cylinder.Type + '</td><td class="Cyl">' + cylinder.Size + '</td><td class="Cyl">' + cylinder.WPressure + '</td>' + '<td class="Cyl">' + cSPressure + '</td><td class="Cyl">' + cEPressure + '</td><td class="Cyl">' + cylinder.O2 + '</td></tr>'; 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 '<tr><td class="Cyl">' + cylinder.Type + '</td><td class="Cyl">' + cylinder.Size + '</td><td class="Cyl">' + cylinder.WPressure + '</td>' + '<td class="Cyl">' + cSPressure + '</td><td class="Cyl">' + cEPressure + '</td><td class="Cyl">' + pressure_string + '</td></tr>';
} }
/** /**
@ -880,7 +887,7 @@ function get_event_value(event)
if (event.type == 11 || event.type == 25) { // gas change if (event.type == 11 || event.type == 25) { // gas change
var he = event.value >> 16; var he = event.value >> 16;
var o2 = event.value & 0xffff; var o2 = event.value & 0xffff;
return 'He: ' + he + ' - O2: ' + o2; return 'O2: ' + o2 + ' / He: ' + he;
} }
if (event.type == 23) { // heading if (event.type == 23) { // heading
return event.value; return event.value;