From: Urban Wallasch Date: Sun, 4 Aug 2019 13:33:39 +0000 (+0200) Subject: * Made another attempt to improve the current fuel consumption calculation. X-Git-Tag: v0.1.0~38 X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=3cc2aa12c771e4bb6294d9e81951bd895870b152;p=ets2_tele.git * Made another attempt to improve the current fuel consumption calculation. --- diff --git a/dash.html b/dash.html index bd89a62..c8aacd3 100644 --- a/dash.html +++ b/dash.html @@ -294,15 +294,20 @@ function update_cb() { // current fuel consumption: if ( last_fuel != tele.fuel && last_odometer != tele.odometer ) { - var fcons; if ( last_fuel > 0 && last_odometer > 0 ) - fcons = (last_fuel - tele.fuel) * 100 / (tele.odometer - last_odometer); - else - fcons = -1; - fuel_cons.innerHTML = fcons < 0 ? '-' : fcons.toFixed(1); + fuel_cons.innerHTML = ((last_fuel-tele.fuel)*100 / (tele.odometer-last_odometer)).toFixed(1); last_fuel = tele.fuel; last_odometer = tele.odometer; } + else if ( tele.speed > 1 && tele.throttle_eff < 0.01 && tele.clutch_eff < 0.1 ) { + fuel_cons.innerHTML = '0'; + } + else if ( tele.speed < 0.1 ) { + fuel_cons.innerHTML = tele.rpm < 0.1 ? '-' : '∞'; + } + else { + // keep last displayed value + } // average fuel consumption: fuel_avg.innerHTML = (tele.fuel_avg * 100).toFixed(1);