-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·75 lines (66 loc) · 2.66 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·75 lines (66 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# DDSM115/210 Motor Control - Unified Launcher
# Handles first-time setup and launching with auto-detection
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "🎯 DDSM115/210 Motor Control - Starting..."
# Check if Python 3 is available
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is required but not found."
echo "📋 Please install Python 3.8+ and try again."
echo " Ubuntu/Debian: sudo apt install python3 python3-pip python3-venv python3-tk"
echo " RHEL/CentOS: sudo yum install python3 python3-pip python3-tkinter"
echo " macOS: brew install python-tk"
exit 1
fi
# Check if tkinter is available
echo "🔍 Checking GUI dependencies..."
if ! python3 -c "import tkinter" 2>/dev/null; then
echo "⚠️ tkinter (GUI library) not found!"
echo "📋 Installing tkinter is required for the GUI interface."
echo ""
echo "Please run one of these commands based on your system:"
echo " Ubuntu/Debian: sudo apt install python3-tk"
echo " RHEL/CentOS: sudo yum install python3-tkinter"
echo " Fedora: sudo dnf install python3-tkinter"
echo " Arch Linux: sudo pacman -S tk"
echo " macOS: brew install python-tk"
echo ""
echo "After installing tkinter, run this script again."
exit 1
fi
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo "🔧 First-time setup: Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
source venv/bin/activate
# Check if requirements are installed
if [ ! -f "venv/.requirements_installed" ] || [ "requirements.txt" -nt "venv/.requirements_installed" ]; then
echo "📦 Installing/updating requirements..."
if [ -f "requirements.txt" ]; then
./venv/bin/pip install --upgrade pip
./venv/bin/pip install -r requirements.txt
touch venv/.requirements_installed
else
echo "⚠️ requirements.txt not found, installing minimal dependencies..."
./venv/bin/pip install --upgrade pip
./venv/bin/pip install pyserial matplotlib numpy
touch venv/.requirements_installed
fi
fi
# Check if source files exist in the new structure
if [ -f "src/ddsm115_gui.py" ]; then
echo "🚀 Launching DDSM115/210 Motor Control GUI..."
cd src
../venv/bin/python3 ddsm115_gui.py
elif [ -f "ddsm115_gui.py" ]; then
echo "🚀 Launching DDSM115/210 Motor Control GUI (legacy location)..."
./venv/bin/python3 ddsm115_gui.py
else
echo "❌ Main application file not found!"
echo "📋 Please ensure ddsm115_gui.py exists in the current directory or src/ directory."
exit 1
fi