Skip to content

Commit 75a40db

Browse files
committed
updated dash layout for endurance
1 parent ee5ca71 commit 75a40db

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

Telemetry-Main/BT817Q/layouts.cpp

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,119 @@ void Layouts::drawStandardLayout2(
218218
// red);
219219
endFrame();
220220
}
221+
222+
#define MC_WARNING_VOLT 100
223+
//TODO!!! placeholder!! ENSURE THIS IS THE CORRECT VALUE!!!!
224+
225+
#define ACC_WARNING_TEMP 52
226+
//TODO!!! placeholder!! ENSURE THIS IS THE CORRECT VALUE!!!!
227+
228+
void Layouts::drawLayout3(Faults faults, float mtr_volt, uint8_t acc_temp,
229+
uint8_t ctrl_temp, uint8_t mtr_temp, uint8_t soc,
230+
float glv, bool rtds, int tick) {
231+
//--------init-------------
232+
clear(255, 255, 255); // white background for frame
233+
loadFonts();
234+
//-----------\init-------------
235+
236+
//--------------SOC bars---------------
237+
setMainColor(green);
238+
bool pastPoint = false;
239+
for (int j = 1; j <= 10; j++) {
240+
// segmented soc
241+
uint16_t segTopLeftY = 480 - j * 45;
242+
uint16_t segBotRightY = segTopLeftY + 20;
243+
if (soc < j * 10 && !pastPoint) {
244+
setMainColor(mid_gray);
245+
pastPoint = true;
246+
}
247+
drawRect(Point{700, segTopLeftY}, {795, segBotRightY});
248+
}
249+
//----------\SOC bars----------------------
250+
251+
//--------indicator lights------------------
252+
bool curr_green = true;
253+
if (faults.fans && curr_green) {
254+
setMainColor(red);
255+
}
256+
drawRect(Point{1, 1}, Point{73, 73}); //fans
257+
if (faults.precharge && curr_green) {
258+
setMainColor(red);
259+
curr_green = false;
260+
}
261+
else if (!faults.precharge && !curr_green) {
262+
setMainColor(green);
263+
curr_green = true;
264+
}
265+
drawRect(Point{75, 1}, Point{147, 73}); //pc
266+
if (faults.shutdown && curr_green) {
267+
setMainColor(red);
268+
curr_green = false;
269+
}
270+
else if (!faults.shutdown && !curr_green) {
271+
setMainColor(green);
272+
curr_green = true;
273+
}
274+
drawRect(Point{1, 75}, Point{73, 147}); //shdn
275+
if (!rtds && curr_green) {
276+
setMainColor(red);
277+
curr_green = false;
278+
}
279+
else if (rtds && !curr_green) {
280+
setMainColor(green);
281+
curr_green = true;
282+
}
283+
drawRect(Point{75, 75}, Point{147, 147}); //rtds
284+
//-----------\indicator lights--------------------
285+
286+
//---------MC warning box----------
287+
Color mc_volts_bg = Color {18, 219, 255};
288+
if (mtr_volt < MC_WARNING_VOLT) { //flash the box to alarm driver if MC volts below warning point
289+
if (tick % 2 == 0) {
290+
mc_volts_bg = red;
291+
}
292+
else {
293+
mc_volts_bg = Color {255, 255, 0};
294+
}
295+
}
296+
setMainColor(mc_volts_bg);
297+
drawRect(Point{200, 0}, {375, 125});
298+
//--------------\MC warning box-------
299+
300+
//---------ACC TEMP warning box----------
301+
Color acc_temp_bg = Color {18, 219, 255};
302+
if (acc_temp < ACC_WARNING_TEMP) { //flash the box to alarm driver if MC volts below warning point
303+
if (tick % 2 == 0) {
304+
acc_temp_bg = red;
305+
}
306+
else {
307+
acc_temp_bg = Color {255, 255, 0};
308+
}
309+
}
310+
setMainColor(acc_temp_bg);
311+
drawRect(Point{400, 0}, {625, 125});
312+
//--------------\ACC TEMP warning box-------
313+
314+
//--------------TEXT-----------------
315+
setMainColor(black);
316+
317+
//___status indicators_____
318+
drawText(36, 36, "FANS", 23);
319+
drawText(110, 36, "PCHG", 23);
320+
drawText(36, 110, "SHTD", 23);
321+
drawText(110, 110, "RTD", 23);
322+
323+
//___MC and ACC______
324+
drawFormattedText(275, 75,
325+
"MC\n%03.1f V ", 1, OPT_CENTER, mtr_volt);
326+
drawFormattedText(525, 75,
327+
"ACC\n%03d'C ", 1, OPT_CENTER, acc_temp);
328+
329+
//___GLV, CTRL and MTR______
330+
drawFormattedText(75, 175, "GLV\n%03d V ", 31, OPT_CENTER, glv);
331+
drawFormattedText(75, 175, "CTRL\n%03d'C ", 31, OPT_CENTER, ctrl_temp);
332+
drawFormattedText(75, 175, "MTR\n%03d'C ", 31, OPT_CENTER, mtr_temp);
333+
334+
//____SOC number
335+
drawFormattedText(550, 175, "SOC\n%03d ", 2, OPT_CENTER, soc);
336+
}

Telemetry-Main/BT817Q/layouts.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ class Layouts : public BT817Q {
126126
params.rpm);
127127
}
128128

129+
void drawLayout3(Faults faults,
130+
float mtr_volt,
131+
uint8_t acc_temp,
132+
uint8_t ctrl_temp,
133+
uint8_t mtr_temp,
134+
uint8_t soc,
135+
float glv,
136+
bool rtds,
137+
int tick //pass in tick to allow flashing/blinking
138+
);
139+
129140
void drawTestLayout(int var);
130141
};
131142

0 commit comments

Comments
 (0)