Revert "ui: Handle frequency checks for live params and other elements (#278)" (#279)

This reverts commit acf280e15b.
This commit is contained in:
Jason Wen
2023-09-15 23:15:17 -04:00
committed by GitHub
parent acf280e15b
commit 1a0da520fc
4 changed files with 10 additions and 12 deletions
+3 -1
View File
@@ -92,7 +92,9 @@ void Sidebar::updateState(const UIState &s) {
}
setProperty("connectStatus", QVariant::fromValue(connectStatus));
if (sm.frame % (UI_FREQ / 20) == 0) { // Update every 1 Hz
if (millis_since_boot() - last_temp_count > 1000 * 1) {
last_temp_count = millis_since_boot();
switch (s.scene.sidebar_temp_options) {
case 0:
sidebar_temp = QString::number((int)deviceState.getAmbientTempC());
+1
View File
@@ -61,6 +61,7 @@ protected:
private:
std::unique_ptr<PubMaster> pm;
uint64_t last_temp_count;
QString sidebar_temp = "0";
QString sidebar_temp_str = "0";
};
+5 -11
View File
@@ -231,14 +231,15 @@ void ui_update_params(UIState *s) {
auto params = Params();
s->scene.is_metric = params.getBool("IsMetric");
s->scene.map_on_left = params.getBool("NavSettingLeftSide");
s->scene.dynamic_lane_profile_toggle = params.getBool("DynamicLaneProfileToggle");
s->scene.dynamic_lane_profile = std::atoi(params.get("DynamicLaneProfile").c_str());
s->scene.visual_brake_lights = params.getBool("BrakeLights");
s->scene.onroadScreenOff = std::atoi(params.get("OnroadScreenOff").c_str());
s->scene.onroadScreenOffBrightness = std::atoi(params.get("OnroadScreenOffBrightness").c_str());
s->scene.onroadScreenOffEvent = params.getBool("OnroadScreenOffEvent");
s->scene.brightness = std::atoi(params.get("BrightnessControl").c_str());
s->scene.stand_still_timer = params.getBool("StandStillTimer");
s->scene.speed_limit_control_enabled = params.getBool("SpeedLimitControl");
s->scene.speed_limit_perc_offset = params.getBool("SpeedLimitPercOffset");
s->scene.show_debug_ui = params.getBool("ShowDebugUI");
s->scene.debug_snapshot_enabled = params.getBool("EnableDebugSnapshot");
@@ -252,6 +253,7 @@ void ui_update_params(UIState *s) {
s->scene.e2e_long_alert_light = params.getBool("EndToEndLongAlertLight");
s->scene.e2e_long_alert_lead = params.getBool("EndToEndLongAlertLead");
s->scene.e2e_long_alert_ui = params.getBool("EndToEndLongAlertUI");
s->scene.longitudinal_personality = std::atoi(params.get("LongitudinalPersonality").c_str());
// Handle Onroad Screen Off params
if (s->scene.onroadScreenOff > 0) {
@@ -312,15 +314,6 @@ void UIState::updateStatus() {
}
if (scene.started) {
// Update live params when the camera view is on
{
if (sm->frame % (UI_FREQ / 10) == 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) {
@@ -373,7 +366,8 @@ void UIState::updateStatus() {
}
}
if (sm->frame % (UI_FREQ / 20) == 0) { // Update every 1 Hz
if (millis_since_boot() - last_update_params_sidebar > 1000 * 1) {
last_update_params_sidebar = millis_since_boot();
scene.sidebar_temp = params.getBool("SidebarTemperature");
scene.sidebar_temp_options = std::atoi(params.get("SidebarTemperatureOptions").c_str());
}
+1
View File
@@ -265,6 +265,7 @@ private:
QTimer *timer;
bool started_prev = false;
PrimeType prime_type = PrimeType::UNKNOWN;
uint64_t last_update_params_sidebar;
bool last_mads_enabled = false;
bool mads_path_state = false;