click UI
This commit is contained in:
parent
020d30165c
commit
d770b4f578
@ -226,6 +226,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"ShowCustomBrightness", PERSISTENT},
|
||||
{"ShowLaneInfo", PERSISTENT},
|
||||
{"ShowRadarInfo", PERSISTENT},
|
||||
{"ShowDeviceState", PERSISTENT},
|
||||
{"ShowRouteInfo", PERSISTENT },
|
||||
{"ShowPathMode", PERSISTENT},
|
||||
{"ShowPathColor", PERSISTENT},
|
||||
|
@ -1035,8 +1035,6 @@ protected:
|
||||
|
||||
//if (active_carrot <= 1) return;
|
||||
//printf("nGoPosDist=%d, nGoPosTime=%d\n", nGoPosDist, nGoPosTime);
|
||||
if (nGoPosDist > 0 && nGoPosTime > 0);
|
||||
else return;
|
||||
|
||||
//if (xDistToTurn <= 0 || nGoPosDist <= 0) return;
|
||||
char str[128] = "";
|
||||
@ -1047,6 +1045,9 @@ protected:
|
||||
if (s->scene._current_carrot_display == 3) {
|
||||
ui_fill_rect(s->vg, { tbt_x, 5, 790, s->fb_h - 15 }, COLOR_BLACK_ALPHA(120), 30, 2, &stroke_color);
|
||||
}
|
||||
if (nGoPosDist > 0 && nGoPosTime > 0);
|
||||
else return;
|
||||
if (s->scene._current_carrot_display == 3);
|
||||
else {
|
||||
ui_fill_rect(s->vg, { tbt_x, tbt_y - 60, 790, 240 + 60 }, COLOR_BLACK_ALPHA(120), 30, 2, &stroke_color);
|
||||
}
|
||||
@ -2124,6 +2125,7 @@ public:
|
||||
int memoryUsage = 0;
|
||||
float freeSpace = 0.0f;
|
||||
void drawHud(UIState* s) {
|
||||
int show_device_state = params.getInt("ShowDeviceState");
|
||||
blink_timer = (blink_timer + 1) % 16;
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BOTTOM);
|
||||
|
||||
@ -2140,7 +2142,12 @@ public:
|
||||
if (xSpdLimit > 0 && xSignType != 22 && xSignType != 4) cam_detected = true;
|
||||
NVGcolor stroke_color = COLOR_WHITE;
|
||||
NVGcolor bg_color = (cam_detected && blink_timer > 8)?COLOR_RED_ALPHA(180):COLOR_BLACK_ALPHA(90);
|
||||
if (show_device_state > 0) {
|
||||
ui_fill_rect(s->vg, { bx - 120, by - 270, 475, 495 }, bg_color, 30, 2, &stroke_color);
|
||||
}
|
||||
else {
|
||||
ui_fill_rect(s->vg, { bx - 120, by - 270 + 140, 475, 495 - 140 }, bg_color, 30, 2, &stroke_color);
|
||||
}
|
||||
|
||||
|
||||
// draw traffic light
|
||||
@ -2214,7 +2221,7 @@ public:
|
||||
int dx = bx - 50;
|
||||
int dy = by + 175;
|
||||
ui_fill_rect(s->vg, { dx - 55, dy - 38, 110, 48 }, mode_color, 15, 2);
|
||||
ui_draw_text(s, dx, dy, driving_mode_str, 40, text_color, BOLD);
|
||||
ui_draw_text(s, dx, dy, driving_mode_str, 35, text_color, BOLD);
|
||||
if (strcmp(driving_mode_str, driving_mode_str_last)) ui_draw_text_a(s, dx, dy, driving_mode_str, 30, COLOR_WHITE, BOLD);
|
||||
strcpy(driving_mode_str_last, driving_mode_str);
|
||||
|
||||
@ -2317,7 +2324,7 @@ public:
|
||||
ui_draw_text(s, dx, dy, QString::number(disp_speed).toStdString().c_str(), 40, COLOR_WHITE, BOLD);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
if (show_device_state) {
|
||||
char str[128];
|
||||
dx = bx - 35;
|
||||
dy = by - 200;
|
||||
|
@ -697,7 +697,7 @@ CarrotPanel::CarrotPanel(QWidget* parent) : QWidget(parent) {
|
||||
//dispToggles->addItem(new CValueControl("ShowAccelRpm", "DISP:Accel meter", "0:None,1:Display,1:Accel+RPM", "../assets/offroad/icon_shell.png", 0, 2, 1));
|
||||
//dispToggles->addItem(new CValueControl("ShowTpms", "DISP:TPMS", "0:None,1:Display", "../assets/offroad/icon_shell.png", 0, 1, 1));
|
||||
//dispToggles->addItem(new CValueControl("ShowSteerMode", "DISP:Handle Display Mode", "0:Black,1:Color,2:None", "../assets/offroad/icon_shell.png", 0, 2, 1));
|
||||
//dispToggles->addItem(new CValueControl("ShowDeviceState", "DISP:Device State", "0:None,1:Display", "../assets/offroad/icon_shell.png", 0, 1, 1));
|
||||
dispToggles->addItem(new CValueControl("ShowDeviceState", "DISP:Device State", "0:None,1:Display", "../assets/offroad/icon_shell.png", 0, 1, 1));
|
||||
//dispToggles->addItem(new CValueControl("ShowConnInfo", "DISP:APM connection", "0:NOne,1:Display", "../assets/offroad/icon_shell.png", 0, 1, 1));
|
||||
dispToggles->addItem(new CValueControl("ShowLaneInfo", "DISP:Lane Info", "-1:None, 0:Path, 1:Path+Lane, 2: Path+Lane+RoadEdge", "../assets/offroad/icon_shell.png", -1, 2, 1));
|
||||
//dispToggles->addItem(new CValueControl("ShowBlindSpot", "DISP:BSD Info", "0:None,1:Display", "../assets/offroad/icon_shell.png", 0, 1, 1));
|
||||
|
@ -217,14 +217,43 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
|
||||
// propagation event to parent(HomeWindow)
|
||||
int x = e->x(); // 430 - 500 : gap window
|
||||
int y = height() - e->y(); // 60 - 180 : gap window
|
||||
if (x > 350 && x < 550 && y > 20 && y < 250) {
|
||||
int ey = e->y();
|
||||
printf("x=%d, y=%d, ey=%d\n", x, y, ey);
|
||||
double now = millis_since_boot();
|
||||
static double last_click_time = 0;
|
||||
static int _click_count = 0;
|
||||
// 40,150, 200, 150
|
||||
Params params;
|
||||
if (x > 40 && x < 370 && ey > 30 && ey < 240) { // date & time
|
||||
int show_date_time = params.getInt("ShowDateTime");
|
||||
params.putIntNonBlocking("ShowDateTime", (show_date_time + 1) % 3);
|
||||
}
|
||||
else if (x > 40 && x < 500 && y > 400 && y < 530) { // device info
|
||||
int show_device_state = params.getInt("ShowDeviceState");
|
||||
params.putIntNonBlocking("ShowDeviceState", (show_device_state + 1) % 2);
|
||||
}
|
||||
else if (x > 40 && x < 200 && y > 20 && y < 150) { // driving mode
|
||||
int my_driving_mode = params.getInt("MyDrivingMode");
|
||||
params.putIntNonBlocking("MyDrivingMode", (my_driving_mode) % 4 + 1);
|
||||
}
|
||||
else if (x > 350 && x < 550 && y > 20 && y < 250) { // gap control
|
||||
int longitudinalPersonalityMax = params.getInt("LongitudinalPersonalityMax");
|
||||
int personality = (params.getInt("LongitudinalPersonality") - 1 + longitudinalPersonalityMax) % longitudinalPersonalityMax;
|
||||
params.putIntNonBlocking("LongitudinalPersonality", personality);
|
||||
|
||||
}
|
||||
else {
|
||||
if (now - last_click_time < 500) {
|
||||
_click_count++;
|
||||
}
|
||||
else {
|
||||
_click_count = 0;
|
||||
}
|
||||
last_click_time = now;
|
||||
if (_click_count == 3) {
|
||||
params.putIntNonBlocking("SoftRestartTriggered", 1);
|
||||
}
|
||||
|
||||
UIState* s = uiState();
|
||||
s->scene._current_carrot_display = (s->scene._current_carrot_display % 3) + 1; // 4¹ø: full mapÀº ¾Èº¸¿©ÁÜ.
|
||||
printf("_current_carrot_display1=%d\n", s->scene._current_carrot_display);
|
||||
|
@ -44,6 +44,7 @@ def get_default_params():
|
||||
("ShowCustomBrightness", "100"),
|
||||
("ShowLaneInfo", "1"),
|
||||
("ShowRadarInfo", "1"),
|
||||
("ShowDeviceState", "1"),
|
||||
("ShowRouteInfo", "1"),
|
||||
("ShowPathMode", "9"),
|
||||
("ShowPathColor", "13"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user