From fcc6a84082df9022a0f17149a00b304250d22186 Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Tue, 30 Jul 2019 15:09:24 +0200 Subject: [PATCH] * Fixed formatting of negative time values. * Tweaked speed limit warning thresholds. * Moved styling of special delivery time values to style sheet. --- dash.html | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/dash.html b/dash.html index fc79cbc..bfd04b8 100644 --- a/dash.html +++ b/dash.html @@ -60,6 +60,7 @@ table, caption, tbody, tfoot, thead, tr, th, td { .warn2 { color:#f20; } .setval { color:#0af; } .hilite { background-color: #ff0; } +.special { font-size:50%; color:#088; } x-bar { display: block; @@ -157,18 +158,27 @@ function pad2( x ) { } function s2hms(s) { - return pad2( Math.floor(s / 3600) ) + ':' + var sgn = Math.sign(s); + s = Math.abs(s); + return ( sgn < 0 ? '-' : '' ) + + pad2( Math.floor(s / 3600) ) + ':' + pad2( Math.floor(s % 3600 / 60) ) + ':' + pad2( Math.floor(s % 60 ) ); } function s2hm(s) { - return pad2( Math.floor(s / 3600) ) + ':' + var sgn = Math.sign(s); + s = Math.abs(s); + return ( sgn < 0 ? '-' : '' ) + + pad2( Math.floor(s / 3600) ) + ':' + pad2( Math.floor(s % 3600 / 60) ); } function m2hm(s) { - return pad2( Math.floor(s / 60) ) + ':' + var sgn = Math.sign(s); + s = Math.abs(s); + return ( sgn < 0 ? '-' : '' ) + + pad2( Math.floor(s / 60) ) + ':' + pad2( Math.floor(s % 60) ); } @@ -209,10 +219,11 @@ function update_cb() { //// "speedo" box // speedometer: - speed.innerHTML = Math.abs(tele.speed * 3.6).toFixed(0); - if ( tele.nav_slimit > 0 && tele.speed > tele.nav_slimit * 1.075 ) + var aspeed = Math.abs( tele.speed ); + speed.innerHTML = (aspeed * 3.6).toFixed(0); + if ( tele.nav_slimit > 0 && aspeed > tele.nav_slimit + 1.9 ) warn( speed, 2 ); - else if ( tele.nav_slimit > 0 && tele.speed > tele.nav_slimit * 1.005 ) + else if ( tele.nav_slimit > 0 && aspeed > tele.nav_slimit + 0.3 ) warn( speed, 1 ); else warn( speed, 0 ); @@ -278,8 +289,8 @@ function update_cb() { tele.job_isvalid ? tele.job_deltime != 4294967295 ? m2hm(tele.job_deltime - tele.game_time) - : '[external]' - : '[none]'; + : '[external]' + : '[none]' //// pause and error bar status: -- 2.30.2