This commit is contained in:
Your Name
2024-05-03 09:15:42 -05:00
parent 83155a30b9
commit 777b2d67f8
2 changed files with 49 additions and 36 deletions

View File

@@ -358,10 +358,10 @@ void ui_update_frogpilot_params(UIState *s) {
scene.model_ui = params.getBool("ModelUI");
scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth");
scene.hide_lead_marker = scene.model_ui && params.getBool("HideLeadMarker");
// CLEARPILOT
scene.lane_line_width = /* params.getInt("LaneLinesWidth") */ 2 * (scene.is_metric ? 1.0f : INCH_TO_CM) / 200.0f;
scene.path_edge_width = /* params.getInt("PathEdgeWidth"); */ 16;
scene.path_width = params.getInt("PathWidth") / 10.0f * (scene.is_metric ? 1.0f : FOOT_TO_METER) / 2.0f;
scene.lane_line_width = params.getInt("LaneLinesWidth") * (scene.is_metric ? 1.0f : INCH_TO_CM) / 200.0f;
// CLEARPILOT - either disable these options, or set them as defaults and restore them
scene.path_edge_width = /* params.getInt("PathEdgeWidth"); */ OTHER_LANE_WIDTH;
scene.path_width = /* params.getInt("PathWidth") */ CENTER_LANE_WIDTH / 10.0f * (scene.is_metric ? 1.0f : FOOT_TO_METER) / 2.0f;
scene.road_edge_width = params.getInt("RoadEdgesWidth") * (scene.is_metric ? 1.0f : INCH_TO_CM) / 200.0f;
scene.unlimited_road_ui_length = scene.model_ui && params.getBool("UnlimitedLength");

View File

@@ -18,9 +18,53 @@
#include "selfdrive/ui/qt/network/wifi_manager.h"
#include "system/hardware/hw.h"
const int UI_BORDER_SIZE = 16; // clearpilot
// --- Harddcoded Theme Vars ---
// Clearpilot redefined these.
typedef enum UIStatus {
STATUS_DISENGAGED,
STATUS_OVERRIDE,
STATUS_ENGAGED,
STATUS_ALWAYS_ON_LATERAL_ACTIVE,
STATUS_TRAFFIC_MODE_ACTIVE,
STATUS_EXPERIMENTAL_ACTIVE,
CENTER_LANE_COLOR,
} UIStatus;
// Clearpilot new alpha constants
const float CENTER_LANE_ALPHA = 0.35;
const float OTHER_LANE_ALPHA = 0.75;
const int CENTER_LANE_WIDTH = 50;
const int OTHER_LANE_WIDTH = 16;
// Clearpilot custom colors
const QColor bg_colors [] = {
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
[STATUS_OVERRIDE] = QColor(64, 85, 245, 0xd1), // When you nudge the steering wheel while engaged
[STATUS_ENGAGED] = QColor(64, 85, 245, 0xd1), // Bright Blue
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(162, 221, 235, 0xd1), // Lighter Blue
[STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xd1), // ? unused?
[STATUS_EXPERIMENTAL_ACTIVE] = QColor(201, 41, 204, 0xd1), // Magenta
[CENTER_LANE_COLOR] = QColor(150, 150, 150, 0xd1), // Gray
};
static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = {
{cereal::ControlsState::AlertStatus::NORMAL, QColor(0x15, 0x15, 0x15, 0xf1)},
{cereal::ControlsState::AlertStatus::USER_PROMPT, QColor(4, 4, 140, 0xf1)}, // CLEARPILOT changed to dark blue
{cereal::ControlsState::AlertStatus::CRITICAL, QColor(0xC9, 0x22, 0x31, 0xf1)},
{cereal::ControlsState::AlertStatus::FROGPILOT, QColor(4, 4, 140, 0xf1)}, // CLEARPILOT changed to dark blue
};
const int UI_BORDER_SIZE = 16; // Should be a multiple of 2
const int UI_HEADER_HEIGHT = 420;
// --- End hardcoded theme vars ---
const int UI_FREQ = 20; // Hz
const int BACKLIGHT_OFFROAD = 50;
typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert;
@@ -117,37 +161,6 @@ enum PrimeType {
PURPLE = 5,
};
// Clearpilot redefined these.
typedef enum UIStatus {
STATUS_DISENGAGED,
STATUS_OVERRIDE,
STATUS_ENGAGED,
STATUS_ALWAYS_ON_LATERAL_ACTIVE,
STATUS_TRAFFIC_MODE_ACTIVE,
STATUS_EXPERIMENTAL_ACTIVE,
CENTER_LANE_COLOR,
} UIStatus;
const float CENTER_LANE_ALPHA = 0.35;
const float OTHER_LANE_ALPHA = 0.75;
// Clearpilot custom colors
const QColor bg_colors [] = {
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
[STATUS_OVERRIDE] = QColor(64, 85, 245, 0xd1), // When you nudge the steering wheel while engaged
[STATUS_ENGAGED] = QColor(64, 85, 245, 0xd1), // Orange
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(162, 221, 235, 0xd1), // Gray
[STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xd1), // ? unused?
[STATUS_EXPERIMENTAL_ACTIVE] = QColor(201, 41, 204, 0xd1), // Magenta
[CENTER_LANE_COLOR] = QColor(150, 150, 150, 0xd1), // Gray
};
static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = {
{cereal::ControlsState::AlertStatus::NORMAL, QColor(0x15, 0x15, 0x15, 0xf1)},
{cereal::ControlsState::AlertStatus::USER_PROMPT, QColor(4, 64, 11, 0xf1)}, // CLEARPILOT changed to a shade of dark blue
{cereal::ControlsState::AlertStatus::CRITICAL, QColor(0xC9, 0x22, 0x31, 0xf1)},
{cereal::ControlsState::AlertStatus::FROGPILOT, QColor(47, 158, 238, 0xf1)}, // CLEARPILOT changed to light blue
};
typedef struct UIScene {
bool calibration_valid = false;