@@ -37,28 +37,29 @@ void Layouts::drawTestLayout(int var) {
37
37
endFrame (); // automatically waits for cmd queue to clear out
38
38
}
39
39
40
- void Layouts::drawStandardLayout (Faults faults, const uint8_t speed, const uint8_t soc,
41
- uint8_t acc_temp, uint8_t ctrl_tmp,
42
- uint8_t mtr_tmp, float mtr_volt, float glv,
43
- float brake_balance, float throttle_demand,
44
- float brake_demand,
45
- std::chrono::milliseconds time,
46
- double delta_time_seconds) {
40
+ void Layouts::drawStandardLayout (
41
+ Faults faults, const uint8_t speed, const uint8_t soc, uint8_t acc_temp,
42
+ uint8_t ctrl_tmp, uint8_t mtr_tmp, float mtr_volt, float glv,
43
+ float steering_angle, float brake_balance, float brake_f, float brake_r,
44
+ float throttle_demand, float brake_demand, std::chrono::milliseconds time,
45
+ double delta_time_seconds) {
47
46
if (failure == startFrame ()) {
48
47
return ;
49
48
}
50
49
loadFonts ();
51
50
// printf("Drew!\n");
52
51
clear (255 , 255 , 255 ); // black background for frame
53
52
setMainColor (black);
54
- drawProgressBar (Point{220 , 10 }, 340 , 35 , speed, 110 , mid_gray, orange); // mph progress bar
53
+ drawProgressBar (Point{220 , 10 }, 340 , 35 , speed, 110 , mid_gray,
54
+ orange); // mph progress bar
55
55
for (int i = 0 ; i < 16 ; i++) { // to section off the progress bar
56
56
uint16_t base_x = 220 + (20 * (i + 1 ));
57
57
drawLine (Point{base_x, 0 }, Point{base_x, 50 }, white, 16 * 5 );
58
58
}
59
59
drawRect (Point{200 , 10 }, Point{220 , 45 }, white);
60
60
drawRect (Point{560 , 10 }, Point{580 , 45 }, white);
61
- drawProgressBar (Point{220 , 180 }, 340 , 30 , soc, 100 , mid_gray, Color{0 , 200 , 36 }); // soc progress bar
61
+ drawProgressBar (Point{220 , 180 }, 340 , 30 , soc, 100 , mid_gray,
62
+ Color{0 , 200 , 36 }); // soc progress bar
62
63
drawRect (Point{200 , 180 }, Point{220 , 210 }, white);
63
64
drawRect (Point{560 , 180 }, Point{580 , 210 }, white);
64
65
for (int i = 0 ; i < 16 ; i++) { // to section off the progress bar
@@ -86,18 +87,25 @@ void Layouts::drawStandardLayout(Faults faults, const uint8_t speed, const uint8
86
87
const auto time_ms = time - duration_cast<milliseconds>(time_s);
87
88
const auto time_min = duration_cast<minutes>(time_s);
88
89
time_s -= duration_cast<seconds>(time_min);
89
- drawFormattedText (100 , 100 , " %02d:%02d:%02d" , 24 , OPT_CENTER, time_min.count (), time_s.count (), time_ms.count ()); // lap time formatted in mm:ss::ms
90
+ drawFormattedText (100 , 100 , " %02d:%02d:%02d" , 24 , OPT_CENTER,
91
+ time_min.count (), time_s.count (),
92
+ time_ms.count ()); // lap time formatted in mm:ss::ms
90
93
const char sign_char = (delta_time_seconds > 0 ) ? ' +' : ' ' ;
91
94
const Color delta_color = (delta_time_seconds > 0 ) ? red : green;
92
- drawFormattedText (100 , 150 , " %c %00.2f s " , delta_color, 24 , OPT_CENTER, sign_char, delta_time_seconds); // delta time formatted in ± s.ms
93
- // TODO! fix large font on boot up
94
- drawFormattedText (400 , 110 , " %d MPH" , 1 , OPT_CENTER, speed); // speed display text
95
+ drawFormattedText (100 , 150 , " %c %00.2f s " , delta_color, 24 , OPT_CENTER,
96
+ sign_char,
97
+ delta_time_seconds); // delta time formatted in ± s.ms
98
+ // TODO! fix large font on boot up
99
+ drawFormattedText (400 , 110 , " %d MPH" , 1 , OPT_CENTER,
100
+ speed); // speed display text
95
101
drawFormattedText (400 , 160 , " SOC: %d" , 24 , OPT_CENTER, soc);
96
- drawFormattedText (100 , 260 , " BB: %02.1f %% " , 24 , OPT_CENTER, brake_balance * 100 .0f ); // brake balance display
102
+ drawFormattedText (100 , 260 , " BB: %02.1f %% " , 24 , OPT_CENTER,
103
+ brake_balance * 100 .0f ); // brake balance display
97
104
drawFormattedText (680 , 80 , " ACC: %03d C" , 24 , OPT_CENTER, acc_temp); // temps
98
105
drawFormattedText (680 , 115 , " CTRL: %03d C" , 24 , OPT_CENTER, ctrl_tmp);
99
106
drawFormattedText (680 , 150 , " MTR: %03d C" , 24 , OPT_CENTER, mtr_tmp);
100
- drawFormattedText (680 , 205 , " MC: %03.1f V " , 24 , OPT_CENTER, mtr_volt); // voltages
107
+ drawFormattedText (680 , 205 , " MC: %03.1f V " , 24 , OPT_CENTER,
108
+ mtr_volt); // voltages
101
109
drawFormattedText (680 , 235 , " GLV: %03.1f V " , 24 , OPT_CENTER, glv);
102
110
103
111
// drawProgressBar(Point{700, 300},
@@ -123,22 +131,19 @@ void Layouts::drawStandardLayout(Faults faults, const uint8_t speed, const uint8
123
131
endFrame ();
124
132
}
125
133
126
- void Layouts::drawStandardLayout2 (Faults faults, uint8_t speed, uint8_t soc,
127
- uint8_t acc_temp, uint8_t ctrl_tmp,
128
- uint8_t mtr_tmp, float mtr_volt, float glv,
129
- float brake_balance, float throttle_demand,
130
- float brake_demand,
131
- std::chrono::milliseconds time,
132
- double delta_time_seconds, bool rtds,
133
- uint16_t rpm) {
134
+ void Layouts::drawStandardLayout2 (
135
+ Faults faults, uint8_t speed, uint8_t soc, uint8_t acc_temp,
136
+ uint8_t ctrl_tmp, uint8_t mtr_tmp, float mtr_volt, float glv,
137
+ float steering_angle, float brake_balance, float brake_f, float brake_r,
138
+ float throttle_demand, float brake_demand, std::chrono::milliseconds time,
139
+ double delta_time_seconds, bool rtds, uint16_t rpm) {
134
140
if (failure == startFrame ()) {
135
141
return ;
136
142
}
137
143
clear (255 , 255 , 255 ); // black background for frame
138
144
loadFonts ();
139
145
setMainColor (black);
140
146
141
-
142
147
drawFormattedText (400 , 100 , " %03d" , 1 , OPT_CENTER, speed);
143
148
144
149
drawText (185 , 235 , " TACH" , 21 );
@@ -160,7 +165,7 @@ void Layouts::drawStandardLayout2(Faults faults, uint8_t speed, uint8_t soc,
160
165
// segmented soc
161
166
uint16_t segTopLeftY = 490 - j * 19 ;
162
167
uint16_t segBotRightY = segTopLeftY - 10 ;
163
- if (soc < j* 4 && !pastPoint) {
168
+ if (soc < j * 4 && !pastPoint) {
164
169
setMainColor (mid_gray);
165
170
pastPoint = true ;
166
171
}
@@ -197,6 +202,9 @@ void Layouts::drawStandardLayout2(Faults faults, uint8_t speed, uint8_t soc,
197
202
drawFormattedText (70 , 300 , " MC %03.1fV " , 24 , OPT_CENTER,
198
203
mtr_volt); // voltages
199
204
drawFormattedText (70 , 330 , " GLV %03.1fV " , 24 , OPT_CENTER, glv);
205
+ drawFormattedText (70 , 390 , " BRF %03.2f " , 24 , OPT_CENTER, brake_f);
206
+ drawFormattedText (70 , 420 , " BRR %03.2f " , 24 , OPT_CENTER, brake_r);
207
+ drawFormattedText (70 , 450 , " STEER %03.2f " , 24 , OPT_CENTER, steering_angle);
200
208
201
209
drawRect (Point{614 , 127 }, Point{637 , 310 }, mid_gray);
202
210
uint16_t throttle_bar_h = (310 - floor (183 * throttle_demand));
@@ -205,6 +213,7 @@ void Layouts::drawStandardLayout2(Faults faults, uint8_t speed, uint8_t soc,
205
213
drawRect (Point{643 , 127 }, Point{666 , 310 }, mid_gray);
206
214
uint16_t brake_bar_h = (310 - floor (183 * brake_demand));
207
215
drawRect (Point{643 , brake_bar_h}, Point{666 , 310 }, red);
208
- // drawRect(Point{643, static_cast<uint16_t>(brake_demand)}, Point{666, 310}, red);
216
+ // drawRect(Point{643, static_cast<uint16_t>(brake_demand)}, Point{666, 310},
217
+ // red);
209
218
endFrame ();
210
219
}
0 commit comments