diff --git a/setup.sh b/setup.sh index 44a3a88..ed25e16 100644 --- a/setup.sh +++ b/setup.sh @@ -17,65 +17,53 @@ echo "Step 1: Updating package lists and upgrading..." sudo apt update && sudo apt upgrade -y # --------------------------------------------------------- -# Step 2: Install essential development and serial tools +# Step 2: Install core tools and Python requirements # --------------------------------------------------------- -echo "Step 2: Installing core tools and dependencies..." +echo "Step 2: Installing tools and Python libraries..." sudo apt install -y git curl python3 python3-pip build-essential cmake \ arduino-cli teensy-loader-cli python3-serial -# --------------------------------------------------------- -# Step 3: Download NTP TimeTurner script -# --------------------------------------------------------- -echo "Step 3: Downloading TimeTurner daemon script..." -cd /home/pi -wget -O timeturner.py https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/timeturner.py -chmod +x timeturner.py - -# --------------------------------------------------------- -# Step 4: Install Python requirements -# --------------------------------------------------------- -echo "Step 4: Installing Python packages..." +echo "Installing Python package: pylibltc" pip3 install --break-system-packages pylibltc # --------------------------------------------------------- -# Step 5: Prepare Teensy 4.0 programming +# Step 3: Download and apply splash screen # --------------------------------------------------------- -echo "Step 5: Configuring Teensy programming environment..." -if [ ! -d "$HOME/teensy-firmware" ]; then - git clone https://github.com/cjfranko/ltc-to-serial-teensy.git "$HOME/teensy-firmware" -fi -cd "$HOME/teensy-firmware" -arduino-cli compile --fqbn arduino:avr:teensy40 . -arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:teensy40 . - -# --------------------------------------------------------- -# Step 6: Download and apply splash screen -# --------------------------------------------------------- -echo "Step 6: Downloading and applying custom splash screen..." +echo "Step 3: Downloading and applying splash screen..." cd /home/pi wget -O splash.png https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/splash.png + if [ -f splash.png ]; then sudo cp splash.png /usr/share/plymouth/themes/pix/splash.png sudo chmod 644 /usr/share/plymouth/themes/pix/splash.png - echo "✅ Splash screen updated." + echo "✅ Splash screen applied." else echo "⚠️ splash.png not found — skipping." fi # --------------------------------------------------------- -# Step 7: Enable systemd service +# Step 4: Download Teensy firmware and flash if available # --------------------------------------------------------- -echo "Step 7: Setting up systemd service..." -sudo cp timeturner.service /etc/systemd/system/ -sudo systemctl daemon-reload -sudo systemctl enable timeturner.service +echo "Step 4: Downloading firmware..." +cd /home/pi +wget -O ltc_audiohat_lock.ino.hex https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/firmware/ltc_audiohat_lock.ino.hex + +echo "Checking for connected Teensy 4.0..." +if ls /dev/ttyACM* 1> /dev/null 2>&1; then + echo "✅ Teensy detected. Flashing firmware..." + teensy-loader-cli --mcu=TEENSY40 -w -v ltc_audiohat_lock.ino.hex + echo "✅ Firmware uploaded successfully." +else + echo "⚠️ No Teensy detected on /dev/ttyACM* — firmware not flashed." +fi # --------------------------------------------------------- -# Final Message & Reboot +# Final Message # --------------------------------------------------------- +echo "" echo "─────────────────────────────────────────────" -echo " Setup Complete — Temporal alignment achieved." +echo " Setup Complete — Time magic is in place." echo "─────────────────────────────────────────────" -echo "Rebooting in 15 seconds to apply settings..." -sleep 15 -sudo reboot +echo "Teensy tools are installed, firmware is ready." +echo "Your Raspberry Pi is now ready for testing." +echo ""