30
30
padding : .7em 1em ;
31
31
}
32
32
33
+ main # addition {
34
+ display : flex;
35
+ justify-content : center;
36
+ align-items : center;
37
+ }
38
+
33
39
main # dashboard {
34
40
display : -ms-grid;
35
41
display : grid;
38
44
}
39
45
40
46
main # dashboard .meter {
41
- display : -webkit-box;
42
- display : -ms-flexbox;
43
47
display : flex;
44
- -webkit-box-orient : vertical;
45
- -webkit-box-direction : normal;
46
- -ms-flex-direction : column;
47
48
flex-direction : column;
48
- -webkit-box-align : center;
49
- -ms-flex-align : center;
50
49
align-items : center;
51
50
}
51
+
52
+ main # dashboard .meter # rpm , # spd {
53
+ background-color : # 333 ;
54
+ width : 250px ;
55
+ color : whitesmoke;
56
+ position : fixed;
57
+ bottom : 0 ;
58
+
59
+ }
52
60
</ style >
53
61
</ head >
54
62
< body >
@@ -59,14 +67,20 @@ <h1>OBD Client</h1>
59
67
< p id ="error "> </ p >
60
68
< button onclick ="location.reload() "> Retry</ button >
61
69
</ section >
70
+ < section id ="addition ">
71
+ < div class ="meter ">
72
+ < h2 > MAF</ h2 >
73
+ < div id ="maf "> </ div >
74
+ </ div >
75
+ </ section >
62
76
< section id ="dashboard ">
63
77
< div class ="meter ">
64
78
< h2 > Speed</ h2 >
65
- < h3 id ="spd "> </ h3 >
79
+ < div id ="spd "> </ div >
66
80
</ div >
67
81
< div class ="meter ">
68
82
< h2 > RPM</ h2 >
69
- < h3 id ="rpm "> </ h3 >
83
+ < div id ="rpm "> </ div >
70
84
</ div >
71
85
</ section >
72
86
</ main >
@@ -78,6 +92,7 @@ <h3 id="rpm"></h3>
78
92
var error = document . querySelector ( '#error' ) ;
79
93
var spd = document . getElementById ( 'spd' ) ;
80
94
var rpm = document . getElementById ( 'rpm' ) ;
95
+ var maf = document . getElementById ( 'maf' ) ;
81
96
82
97
const errors = [ ] ;
83
98
@@ -86,9 +101,16 @@ <h3 id="rpm"></h3>
86
101
console . log ( msg ) ;
87
102
if ( msg [ 'speed' ] !== undefined ) {
88
103
spd . innerText = msg [ 'speed' ] ;
104
+
105
+ spd . style . height = `${ ( parseInt ( msg [ 'speed' ] ) ) * 10 } px`
89
106
}
90
107
if ( msg [ 'rpm' ] !== undefined ) {
91
108
rpm . innerText = msg [ 'rpm' ] ;
109
+
110
+ rpm . style . height = `${ ( parseInt ( msg [ 'rpm' ] ) ) / 3 } px`
111
+ }
112
+ if ( msg [ 'maf' ] !== undefined ) {
113
+ maf . innerText = msg [ 'maf' ] ;
92
114
}
93
115
errors = [ ] ;
94
116
} ) ;
0 commit comments