Visuals - Developer UI - Border Metrics - Blind Spot
Display blind spot metrics in onroad UI border.
This commit is contained in:
parent
430ec81028
commit
20bc0dfe7d
@ -220,7 +220,38 @@ void OnroadWindow::paintEvent(QPaintEvent *event) {
|
|||||||
SubMaster &sm = *(s->sm);
|
SubMaster &sm = *(s->sm);
|
||||||
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
p.fillRect(rect(), QColor(bg.red(), bg.green(), bg.blue(), 255));
|
QRect rect = this->rect();
|
||||||
|
p.fillRect(rect, QColor(bg.red(), bg.green(), bg.blue(), 255));
|
||||||
|
|
||||||
|
if (scene.show_blind_spot) {
|
||||||
|
auto getBlindspotColor = [&](bool turn_signal, int &frames) {
|
||||||
|
if (turn_signal) {
|
||||||
|
if (sm.frame % 10 == 0) {
|
||||||
|
frames = 5;
|
||||||
|
}
|
||||||
|
return (frames-- > 0) ? bg_colors[STATUS_TRAFFIC_MODE_ACTIVE] : bg;
|
||||||
|
}
|
||||||
|
return bg_colors[STATUS_TRAFFIC_MODE_ACTIVE];
|
||||||
|
};
|
||||||
|
|
||||||
|
static int blindspot_frames_left = 0;
|
||||||
|
static int blindspot_frames_right = 0;
|
||||||
|
|
||||||
|
if (scene.blind_spot_left || scene.blind_spot_right) {
|
||||||
|
if (scene.blind_spot_left) {
|
||||||
|
QRect leftHalf(rect.x(), rect.y(), rect.width() / 2, rect.height());
|
||||||
|
QColor color = getBlindspotColor(scene.turn_signal_left, blindspot_frames_left);
|
||||||
|
p.fillRect(leftHalf, QColor(color.red(), color.green(), color.blue(), 255));
|
||||||
|
}
|
||||||
|
if (scene.blind_spot_right) {
|
||||||
|
QRect rightHalf(rect.x() + rect.width() / 2, rect.y(), rect.width() / 2, rect.height());
|
||||||
|
QColor color = getBlindspotColor(scene.turn_signal_right, blindspot_frames_right);
|
||||||
|
p.fillRect(rightHalf, QColor(color.red(), color.green(), color.blue(), 255));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
blindspot_frames_left = blindspot_frames_right = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** onroad widgets *****
|
// ***** onroad widgets *****
|
||||||
|
@ -323,6 +323,10 @@ void ui_update_frogpilot_params(UIState *s) {
|
|||||||
scene.holiday_themes = custom_theme && params.getBool("HolidayThemes");
|
scene.holiday_themes = custom_theme && params.getBool("HolidayThemes");
|
||||||
scene.random_events = custom_theme && params.getBool("RandomEvents");
|
scene.random_events = custom_theme && params.getBool("RandomEvents");
|
||||||
|
|
||||||
|
bool developer_ui = params.getBool("DeveloperUI");
|
||||||
|
bool border_metrics = developer_ui && params.getBool("BorderMetrics");
|
||||||
|
scene.show_blind_spot = border_metrics && params.getBool("BlindSpotMetrics");
|
||||||
|
|
||||||
scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing");
|
scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing");
|
||||||
scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing");
|
scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing");
|
||||||
|
|
||||||
|
@ -215,6 +215,7 @@ typedef struct UIScene {
|
|||||||
bool road_name_ui;
|
bool road_name_ui;
|
||||||
bool rotating_wheel;
|
bool rotating_wheel;
|
||||||
bool show_aol_status_bar;
|
bool show_aol_status_bar;
|
||||||
|
bool show_blind_spot;
|
||||||
bool show_cem_status_bar;
|
bool show_cem_status_bar;
|
||||||
bool show_slc_offset;
|
bool show_slc_offset;
|
||||||
bool show_slc_offset_ui;
|
bool show_slc_offset_ui;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user