ui: Optimize Param Read for Onroad UI (#1365)
* Move params to uiscene * more --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
This commit is contained in:
@@ -21,7 +21,7 @@ SunnylinkPanel::SunnylinkPanel(QWidget *parent) : QFrame(parent) {
|
||||
paramsRefresh(param_name, param_value);
|
||||
});
|
||||
|
||||
is_sunnylink_enabled = Params().getBool("SunnylinkEnabled");
|
||||
is_sunnylink_enabled = params.getBool("SunnylinkEnabled");
|
||||
connect(uiStateSP(), &UIStateSP::sunnylinkRolesChanged, this, &SunnylinkPanel::updatePanel);
|
||||
connect(uiStateSP(), &UIStateSP::sunnylinkDeviceUsersChanged, this, &SunnylinkPanel::updatePanel);
|
||||
connect(uiStateSP(), &UIStateSP::offroadTransition, [=](bool offroad) {
|
||||
@@ -272,7 +272,7 @@ void SunnylinkPanel::updatePanel() {
|
||||
const auto sunnylinkDongleId = getSunnylinkDongleId().value_or(tr("N/A"));
|
||||
sunnylinkEnabledBtn->setEnabled(!is_onroad);
|
||||
|
||||
is_sunnylink_enabled = Params().getBool("SunnylinkEnabled");
|
||||
is_sunnylink_enabled = params.getBool("SunnylinkEnabled");
|
||||
bool is_sub = uiStateSP()->isSunnylinkSponsor() && is_sunnylink_enabled;
|
||||
auto max_current_sponsor_rule = uiStateSP()->sunnylinkSponsorRole();
|
||||
auto role_name = max_current_sponsor_rule.getSponsorTierString();
|
||||
|
||||
@@ -24,7 +24,7 @@ void ModelRendererSP::update_model(const cereal::ModelDataV2::Reader &model, con
|
||||
void ModelRendererSP::drawPath(QPainter &painter, const cereal::ModelDataV2::Reader &model, const QRect &surface_rect) {
|
||||
auto *s = uiState();
|
||||
auto &sm = *(s->sm);
|
||||
bool blindspot = Params().getBool("BlindSpot");
|
||||
bool blindspot = s->scene.blindspot_ui;
|
||||
|
||||
if (blindspot) {
|
||||
bool left_blindspot = sm["carState"].getCarState().getLeftBlindspot();
|
||||
@@ -49,7 +49,7 @@ void ModelRendererSP::drawPath(QPainter &painter, const cereal::ModelDataV2::Rea
|
||||
}
|
||||
}
|
||||
|
||||
bool rainbow = Params().getBool("RainbowMode");
|
||||
bool rainbow = s->scene.rainbow_mode;
|
||||
//float v_ego = sm["carState"].getCarState().getVEgo();
|
||||
|
||||
if (rainbow) {
|
||||
|
||||
@@ -74,6 +74,8 @@ void ui_update_params_sp(UIStateSP *s) {
|
||||
|
||||
s->scene.turn_signals = params.getBool("ShowTurnSignals");
|
||||
s->scene.chevron_info = std::atoi(params.get("ChevronInfo").c_str());
|
||||
s->scene.blindspot_ui = params.getBool("BlindSpot");
|
||||
s->scene.rainbow_mode = params.getBool("RainbowMode");
|
||||
}
|
||||
|
||||
void UIStateSP::reset_onroad_sleep_timer(OnroadTimerStatusToggle toggleTimerStatus) {
|
||||
|
||||
@@ -19,4 +19,6 @@ typedef struct UISceneSP : UIScene {
|
||||
bool hideVEgoUI;
|
||||
bool turn_signals = false;
|
||||
int chevron_info;
|
||||
bool blindspot_ui;
|
||||
bool rainbow_mode;
|
||||
} UISceneSP;
|
||||
|
||||
Reference in New Issue
Block a user