#!/bin/bash # ESP32-S3-LCD-1.3 Upload and Monitor Helper Script echo "================================================" echo "ESP32-S3-LCD-1.3 Upload and Monitor" echo "================================================" echo "" # Colors for output GREEN='\033[0;32m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' # No Color # Step 1: Build echo -e "${YELLOW}[1/3] Building firmware...${NC}" if pio run; then echo -e "${GREEN}✓ Build successful!${NC}\n" else echo -e "${RED}✗ Build failed!${NC}" exit 1 fi # Step 2: Upload echo -e "${YELLOW}[2/3] Uploading to board...${NC}" if pio run --target upload; then echo -e "${GREEN}✓ Upload successful!${NC}\n" else echo -e "${RED}✗ Upload failed!${NC}" echo "" echo "Troubleshooting:" echo " - Check USB cable is connected" echo " - Check device appears in: pio device list" echo " - Try pressing BOOT button while uploading" echo " - Check USB cable supports data transfer" exit 1 fi # Wait a moment for the device to reset echo "Waiting for device to reset..." sleep 2 # Step 3: Monitor echo -e "${YELLOW}[3/3] Starting serial monitor...${NC}" echo -e "${GREEN}Monitor at 115200 baud. Press Ctrl+C to exit.${NC}\n" echo "================================================" echo "" pio device monitor