mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 20:03:53 +08:00
@@ -211,7 +211,7 @@ static void ui_draw_vision_speed(UIState *s) {
|
||||
}
|
||||
|
||||
static void ui_draw_vision_event(UIState *s) {
|
||||
if ((*s->sm)["controlsState"].getControlsState().getEngageable()) {
|
||||
if (s->scene.engageable) {
|
||||
// draw steering wheel
|
||||
const int radius = 96;
|
||||
const int center_x = s->viz_rect.right() - radius - bdr_s * 2;
|
||||
@@ -226,8 +226,7 @@ static void ui_draw_vision_face(UIState *s) {
|
||||
const int radius = 96;
|
||||
const int center_x = s->viz_rect.x + radius + (bdr_s * 2);
|
||||
const int center_y = s->viz_rect.bottom() - footer_h / 2;
|
||||
bool is_active = (*s->sm)["driverMonitoringState"].getDriverMonitoringState().getIsActiveMode();
|
||||
ui_draw_circle_image(s, center_x, center_y, radius, "driver_face", is_active);
|
||||
ui_draw_circle_image(s, center_x, center_y, radius, "driver_face", s->scene.dm_active);
|
||||
}
|
||||
|
||||
static void ui_draw_vision_header(UIState *s) {
|
||||
|
||||
@@ -129,6 +129,11 @@ static void update_state(UIState *s) {
|
||||
SubMaster &sm = *(s->sm);
|
||||
UIScene &scene = s->scene;
|
||||
|
||||
// update engageability and DM icons at 2Hz
|
||||
if (sm.frame % (UI_FREQ / 2) == 0) {
|
||||
scene.engageable = sm["controlsState"].getControlsState().getEngageable();
|
||||
scene.dm_active = sm["driverMonitoringState"].getDriverMonitoringState().getIsActiveMode();
|
||||
}
|
||||
if (sm.updated("radarState")) {
|
||||
std::optional<cereal::ModelDataV2::XYZTData::Reader> line;
|
||||
if (sm.rcv_frame("modelV2") > 0) {
|
||||
|
||||
@@ -94,6 +94,8 @@ typedef struct UIScene {
|
||||
line_vertices_data lane_line_vertices[4];
|
||||
line_vertices_data road_edge_vertices[2];
|
||||
|
||||
bool dm_active, engageable;
|
||||
|
||||
// lead
|
||||
vertex_data lead_vertices[2];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user