ui: Feature Status: Update only when param is changed (#311)

* ui: Feature Status: Update only when param is changed

* less calls
This commit is contained in:
Jason Wen
2023-09-29 01:49:43 -04:00
committed by GitHub
parent c0f2e6bc05
commit 71fc267606
2 changed files with 6 additions and 9 deletions
+6
View File
@@ -147,6 +147,12 @@ void OnroadSettings::refresh() {
param_watcher->addParam("LongitudinalPersonality");
param_watcher->addParam("SpeedLimitControl");
UIScene &scene = uiState()->scene;
// Update live params on Feature Status on camera view
scene.dynamic_lane_profile = std::atoi(params.get("DynamicLaneProfile").c_str());
scene.longitudinal_personality = std::atoi(params.get("LongitudinalPersonality").c_str());
scene.speed_limit_control_enabled = params.getBool("SpeedLimitControl");
if (!isVisible()) return;
setUpdatesEnabled(false);
-9
View File
@@ -313,15 +313,6 @@ void UIState::updateStatus() {
}
if (scene.started) {
// Update live params when the camera view is on
{
if (sm->frame % (UI_FREQ / 2) == 0) { // Update every 2 Hz
scene.dynamic_lane_profile = std::atoi(params.get("DynamicLaneProfile").c_str());
scene.longitudinal_personality = std::atoi(params.get("LongitudinalPersonality").c_str());
scene.speed_limit_control_enabled = params.getBool("SpeedLimitControl");
}
}
// Auto hide UI button state machine
{
if (scene.button_auto_hide) {