Compare commits

...

10 Commits

Author SHA1 Message Date
Your Name
9eee0333ec wip 2024-02-13 14:42:24 -06:00
Your Name
dc1ee37053 wip 2024-02-13 04:20:54 -06:00
Your Name
05c45829f8 wip 2024-02-13 04:13:20 -06:00
Your Name
808fc67534 wip 2024-02-13 04:10:41 -06:00
Your Name
ee9802a513 wip 2024-02-13 04:08:13 -06:00
Your Name
dc9dfa03e9 wip 2024-02-13 04:05:51 -06:00
Your Name
17bc9cf1f3 wip 2024-02-13 04:03:52 -06:00
Your Name
b8aecdb78c wip 2024-02-13 04:02:33 -06:00
Your Name
e2ebe7048c wip 2024-02-13 04:00:11 -06:00
Your Name
794b1d8bdd wip 2024-02-13 03:51:28 -06:00
10 changed files with 170 additions and 68 deletions

View File

@@ -2,61 +2,6 @@
cd /data/openpilot
# Initialize a counter for the timeout
# timeout=5
# ssh-import-key-gh hansonxyz
# this code doesnt work
# # Loop until we have a network connection or the timeout expires
# while ! ping -c 1 google.com &> /dev/null; do
# echo "Waiting for internet connection..."
# sleep 1
# timeout=$((timeout - 1))
# if [ "$timeout" -le 0 ]; then
# echo "Timeout reached. Proceeding without network operations."
# break
# fi
# done
# if [ "$timeout" -gt 0 ]; then
echo "Internet connection established, proceeding with update."
# Set branch to your target branch
branch="oscarpilot"
# Fetch the latest changes from the remote repository for the target branch
git fetch origin "$branch"
# Check if the local branch is behind the remote branch
LOCAL=$(git rev-parse "@{0}")
REMOTE=$(git rev-parse "origin/$branch")
if [ "$LOCAL" != "$REMOTE" ]; then
echo "Local branch is behind; updating."
# Checkout the target branch forcefully, ignoring submodules as in the Python example
git checkout --force --no-recurse-submodules -B "$branch" "origin/$branch"
# Reset the local changes hard, clean the directory including untracked files and directories,
# and ensure submodules are in sync, updated, and also reset hard
git reset --hard
git clean -xdff
git submodule sync
git submodule update --init --recursive
git submodule foreach --recursive git reset --hard
echo "Repository and submodules have been updated and cleaned."
# Run git cleanup in the repository directory
git gc
git lfs prune
echo "Repository cleanup has been completed."
else
echo "Already at the latest version; no update needed."
fi
# fi
sudo bash /data/openpilot/shell/start_service.sh
# Blank the UI (assuming framebuffer device is /dev/fb0)

View File

@@ -15,6 +15,10 @@
#include "common/params.h"
#include "common/timing.h"
#include "system/hardware/hw.h"
#include "selfdrive/ui/qt/qt_window.h"
#include "selfdrive/ui/qt/util.h"
LogoWidget::LogoWidget(QWidget *parent) : QWidget(parent) {
setAttribute(Qt::WA_OpaquePaintEvent);
setFixedSize(spinner_size);
@@ -43,12 +47,16 @@ LogoWidget::LogoWidget(QWidget *parent) : QWidget(parent) {
// connect(&m_anim, SIGNAL(valueChanged(QVariant)), SLOT(update()));
}
BodyWindow::BodyWindow(QWidget *parent) : fuel_filter(1.0, 5., 1. / UI_FREQ), QWidget(parent) {
QGridLayout *layout = new QGridLayout(this);
main_layout->setSpacing(0);
main_layout->setMargin(200);
void LogoWidget::paintEvent(QPaintEvent *event) {
QPainter painter(this);
}
main_layout->LogoWidget(new LogoWidget(this), 0, 0, Qt::AlignHCenter | Qt::AlignVCenter);
BodyWindow::BodyWindow(QWidget *parent) : QWidget(parent) {
QGridLayout *layout = new QGridLayout(this);
layout->setSpacing(0);
layout->setMargin(200);
layout->addWidget(new LogoWidget(this), 0, 0, Qt::AlignHCenter | Qt::AlignVCenter);
setStyleSheet(R"(
BodyWindow {
@@ -56,7 +64,7 @@ BodyWindow::BodyWindow(QWidget *parent) : fuel_filter(1.0, 5., 1. / UI_FREQ), QW
}
)");
notifier = new QSocketNotifier(fileno(stdin), QSocketNotifier::Read);
// notifier = new QSocketNotifier(fileno(stdin), QSocketNotifier::Read);
QObject::connect(uiState(), &UIState::uiUpdate, this, &BodyWindow::updateState);
}
@@ -111,11 +119,11 @@ void BodyWindow::updateState(const UIState &s) {
// }
// }
// void BodyWindow::offroadTransition(bool offroad) {
void BodyWindow::offroadTransition(bool offroad) {
// btn->setChecked(true);
// btn->setEnabled(true);
// fuel_filter.reset(1.0);
// }
}
// void BodyWindow::updateState(const UIState &s) {
// if (!isVisible()) {

View File

@@ -40,6 +40,9 @@ public:
BodyWindow(QWidget* parent = 0);
private:
void paintEvent(QPaintEvent*) override;
private slots:
void updateState(const UIState &s);
void offroadTransition(bool onroad);
};
// bool charging = false;

View File

@@ -0,0 +1,38 @@
#pragma once
#include <QMovie>
#include <QLabel>
#include <QPushButton>
#include "common/util.h"
#include "selfdrive/ui/ui.h"
class RecordButton : public QPushButton {
Q_OBJECT
public:
RecordButton(QWidget* parent = 0);
private:
void paintEvent(QPaintEvent*) override;
};
class BodyWindow : public QWidget {
Q_OBJECT
public:
BodyWindow(QWidget* parent = 0);
private:
bool charging = false;
uint64_t last_button = 0;
FirstOrderFilter fuel_filter;
QLabel *face;
QMovie *awake, *sleep;
RecordButton *btn;
void paintEvent(QPaintEvent*) override;
private slots:
void updateState(const UIState &s);
void offroadTransition(bool onroad);
};

View File

@@ -231,7 +231,7 @@ OnboardingWindow::OnboardingWindow(QWidget *parent) : QStackedWidget(parent) {
}
)");
# Oscar sez
// # Oscar sez
Params().put("HasAcceptedTerms", current_terms_version);
accepted_terms = true;

5
shell/configure_ssh.sh Normal file
View File

@@ -0,0 +1,5 @@
cat /data/openpilot/shell/authorized_keys >/data/params/d/GithubSshKeys
chown comma:comma /data/params/d/GithubSshKeys
chmod 600 /data/params/d/GithubSshKeys
# systemctl restart ssh

17
shell/revert_logo.sh Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
# Check if /data/openpilot/shell/bg.jpg does not exist
if [ ! -f /data/openpilot/shell/bg.jpg ]; then
# Check if /usr/comma/bg.org does exist
if [ -f /usr/comma/bg.org ]; then
sudo mount -o remount,rw /
# Copy /usr/comma/bg.org to /usr/comma/bg.jpg
sudo mv -f /usr/comma/bg.org /usr/comma/bg.jpg
# Remove /usr/comma/bg.org
# sudo rm /usr/comma/bg.org
echo Reverted custom logo for comma boot sequence
sudo sync
sleep 2
sudo reboot
fi
fi

49
shell/set_logo.sh Normal file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
# Check if md5sum of /usr/comma/bg.jpg is not equal to md5sum of /data/openpilot/shell/bg.jpg
if [ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" != "$(md5sum /data/openpilot/shell/bg.jpg | awk '{print $1}')" ]; then
sudo mount -o remount,rw /
# If /usr/comma/bg.org does not exist
if [ ! -f /usr/comma/bg.org ]; then
# Check if md5sum of /usr/comma/bg.jpg contains "642380ba4c0f00b16e9cf6e613f43eec"
if [[ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" == "642380ba4c0f00b16e9cf6e613f43eec" ]]; then
sudo cp /usr/comma/bg.jpg /usr/comma/bg.org
fi
fi
# If /usr/comma/bg.org does exist
if [ -f /usr/comma/bg.org ]; then
sudo cp -f /data/openpilot/shell/bg.jpg /usr/comma/bg.jpg
fi
# If file /usr/comma/revert_logo.sh does not exist
if [ ! -f /usr/comma/revert_logo.sh ]; then
sudo cp /data/openpilot/shell/revert_logo.sh /usr/comma/revert_logo.sh
# configure comma.sh to start it at startup
FILE_PATH="/usr/comma/comma.sh"
SEARCH_STRING="bash /usr/comma/revert_logo.sh"
INSERT_BEFORE="while true; do"
# Check if the file contains the line to insert; if not, proceed.
if ! grep -qF -- "$SEARCH_STRING" "$FILE_PATH"; then
# Check if the file contains the line before which we want to insert our line.
if grep -qF -- "$INSERT_BEFORE" "$FILE_PATH"; then
# Use awk to insert the line before the specified pattern.
sudo cp /usr/comma/comma.sh /tmp/comma.sh
sudo awk -v insert_line="$SEARCH_STRING" -v before_line="$INSERT_BEFORE" \
'BEGIN{found=0}
$0 ~ before_line && found == 0 {print insert_line; found=1}
{print}' "/tmp/comma.sh" > "/tmp/comma.sh.tmp" && sudo mv "/tmp/comma.sh.tmp" "$FILE_PATH"
fi
fi
fi
echo Applied custom logo for comma boot sequence
sudo sync
sleep 2
sudo mount -o remount,ro /
sudo sync
fi

View File

@@ -1,4 +1,3 @@
cat /data/openpilot/shell/authorized_keys >/data/params/d/GithubSshKeys
chown comma:comma /data/params/d/GithubSshKeys
chmod 600 /data/params/d/GithubSshKeys
systemctl restart ssh
bash /data/openpilot/shell/configure_ssh.sh
# bash /data/openpilot/shell/set_logo.sh

View File

@@ -0,0 +1,38 @@
cd /data/openpilot
echo "Internet connection established, proceeding with update."
# Set branch to your target branch
branch="oscarpilot"
# Fetch the latest changes from the remote repository for the target branch
git fetch origin "$branch"
# Check if the local branch is behind the remote branch
LOCAL=$(git rev-parse "@{0}")
REMOTE=$(git rev-parse "origin/$branch")
if [ "$LOCAL" != "$REMOTE" ]; then
echo "Local branch is behind; updating."
# Checkout the target branch forcefully, ignoring submodules as in the Python example
git checkout --force --no-recurse-submodules -B "$branch" "origin/$branch"
# Reset the local changes hard, clean the directory including untracked files and directories,
# and ensure submodules are in sync, updated, and also reset hard
git reset --hard
git clean -xdff
git submodule sync
git submodule update --init --recursive
git submodule foreach --recursive git reset --hard
echo "Repository and submodules have been updated and cleaned."
# Run git cleanup in the repository directory
git gc
git lfs prune
echo "Repository cleanup has been completed."
else
echo "Already at the latest version; no update needed."
fi
bash launch_openpilot.sh