mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-26 09:42:11 +08:00
ui: Full Screen Navigation
This commit is contained in:
@@ -5,6 +5,10 @@ sunnypilot - 0.9.6.1 (2023-xx-xx)
|
||||
* UPDATED: Vision-based Turn Speed Control (V-TSC) implementation
|
||||
* Refactored implementation thanks to pfeiferj!
|
||||
* More accurate and consistent velocity calculation to achieve smoother longitudinal control in curves
|
||||
* UI updates
|
||||
* RE-ENABLED: Navigation: Full screen support
|
||||
* Display the map view in full screen
|
||||
* To switch back to driving view, tap on the border edge\
|
||||
* Hyundai Bayon Non-SCC 2019 support thanks to polein78!
|
||||
|
||||
sunnypilot - 0.9.5.2 (2023-12-07)
|
||||
|
||||
@@ -45,6 +45,12 @@ VisualsPanel::VisualsPanel(QWidget *parent) : ListWidget(parent) {
|
||||
tr("Enable this will display an icon that appears when the End-to-end model decides to start or stop."),
|
||||
"../assets/offroad/icon_blank.png",
|
||||
},
|
||||
{
|
||||
"MapboxFullScreen",
|
||||
tr("Navigation: Display in Full Screen"),
|
||||
QString(tr("Enable this will display the built-in navigation in full screen.<br>To switch back to driving view, <font color='yellow'>tap on the border edge</font>.")),
|
||||
"../assets/offroad/icon_blank.png",
|
||||
},
|
||||
{
|
||||
"Map3DBuildings",
|
||||
tr("Map: Display 3D Buildings"),
|
||||
@@ -101,4 +107,8 @@ VisualsPanel::VisualsPanel(QWidget *parent) : ListWidget(parent) {
|
||||
// trigger offroadTransition when going onroad/offroad
|
||||
connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
|
||||
});
|
||||
|
||||
QObject::connect(toggles["MapboxFullScreen"], &ToggleControl::toggleFlipped, [=](bool state) {
|
||||
toggles["MapboxFullScreen"]->showDescription();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ void OnroadWindow::updateState(const UIState &s) {
|
||||
Alert alert = Alert::get(*(s.sm), s.scene.started_frame, s.scene.display_debug_alert_frame);
|
||||
alerts->updateAlert(alert);
|
||||
|
||||
if (s.scene.map_on_left) {
|
||||
if (s.scene.map_on_left || s.scene.mapbox_fullscreen) {
|
||||
split->setDirection(QBoxLayout::LeftToRight);
|
||||
} else {
|
||||
split->setDirection(QBoxLayout::RightToLeft);
|
||||
@@ -208,6 +208,7 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
|
||||
// Switch between map and sidebar when using navigate on openpilot
|
||||
bool sidebarVisible = geometry().x() > 0;
|
||||
bool show_map = uiState()->scene.navigate_on_openpilot ? sidebarVisible : !sidebarVisible;
|
||||
updateMapSize(scene);
|
||||
map->setVisible(show_map && !map->isVisible());
|
||||
}
|
||||
}
|
||||
@@ -236,7 +237,8 @@ void OnroadWindow::offroadTransition(bool offroad) {
|
||||
QObject::connect(nvg->map_settings_btn, &MapSettingsButton::clicked, m, &MapPanel::toggleMapSettings);
|
||||
nvg->map_settings_btn->setEnabled(true);
|
||||
|
||||
m->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE);
|
||||
m->setFixedWidth(uiState()->scene.mapbox_fullscreen ? topWidget(this)->width() :
|
||||
topWidget(this)->width() / 2 - UI_BORDER_SIZE);
|
||||
split->insertWidget(0, m);
|
||||
|
||||
// hidden by default, made visible when navRoute is published
|
||||
@@ -263,6 +265,12 @@ void OnroadWindow::offroadTransition(bool offroad) {
|
||||
alerts->updateAlert({});
|
||||
}
|
||||
|
||||
void OnroadWindow::updateMapSize(const UIScene &scene) {
|
||||
map->setFixedWidth(scene.mapbox_fullscreen ? topWidget(this)->width() :
|
||||
topWidget(this)->width() / 2 - UI_BORDER_SIZE);
|
||||
split->insertWidget(0, map);
|
||||
}
|
||||
|
||||
void OnroadWindow::primeChanged(bool prime) {
|
||||
#ifdef ENABLE_MAPS
|
||||
if (map && (!prime && MAPBOX_TOKEN.isEmpty())) {
|
||||
|
||||
@@ -306,9 +306,11 @@ private:
|
||||
QHBoxLayout* split;
|
||||
|
||||
QWidget *onroad_settings = nullptr;
|
||||
Params params;
|
||||
|
||||
private slots:
|
||||
void offroadTransition(bool offroad);
|
||||
void primeChanged(bool prime);
|
||||
void updateState(const UIState &s);
|
||||
void updateMapSize(const UIScene &scene);
|
||||
};
|
||||
|
||||
@@ -253,6 +253,7 @@ void ui_update_params(UIState *s) {
|
||||
s->scene.live_torque_toggle = params.getBool("LiveTorque");
|
||||
s->scene.torqued_override = params.getBool("TorquedOverride");
|
||||
s->scene.speed_limit_control_engage_type = std::atoi(params.get("SpeedLimitEngageType").c_str());
|
||||
s->scene.mapbox_fullscreen = params.getBool("MapboxFullScreen");
|
||||
|
||||
// Handle Onroad Screen Off params
|
||||
if (s->scene.onroadScreenOff > 0) {
|
||||
|
||||
@@ -241,6 +241,8 @@ typedef struct UIScene {
|
||||
QRect sl_sign_rect;
|
||||
|
||||
int speed_limit_control_engage_type;
|
||||
|
||||
bool mapbox_fullscreen;
|
||||
} UIScene;
|
||||
|
||||
class UIState : public QObject {
|
||||
|
||||
Reference in New Issue
Block a user