TEDü Getac Changes

This commit is contained in:
Tim-Erik Düntzsch
2024-10-05 19:01:02 +02:00
parent 661e1a2274
commit d362fdd639
6 changed files with 110 additions and 16 deletions

View File

@ -25,13 +25,15 @@ int led_s[] = {led1, led2, led3, led4, led5, led6, led7, led8,
DataBox gear_box(121, 0, 199, 94, 160, 0, EA_SWISS30B, 4, 4, 'C', true);
DataBox left_box(0, 25, 119, 94, 110, 25, EA_FONT6X8, 3, 8, 'R', false);
DataBox right_box(201, 25, 320, 94, 310, 25, EA_FONT6X8, 3, 8, 'R', false);
DataBox autoshift_box(164+50, 184, 240+50, 230, 202+50, 178, EA_FONT7X12, 3, 5, 'C', false);
TireTempBox fl_box(80, 130, 156, 176, 118, 124, EA_FONT7X12, 3, 5, 'C');
TireTempBox fr_box(164, 130, 240, 176, 202, 124, EA_FONT7X12, 3, 5, 'C');
TireTempBox rl_box(80, 184, 156, 230, 118, 178, EA_FONT7X12, 3, 5, 'C');
TireTempBox rr_box(164, 184, 240, 230, 202, 178, EA_FONT7X12, 3, 5, 'C');
int testing_page = 0;
uint16_t clearcounter = 1;
void init_display() {
pinMode(writeprotect, OUTPUT);
digitalWrite(writeprotect, HIGH);
@ -55,6 +57,7 @@ void init_display() {
gear_box.update_label(get_label(VAL_GEAR));
left_box.update_label(get_label(VAL_FIRST_LEFT_BOX));
right_box.update_label(get_label(VAL_RPM));
autoshift_box.update_label("");
}
String get_value(Value val) {
@ -298,6 +301,35 @@ void update_display() {
update_view_testing();
}
}
if (clearcounter>= 10000){
pinMode(writeprotect, OUTPUT);
digitalWrite(writeprotect, HIGH);
pinMode(reset, OUTPUT);
pinMode(disp_cs, OUTPUT);
pinMode(MOSI, OUTPUT);
pinMode(MISO, OUTPUT);
digitalWrite(disp_cs, HIGH);
digitalWrite(MOSI, HIGH);
digitalWrite(MISO, HIGH);
digitalWrite(reset, LOW);
digitalWrite(reset, HIGH);
//tft.begin(115200); // start display communication
//tft.cursorOn(false);
//tft.terminalOn(false);
//tft.setDisplayColor(EA_WHITE, EA_BLACK);
//tft.setTextColor(EA_WHITE, EA_TRANSPARENT);
//tft.setTextSize(5, 8);
//tft.clear();
// gear_box.update_label(get_label(VAL_GEAR));
// left_box.update_label(get_label(VAL_FIRST_LEFT_BOX));
// right_box.update_label(get_label(VAL_RPM));
clearcounter = 0; //clearen des display nach definierter Zeit
cleared =true;
//
}
clearcounter+=1;
}
void alarm(String textstr) {
@ -348,6 +380,7 @@ void redraw_view_driver() {
gear_box.redraw();
left_box.redraw();
right_box.redraw();
autoshift_box.redraw();
fl_box.redraw();
fr_box.redraw();
rl_box.redraw();
@ -355,6 +388,7 @@ void redraw_view_driver() {
}
void update_view_driver() {
uint8_t prev_autoshift = Vehicle_data.autoshift;
static Value left_box_value = VAL_FIRST_LEFT_BOX;
if (Stw_data.button4_rises > 0) {
Stw_data.button4_rises--;
@ -381,16 +415,30 @@ void update_view_driver() {
tft.setTextColor(EA_WHITE, EA_BLACK);
left_box.update_value(pad_left(get_value(left_box_value), 5));
right_box.update_value(pad_left(get_value(VAL_RPM), 5));
// Vehicle_data.autoshift = true;
if(Vehicle_data.autoshift == true){
tft.drawRectf(164+100, 184, 240+100, 230, TT_COL3);
}
else{
tft.drawRectf(164+100, 184, 240+100, 230, EA_BLACK);
}
autoshift_box.update_value(pad_left(String(Vehicle_data.autoshift), 5));
// These don't change as rapidly, and would overwrite adjacent elements
// (lines/labels) if rendered with a background because of the empty pixels
// above/below the characters. So they're rendered using the clear-redraw
// method.0
tft.setTextColor(EA_WHITE, EA_TRANSPARENT);
gear_box.update_value(get_value(VAL_GEAR));
//gear_box.update_value(get_value(VAL_GEAR));
fl_box.update_value(get_value(VAL_TT_FL).toInt());
fr_box.update_value(get_value(VAL_TT_FR).toInt());
rl_box.update_value(get_value(VAL_TT_RL).toInt());
rr_box.update_value(get_value(VAL_TT_RR).toInt());
//Vehicle_data.autoshift = true; //For testing only!!
if(Vehicle_data.autoshift == true){
tft.setTextColor(EA_ORANGE, EA_TRANSPARENT);
}
gear_box.update_value(get_value(VAL_GEAR));
}
void redraw_view_testing() {