diff --git a/static/scripts/compass.js b/static/scripts/compass.js new file mode 100644 index 0000000..eaf7d00 --- /dev/null +++ b/static/scripts/compass.js @@ -0,0 +1,80 @@ +var options2 = { + type: 'doughnut', + data: { + datasets: [ + { + label: 'compassTCP', + data: [50,50,50,50], + backgroundColor: [ + 'rgba(191, 191, 191, 1)', + 'rgba(191, 191, 191, 1)', + 'rgba(30, 139, 195, 1)', + 'rgba(30, 139, 195, 1)' + ], + borderColor: [ + 'rgba(255, 255, 255 ,1)', + 'rgba(255, 255, 255 ,1)', + 'rgba(255, 255, 255 ,1)', + 'rgba(255, 255, 255 ,1)' + ], + borderWidth: 4 + }, + { + label: 'compassSERIAL', + data: [50,50,50,50], + backgroundColor: [ + 'rgba(191, 191, 191, 1)', + 'rgba(191, 191, 191, 1)', + 'rgba(214, 69, 65, 1)', + 'rgba(214, 69, 65, 1)' + ], + borderColor: [ + 'rgba(255, 255, 255 ,1)', + 'rgba(255, 255, 255 ,1)', + 'rgba(255, 255, 255 ,1)', + 'rgba(255, 255, 255 ,1)' + ], + borderWidth: 4 + } + ] + }, + options: { + rotation: 2 * Math.PI, + circumference: 2 * Math.PI, + legend: { + display: false, + enabled: false + }, + tooltips: { + enabled: false, + display: false + }, + cutoutPercentage: 50 + } +} + +var ctx2 = document.getElementById('compass').getContext('2d'); +var myCompass = new Chart(ctx2, options2); + +/* +function addSpeedSerial(speedSERIAL){ + var speedSERIALkmh = (speedSERIAL * 3.6) + var speedSERIALpercent = (speedSERIALkmh/250)*100 + console.log("SERIAL speed ms", speedSERIAL) + console.log("SERIAL speed kmh", speedSERIALkmh) + console.log("SERIAL speed percent", speedSERIALpercent) + mySpeedometer.data.datasets[1].data = [speedSERIALpercent, 100-speedSERIALpercent]; + document.getElementById("speedSERIAL").innerHTML = "Speed Ublox (km/h): " + speedSERIALkmh.toFixed(1) + mySpeedometer.update(); +} + +function addSpeedTcp(speedTCP){ + var speedTCPkmh = (speedTCP * 3.6) + var speedTCPpercent = (speedTCPkmh/250)*100; + console.log("TCP speed ms", speedSERIAL) + console.log("TCP speed kmh", serialSpeedKmh) + console.log("TCP speed percent", speedSERIALpercent) + mySpeedometer.data.datasets[0].data = [speedTCPpercent, 100-speedTCPpercent]; + document.getElementById("speedTCP").innerHTML = "Speed Smartphone (km/h): " + speedTCPkmh.toFixed(1) + mySpeedometer.update(); +}*/ diff --git a/templates/index.html b/templates/index.html index 4acb5ea..68d750b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -72,6 +72,39 @@ margin-bottom: -50px; } + .compassNorth { + position: absolute; + left: 50%; + transform: translate(-50%, 0); + font-size: 30px; + bottom: 70%; + margin-bottom: 50px; + } + .compassSouth { + position: absolute; + Left: 50%; + transform: translate(-50%, 0); + font-size: 30px; + bottom: -70%; + margin-bottom: 50px; + } + .compassWest { + position: absolute; + left: 0%; + transform: translate(-50%, 0); + font-size: 30px; + bottom: 50%; + margin-bottom: -50px; + } + .compassEast { + position: absolute; + Left: 100%; + transform: translate(-50%, 0); + font-size: 30px; + bottom: 50%; + margin-bottom: -50px; + } + .scene { width: 200px; @@ -173,13 +206,23 @@

0

250

+
+
+
+
+ +

N

+

E

+

W

+

S

- + +