diff --git a/static/scripts/speedometer.js b/static/scripts/speedometer.js index 0be1698..e20a2c1 100644 --- a/static/scripts/speedometer.js +++ b/static/scripts/speedometer.js @@ -51,12 +51,13 @@ var mySpeedometer = new Chart(ctx1, options1); function addSpeedData(/*speedTCP,*/ speedSERIAL){ //var speedTCPpercent = (speedTCP/250)*100; - var serialSpeedKmh = (speedSERIAL * 0.0036) - var speedSERIALpercent = (serialSpeedKmh/250)*100; - console.log("speed percent", speedSERIALpercent) - console.log("actual speed", speedSERIAL) + var serialSpeedKmh = (speedSERIAL * 3.6) + var speedSERIALpercent = (serialSpeedKmh/250)*100 + console.log("speed ms", speedSERIAL) console.log("speed kmh", serialSpeedKmh) + console.log("speed percent", speedSERIALpercent) //mySpeedometer.data.datasets[0].data = [speedTCPpercent, 100-speedTCPpercent]; mySpeedometer.data.datasets[1].data = [speedSERIALpercent, 100-speedSERIALpercent]; + document.getElementById("speedSERIAL").innerHTML = "Speed Smartphone (km/h): " + serialSpeedKmh.toFixed(3) mySpeedometer.update(); } \ No newline at end of file diff --git a/static/scripts/websocket.js b/static/scripts/websocket.js index 0eea593..83fab8e 100644 --- a/static/scripts/websocket.js +++ b/static/scripts/websocket.js @@ -79,7 +79,7 @@ window.addEventListener("load", function(evt) { } } if(checkBoxUblox.checked && !checkBoxSmartphone.checked){ - if(!(dat.SOURCE_SERIAL.Orientation[0] === 0) && !(dat.SOURCE_SERIAL.Orientation[1] === 0) && !(dat.SOURCE_SERIAL.Orientation[2] === 0)){ + if(!(dat.SOURCE_SERIAL.Orientation[0] === 0) && /*!(dat.SOURCE_SERIAL.Orientation[1] === 0) &&*/ !(dat.SOURCE_SERIAL.Orientation[2] === 0)){ document.getElementById("gyroscopeSERIAL").style.transform = `rotateX(${dat.SOURCE_SERIAL.Orientation[0]}deg) rotateY(${dat.SOURCE_SERIAL.Orientation[1]}deg) rotateZ(${dat.SOURCE_SERIAL.Orientation[2]}deg)` } if(!(dat.SOURCE_SERIAL.Position[1] === 0) && !(dat.SOURCE_SERIAL.Position[0] === 0)){ @@ -162,6 +162,7 @@ window.addEventListener("load", function(evt) { .then(console.log); checkBoxSmartphone.disabled = false; checkBoxUblox.disabled = false; + ws.close(); } return false; }; diff --git a/templates/index.html b/templates/index.html index 4da1492..5945da9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -169,8 +169,8 @@
0
250