openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.0 KiB

#pragma once
#include <map>
#include <string>
#include <QButtonGroup>
#include <QFrame>
#include <QLabel>
#include <QPushButton>
#include <QStackedWidget>
#include <QWidget>
longitudinal personality: change via steering wheel distance button (#31792) * start at param * start by sending personality * change to personality * POC: button changes personality * what's wrong with this? * fix * not really possible but fuzzy test catches this * there's always a typo * dang, we're dropping messages * clean up * no comment * bump * rename * not all cars yet * works but at what cost * clean up * inside settings * write param so we save the distance button changes * setChecked activates buttonToggled and already writes param! * don't need this, we update from longitudinalPlan on changes * some clean up * more * ui * allow some time for ui to receive and write param * plannerd: only track changes in case no ui * Revert "plannerd: only track changes in case no ui" This reverts commit 2b081aa6ceb92c67a621b74592b2292756d29871. * write in plannerd as well, I assume this is atomic? * don't write when setting checked (only user clicks) * better nane * more * Update selfdrive/controls/lib/longitudinal_planner.py Co-authored-by: Cameron Clough <cameronjclough@gmail.com> * doesn't write param now * ParamWatcher is nice * no debug * Update translations * fix * odd drain sock proc replay behavior * vanish * Revert "odd drain sock proc replay behavior" This reverts commit 29b70b39413e1852bb512155af6b6a94a5bd9454. * add GM * only if OP long * move personality to controlsState, since eventually it won't be exclusive to long planner more bump * diff without translations * fix * put nonblocking * CS should start at up to date personality always (no ui flicker) * update toggle on cereal message change * fix * fix that * ubmp * mypy doesn't know this is an int :( * update translations * fix the tests --------- Co-authored-by: Cameron Clough <cameronjclough@gmail.com> old-commit-hash: 3d63c7093afec7ba24f447a44f02f7bea1f7282b
1 year ago
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/util.h"
#include "selfdrive/ui/qt/widgets/controls.h"
// ********** settings window + top-level panels **********
class SettingsWindow : public QFrame {
Q_OBJECT
public:
explicit SettingsWindow(QWidget *parent = 0);
void setCurrentPanel(int index, const QString &param = "");
protected:
void showEvent(QShowEvent *event) override;
signals:
void closeSettings();
void reviewTrainingGuide();
void showDriverView();
void expandToggleDescription(const QString &param);
private:
QPushButton *sidebar_alert_widget;
QWidget *sidebar_widget;
QButtonGroup *nav_btns;
QStackedWidget *panel_widget;
};
class DevicePanel : public ListWidget {
Q_OBJECT
public:
explicit DevicePanel(SettingsWindow *parent);
signals:
void reviewTrainingGuide();
void showDriverView();
private slots:
void poweroff();
void reboot();
void updateCalibDescription();
private:
Params params;
ButtonControl *pair_device;
};
class TogglesPanel : public ListWidget {
Q_OBJECT
public:
explicit TogglesPanel(SettingsWindow *parent);
void showEvent(QShowEvent *event) override;
public slots:
void expandToggleDescription(const QString &param);
longitudinal personality: change via steering wheel distance button (#31792) * start at param * start by sending personality * change to personality * POC: button changes personality * what's wrong with this? * fix * not really possible but fuzzy test catches this * there's always a typo * dang, we're dropping messages * clean up * no comment * bump * rename * not all cars yet * works but at what cost * clean up * inside settings * write param so we save the distance button changes * setChecked activates buttonToggled and already writes param! * don't need this, we update from longitudinalPlan on changes * some clean up * more * ui * allow some time for ui to receive and write param * plannerd: only track changes in case no ui * Revert "plannerd: only track changes in case no ui" This reverts commit 2b081aa6ceb92c67a621b74592b2292756d29871. * write in plannerd as well, I assume this is atomic? * don't write when setting checked (only user clicks) * better nane * more * Update selfdrive/controls/lib/longitudinal_planner.py Co-authored-by: Cameron Clough <cameronjclough@gmail.com> * doesn't write param now * ParamWatcher is nice * no debug * Update translations * fix * odd drain sock proc replay behavior * vanish * Revert "odd drain sock proc replay behavior" This reverts commit 29b70b39413e1852bb512155af6b6a94a5bd9454. * add GM * only if OP long * move personality to controlsState, since eventually it won't be exclusive to long planner more bump * diff without translations * fix * put nonblocking * CS should start at up to date personality always (no ui flicker) * update toggle on cereal message change * fix * fix that * ubmp * mypy doesn't know this is an int :( * update translations * fix the tests --------- Co-authored-by: Cameron Clough <cameronjclough@gmail.com> old-commit-hash: 3d63c7093afec7ba24f447a44f02f7bea1f7282b
1 year ago
private slots:
void updateState(const UIState &s);
private:
Params params;
std::map<std::string, ParamControl*> toggles;
ButtonParamControl *long_personality_setting;
void updateToggles();
};
class SoftwarePanel : public ListWidget {
Q_OBJECT
public:
explicit SoftwarePanel(QWidget* parent = nullptr);
private:
void showEvent(QShowEvent *event) override;
void updateLabels();
void checkForUpdates();
bool is_onroad = false;
QLabel *onroadLbl;
LabelControl *versionLbl;
ButtonControl *installBtn;
ButtonControl *downloadBtn;
ButtonControl *targetBranchBtn;
Params params;
ParamWatcher *fs_watch;
};
// Forward declaration
class FirehosePanel;