nav: pull next location while onroad (#21421)

pull/21413/head
Willem Melching 2021-06-29 11:08:37 +02:00 committed by GitHub
parent 8e36a7d07c
commit 60cc07c62a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -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();

View File

@ -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);
}
});

View File

@ -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;