mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-29 17:13:43 +08:00
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:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user