From 42057f1b2f179d571c3ea3c58b9acb1158cdad64 Mon Sep 17 00:00:00 2001
From: ulukkbek <ulukbek.egemnazarov@student.tugraz.at>
Date: Fri, 23 Aug 2024 12:36:10 +0200
Subject: [PATCH] Fixed paths and commands

---
 compile_run_arduino.sh | 42 +++++++++++++++++++++++++++++++++++++++++-
 server.py              |  2 +-
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/compile_run_arduino.sh b/compile_run_arduino.sh
index 727c196..8e324fe 100644
--- a/compile_run_arduino.sh
+++ b/compile_run_arduino.sh
@@ -1,2 +1,42 @@
 #!/bin/bash
-source ~/.platformio/penv/bin/activate && pio run -e megaatmega2560 -t upload
\ No newline at end of file
+#source ~/.platformio/penv/bin/activate && pio run -e megaatmega2560 -t upload
+
+#!/bin/bash
+
+# Define the project directory
+PROJECT_DIR="/home/mola/Desktop/hps_mola_mola/New_Structure/Inside_Boat/Mola_Slave/"
+
+# Navigate to the project directory
+cd "$PROJECT_DIR" || { echo "Directory not found!"; exit 1; }
+
+
+source ~/platformio-venv/bin/activate
+
+
+# Initialize the project (optional, can be skipped if already initialized)
+pio project init
+
+
+# Compile the project
+echo "Compiling the project..."
+pio run
+if [ $? -ne 0 ]; then
+    echo "Compilation failed!"
+    exit 1
+fi
+
+# Upload the compiled firmware to the device
+echo "Uploading the firmware..."
+pio run --target upload
+if [ $? -ne 0 ]; then
+    echo "Upload failed!"
+    exit 1
+fi
+
+# Monitor the serial output (optional)
+if [ "$1" == "--monitor" ]; then
+    echo "Opening serial monitor..."
+    pio device monitor
+fi
+
+echo "Done!"
diff --git a/server.py b/server.py
index 21bea5f..41e6038 100644
--- a/server.py
+++ b/server.py
@@ -33,7 +33,7 @@ def button_restart_python():
 def button_git_pull():
     print('CMD: git pull')
     try:
-        repo_path = '/home/MolaMola/Desktop/hps_mola_mola'
+        repo_path = '/home/mola/Desktop/hps_mola_mola/'
         result = subprocess.run(['git', '-C', repo_path, 'pull'], capture_output=True, text=True)
         if result.returncode == 0:
             return jsonify({'message' : 'Success, pulled from repo', 'details':result.stdout})
-- 
GitLab