use gpsOK flag from locationd

This commit is contained in:
Adeeb Shihadeh 2021-02-09 19:31:30 -08:00
parent 599380edd6
commit b3cf60cd0b
3 changed files with 6 additions and 13 deletions

View file

@ -124,7 +124,7 @@ static void draw_panda_metric(UIState *s) {
}
#ifdef QCOM2
else if (s->started) {
panda_severity = s->scene.cnoAvg > 30 ? 0 : 1;
panda_severity = s->scene.gpsOK ? 0 : 1;
panda_message = util::string_format("SAT CNT\n%d", s->scene.satelliteCount);
}
#endif

View file

@ -41,7 +41,7 @@ static void ui_init_vision(UIState *s) {
void ui_init(UIState *s) {
s->sm = new SubMaster({"modelV2", "controlsState", "uiLayoutState", "liveCalibration", "radarState", "thermal", "frame",
s->sm = new SubMaster({"modelV2", "controlsState", "uiLayoutState", "liveCalibration", "radarState", "thermal", "frame", "liveLocationKalman",
"health", "carParams", "driverState", "driverMonitoringState", "sensorEvents", "carState", "ubloxGnss"});
s->started = false;
@ -174,19 +174,12 @@ static void update_sockets(UIState *s) {
if (sm.updated("ubloxGnss")) {
auto data = sm["ubloxGnss"].getUbloxGnss();
if (data.which() == cereal::UbloxGnss::MEASUREMENT_REPORT) {
auto measurements = data.getMeasurementReport().getMeasurements();
if (measurements.size()){
for (auto m : measurements) {
scene.cnoAvg += m.getCno();
}
scene.cnoAvg /= measurements.size();
} else {
scene.cnoAvg = 0;
}
scene.satelliteCount = data.getMeasurementReport().getNumMeas();
}
}
if (sm.updated("liveLocationKalman")) {
scene.gpsOK = sm["liveLocationKalman"].getLiveLocationKalman().getGpsOK();
}
if (sm.updated("carParams")) {
s->longitudinal_control = sm["carParams"].getCarParams().getOpenpilotLongitudinalControl();
}

View file

@ -120,7 +120,7 @@ typedef struct UIScene {
// gps
int satelliteCount;
int cnoAvg;
bool gpsOK;
// modelV2
float lane_line_probs[4];