mirror of https://github.com/commaai/openpilot.git
parent
25985e3999
commit
5cdff92d43
|
@ -31,11 +31,13 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
|
|||
const auto cs = sm["controlsState"].getControlsState();
|
||||
const auto car_state = sm["carState"].getCarState();
|
||||
|
||||
is_metric = s.scene.is_metric;
|
||||
|
||||
// Handle older routes where vCruiseCluster is not set
|
||||
float v_cruise = cs.getVCruiseCluster() == 0.0 ? cs.getVCruise() : cs.getVCruiseCluster();
|
||||
setSpeed = cs_alive ? v_cruise : SET_SPEED_NA;
|
||||
is_cruise_set = setSpeed > 0 && (int)setSpeed != SET_SPEED_NA;
|
||||
if (is_cruise_set && !s.scene.is_metric) {
|
||||
if (is_cruise_set && !is_metric) {
|
||||
setSpeed *= KM_TO_MILE;
|
||||
}
|
||||
|
||||
|
@ -43,10 +45,9 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
|
|||
v_ego_cluster_seen = v_ego_cluster_seen || car_state.getVEgoCluster() != 0.0;
|
||||
float v_ego = v_ego_cluster_seen ? car_state.getVEgoCluster() : car_state.getVEgo();
|
||||
speed = cs_alive ? std::max<float>(0.0, v_ego) : 0.0;
|
||||
speed *= s.scene.is_metric ? MS_TO_KPH : MS_TO_MPH;
|
||||
speed *= is_metric ? MS_TO_KPH : MS_TO_MPH;
|
||||
|
||||
is_metric = s.scene.is_metric;
|
||||
speedUnit = s.scene.is_metric ? tr("km/h") : tr("mph");
|
||||
speedUnit = is_metric ? tr("km/h") : tr("mph");
|
||||
hideBottomIcons = (cs.getAlertSize() != cereal::ControlsState::AlertSize::NONE);
|
||||
status = s.status;
|
||||
|
||||
|
|
Loading…
Reference in New Issue