nav: pull next location while onroad (#21421)
parent
8e36a7d07c
commit
60cc07c62a
|
@ -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…
Reference in New Issue