simpilify ui_read_params (#19585)

* simpilify ui_read_params

* apply review
pull/19587/head
Dean Lee 5 years ago committed by GitHub
parent 1bcc3beae8
commit e3ffa91d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      selfdrive/ui/ui.cc

@ -243,14 +243,10 @@ static void ui_read_params(UIState *s) {
if (frame % (5*UI_FREQ) == 0) {
read_param(&s->is_metric, "IsMetric");
} else if (frame % (6*UI_FREQ) == 0) {
uint64_t last_athena_ping = 0;
int param_read = read_param(&last_athena_ping, "LastAthenaPingTime");
if (param_read != 0) { // Failed to read param
s->scene.athenaStatus = NET_DISCONNECTED;
} else if (nanos_since_boot() - last_athena_ping < 70e9) {
s->scene.athenaStatus = NET_CONNECTED;
} else {
s->scene.athenaStatus = NET_ERROR;
s->scene.athenaStatus = NET_DISCONNECTED;
uint64_t last_ping = 0;
if (read_param(&last_ping, "LastAthenaPingTime") == 0) {
s->scene.athenaStatus = nanos_since_boot() - last_ping < 70e9 ? NET_CONNECTED : NET_ERROR;
}
}
}

Loading…
Cancel
Save