nav: pull next location while onroad (#21421)

old-commit-hash: 60cc07c62a
commatwo_master
Willem Melching 4 years ago committed by GitHub
parent b449a2a7d9
commit 492083a4a8
  1. 2
      selfdrive/ui/qt/maps/map_settings.cc
  2. 4
      selfdrive/ui/qt/request_repeater.cc
  3. 2
      selfdrive/ui/qt/request_repeater.h

@ -84,7 +84,7 @@ MapPanel::MapPanel(QWidget* parent) : QWidget(parent) {
// Destination set while offline
{
std::string url = "https://api.commadotai.com/v1/navigation/" + dongle_id + "/next";
RequestRepeater* repeater = new RequestRepeater(this, QString::fromStdString(url), "", 10);
RequestRepeater* repeater = new RequestRepeater(this, QString::fromStdString(url), "", 10, true);
QObject::connect(repeater, &RequestRepeater::receivedResponse, [](QString resp) {
auto params = Params();

@ -1,11 +1,11 @@
#include "selfdrive/ui/qt/request_repeater.h"
RequestRepeater::RequestRepeater(QObject *parent, const QString &requestURL, const QString &cacheKey,
int period) : HttpRequest(parent, requestURL) {
int period, bool while_onroad) : HttpRequest(parent, requestURL) {
timer = new QTimer(this);
timer->setTimerType(Qt::VeryCoarseTimer);
QObject::connect(timer, &QTimer::timeout, [=]() {
if (!QUIState::ui_state.scene.started && QUIState::ui_state.awake && reply == NULL) {
if ((!QUIState::ui_state.scene.started || while_onroad) && QUIState::ui_state.awake && reply == NULL) {
sendRequest(requestURL);
}
});

@ -6,7 +6,7 @@
class RequestRepeater : public HttpRequest {
public:
RequestRepeater(QObject *parent, const QString &requestURL, const QString &cacheKey = "", int period = 0);
RequestRepeater(QObject *parent, const QString &requestURL, const QString &cacheKey = "", int period = 0, bool while_onroad=false);
private:
Params params;

Loading…
Cancel
Save