#!/bin/bash # Quick start script for developing custom IR protocols echo "==========================================" echo "Custom IR Protocol Development Tool" echo "==========================================" echo "" # Check if we're on a Raspberry Pi if ! command -v python3 &> /dev/null; then echo "Error: Python3 not found. Please install Python3." exit 1 fi # Check if RPi.GPIO is available python3 -c "import RPi.GPIO" 2>/dev/null if [ $? -ne 0 ]; then echo "Warning: RPi.GPIO not available. This script is designed for Raspberry Pi." echo "You can still use the analysis tools, but hardware testing won't work." echo "" fi echo "This tool will help you develop a custom IR protocol decoder." echo "" echo "Steps:" echo "1. Capture raw IR signals from your unknown remote" echo "2. Analyze the signal patterns" echo "3. Customize the protocol decoder" echo "4. Test and integrate with your IR system" echo "" read -p "Do you want to start with signal capture? (y/n): " -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]]; then echo "" echo "Starting IR signal analyzer..." echo "Point your unknown remote at the IR receiver and press buttons." echo "Press Ctrl+C when done capturing signals." echo "" python3 ir_signal_analyzer.py --gpio-pin 18 --verbose echo "" echo "Signal capture complete!" echo "" # Check if analysis file was created if ls ir_analysis_*.json 1> /dev/null 2>&1; then echo "Analysis file created. Now you can:" echo "1. Review the analysis results" echo "2. Customize custom_ir_protocol.py with your timing constants" echo "3. Run the integration script" echo "" read -p "Do you want to run the integration script now? (y/n): " -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]]; then echo "" echo "Running integration script..." python3 integrate_custom_protocol.py echo "" echo "Integration complete!" echo "" echo "Next steps:" echo "1. Edit custom_ir_protocol.py with your timing constants" echo "2. Update custom_ir_mapping.json with your command mappings" echo "3. Test with: python3 test_custom_protocol.py" echo "4. Test with real remote: python3 simple_ir_listener_polling.py" fi else echo "No analysis file was created. Please check your IR receiver setup." fi else echo "" echo "Available tools:" echo "1. ir_signal_analyzer.py - Capture and analyze IR signals" echo "2. custom_ir_protocol.py - Template for custom protocol decoder" echo "3. integrate_custom_protocol.py - Integrate custom protocol into system" echo "4. protocol_development_guide.md - Detailed development guide" echo "" echo "Run this script again when you're ready to start signal capture." fi echo "" echo "For detailed instructions, see protocol_development_guide.md" echo "=========================================="