This commit is contained in:
Your Name
2024-05-04 15:16:36 -05:00
parent 106e8d9064
commit b017bec24b
4 changed files with 30 additions and 31 deletions

View File

@@ -38,11 +38,15 @@ class CanBus(CanBusBase):
def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer):
# Im sure there is a better way to do this
params_memory = Params("/dev/shm/params")
no_lat_lane_change = params_memory.get_int("no_lat_lane_change", 1)
ret = []
values = {
"LKA_MODE": 2,
"LKA_ICON": 2 if enabled else 1 if lat_active else 0, # right mode icon
"LKA_ICON": 0 if no_lat_lane_change else 2 if enabled else 1 if lat_active else 0, # right mode icon
"TORQUE_REQUEST": apply_steer,
"LKA_ASSIST": 0,
"STEER_REQ": 1 if lat_active else 0,
@@ -127,18 +131,9 @@ def create_acc_cancel(packer, CP, CAN, cruise_info_copy):
# CLEARPILOT changed HDA icons
# This doesn't appear to do anything on my tucson
def create_lfahda_cluster(packer, CAN, enabled, lat_active):
# Im sure there is a better way to do this
params = Params()
params_memory = Params("/dev/shm/params")
no_lat_lane_change = params_memory.get_int("no_lat_lane_change", 1)
values = {
# 0 off, 1 gray, 2 green, 3 blinking (wheel icon)
# CP: Is this actually the wheel? Might this be the HDA2 thing?
"HDA_ICON": 0, # Intention is to have this represent stock HDA mode
"LFA_ICON": 0,
# "LFA_ICON": 0 if no_lat_lane_change else 2 if enabled else 1 if lat_active else 0,
"HDA_ICON": 0,
"LFA_ICON": 0
}
return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values)

View File

@@ -46,7 +46,6 @@ static void drawIconGif(QPainter &p, const QPoint &center, const QMovie &img, co
}
OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent), scene(uiState()->scene) {
bg = QColor(255, 0x33, 0x49, 0xc8); // init to a default color
QVBoxLayout *main_layout = new QVBoxLayout(this);
main_layout->setMargin(UI_BORDER_SIZE);
QStackedLayout *stacked_layout = new QStackedLayout;
@@ -97,11 +96,6 @@ void OnroadWindow::updateState(const UIState &s) {
return;
}
QColor bgColor = bg_colors[s.status];
// Clearpilot
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
bg = bg_colors[STATUS_DISENGAGED];
}
Alert alert = Alert::get(*(s.sm), s.scene.started_frame);
alerts->updateAlert(alert);
@@ -114,8 +108,12 @@ void OnroadWindow::updateState(const UIState &s) {
nvg->updateState(s);
QColor bgColor = bg_colors[s.status];
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
bgColor = bg_colors[STATUS_DISENGAGED];
}
if (bg != bgColor) {
// repaint border
bg = bgColor;
update();
}
@@ -639,6 +637,16 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignTop);
}
QColor bgColor = bg_colors[s.status];
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
bgColor = bg_colors[STATUS_DISENGAGED];
}
if (bg != bgColor) {
bg = bgColor;
update();
}
updateFrogPilotWidgets();
}
@@ -900,16 +908,11 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
painter.drawPolygon(scene.track_vertices);
// Paint path edges ,Use current background color
QColor bgColor = bg_colors[uiState()->status];
// Clearpilot
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
bgColor = bg_colors[STATUS_DISENGAGED];
}
if (bgColor != bg_colors[STATUS_DISENGAGED]) {
if (bg != bg_colors[STATUS_DISENGAGED]) {
QLinearGradient edge_gradient;
edge_gradient.setColorAt(0.0, QColor(bgColor.red(), bgColor.green(), bgColor.blue(), static_cast<int>(255)));
edge_gradient.setColorAt(0.5, QColor(bgColor.red(), bgColor.green(), bgColor.blue(), static_cast<int>(255 * 0.7) ));
edge_gradient.setColorAt(1.0, QColor(bgColor.red(), bgColor.green(), bg.blue(), static_cast<int>(255 * 0.5)));
edge_gradient.setColorAt(0.0, QColor(bg.red(), bg.green(), bg.blue(), static_cast<int>(255)));
edge_gradient.setColorAt(0.5, QColor(bg.red(), bg.green(), bg.blue(), static_cast<int>(255 * 0.7) ));
edge_gradient.setColorAt(1.0, QColor(bgr.red(), bg.green(), bg.blue(), static_cast<int>(255 * 0.5)));
QPainterPath path;
path.addPolygon(scene.track_vertices);

View File

@@ -193,6 +193,7 @@ private:
bool v_ego_cluster_seen = false;
int status = STATUS_DISENGAGED;
std::unique_ptr<PubMaster> pm;
QColor bg = bg_colors[STATUS_DISENGAGED];
int skip_frame_count = 0;
bool wide_cam_requested = false;

View File

@@ -33,7 +33,7 @@ typedef enum UIStatus {
} UIStatus;
// Clearpilot new alpha constants
const float CENTER_LANE_ALPHA = 0.40;
const float CENTER_LANE_ALPHA = 0.55;
const float OTHER_LANE_ALPHA = 0.75;
const int CENTER_LANE_WIDTH = 50;