Commit Graph

46 Commits

Author SHA1 Message Date
0c6ccb90af Fix sound service audio device handling and revert to simple configuration
- Modified sound.py to handle audio device errors gracefully with retry loop
- Reverted lighting-sound.service to simple configuration without complex dependencies
- Sound service now working reliably with beat detection at ~147 BPM
- Both lighting-control and lighting-sound services running successfully at boot
2025-10-04 10:01:29 +13:00
8ad7f41d77 Add new pattern 'alternating_pulse' (ap): odd beat pulses color1 on odd bars, even beat pulses color2 on even bars; preserve existing alternating_phase; compact payloads and white guard retained 2025-10-04 01:58:02 +13:00
dc6d48a44b alternating_phase: compact per-bar overrides to stay <230 bytes; swap grouping flip; avoid pure white by sending 254,254,254 to work around strip edge-cases; add API logging improvements 2025-10-04 01:44:05 +13:00
43feb5938f backend: per-pattern parameters (n1-n4, delay) with persistence; REST responses include loaded params; logging of API inputs; alternating_phase: alternate colors between selected palette color 1/2 across bars with compact payload under 230 bytes; docs: add PER_PATTERN_PARAMETERS.md 2025-10-04 01:10:40 +13:00
Pi User
6f9133b43e Add complete REST API for lighting control
- Migrated from websockets to aiohttp for unified HTTP/WebSocket server
- Added REST endpoints: /api/pattern, /api/parameters, /api/state, /api/tempo/reset
- Implemented color palette API with 8-slot system and selected colors
- First selected color (index 0) is used as primary RGB for patterns
- All operations now available via simple HTTP requests (no WebSocket needed)
- Added comprehensive documentation: FRONTEND_API.md, COLOR_PALETTE_API.md
- Added test scripts: test_rest_api.sh, test_color_patterns.py
- Updated test/test_control_server.py for new /ws WebSocket path
- Configuration persistence via lighting_config.json
- Pattern parameters (n1-n4, brightness, delay) controllable via API
- WebSocket still available at /ws for legacy support
2025-10-03 23:38:54 +13:00
Pi User
aa9f892454 Add CONTROL_SERVER_HOST to allow external connections
- Add CONTROL_SERVER_HOST environment variable (default: 0.0.0.0)
- Server now binds to all interfaces by default for external access
- Update .env and .env.example with new host configuration
- Allows UI clients to connect from other machines on the network
2025-10-03 20:24:20 +13:00
Pi User
e78a8727b2 Add .env support for transport and sound device configuration
- Add python-dotenv support to control_server.py and sound.py
- Load TRANSPORT from environment variable (default: spi)
- Load AUDIO_INPUT_DEVICE from environment variable (default: 7)
- Load all port configurations from environment variables
- Update .env.example with comprehensive configuration options
- Create .env file with sensible defaults for Pi
- Transport, sound device, and network settings now configurable via .env
2025-10-03 20:19:55 +13:00
Pi User
fbf4205c87 Update .env.example to use wlan0 IP as default
- Set CONTROL_SERVER_URI to ws://10.42.0.1:8765 (wlan0 IP)
- Better default for remote connections from desktop
- Add comments for localhost and custom IP options
2025-10-03 20:14:19 +13:00
Pi User
8f183b284c Add .env support for test scripts
- Update test_control_server.py to use python-dotenv
- Read CONTROL_SERVER_URI from environment variable
- Create .env.example with configuration examples
- Test scripts now respect .env configuration for WebSocket URI
2025-10-03 20:13:25 +13:00
Pi User
e4a83e8f0d Add segmented_movement pattern with n4 parameter support
- Add n4 parameter to control server, LED bar receiver, and test script
- Create segmented_movement pattern with alternating forward/backward movement
- Pattern supports n1 (segment length), n2 (spacing), n3 (forward speed), n4 (backward speed)
- Fix test script to send all messages instead of just the first one
- Add segmented_movement to patterns_needing_params for proper parameter transmission
- Pattern intelligently handles all cases: alternating, forward-only, backward-only, or static
- Implements repeating segments with configurable spacing across LED strip
2025-10-03 19:54:43 +13:00
Pi User
f4e9f8fff7 fix: prioritize delay_change in control server test 2025-10-02 20:49:20 +13:00
Pi User
d57fce77fb update: misc changes 2025-10-01 23:31:00 +13:00
Pi User
fbeb365932 pipenv: add sound-run; sound.py: --input-device flag 2025-10-01 23:31:00 +13:00
Pi User
ed35d6b838 pipenv: add send-net; networking: use SPI; add networking test 2025-10-01 23:31:00 +13:00
Pi User
f9188b694e ESP32 SPI/ESP-NOW working; add watch scripts; sender colors RGB 2025-10-01 22:56:24 +13:00
Pi User
1844a2e4c5 Update SPI JSON sender to led-bar format: {"settings":{...}, "save":false} and tooling scripts 2025-10-01 21:34:29 +13:00
Pi User
5a05ee99a1 Add ESP32-C3 SPI slave with ESP-NOW, Raspberry Pi test tools, and updated project structure
- ESP32-C3 SPI slave project with ESP-NOW broadcast functionality
- Raspberry Pi SPI master test tools and CLI for JSON communication
- Merged src/ directory from full branch with lighting controller code
- Updated Pipfile with system install scripts and ESP32 monitoring
- Added comprehensive test suite for SPI communication
2025-10-01 21:08:28 +13:00
Pi User
aa9b5bb324 Merge full branch: bring in src/ directory and update project structure 2025-10-01 20:48:28 +13:00
937fb1f2f9 Separate UI and control logic with WebSocket communication
- Create UI client (src/ui_client.py) with MIDI controller integration
- Create control server (src/control_server.py) with lighting logic
- Implement WebSocket protocol between UI and control server
- Add startup script (start_lighting_controller.py) for all components
- Update Pipfile with new scripts for separated architecture
- Add comprehensive documentation (README_SEPARATED.md)
- Fix LED connection stability with heartbeat mechanism
- Fix UI knob display and button highlighting
- Maintain backward compatibility with existing MIDI mappings
2025-09-28 12:36:25 +13:00
ed5bbb8c18 Add MIDI device persistence functionality
- Add configuration file system to remember MIDI device selection
- Load saved MIDI device preference on application startup
- Automatically save MIDI device selection when changed
- Handle device disconnection gracefully with fallback
- Smart initialization with validation and error handling
- Create config.json for storing device preferences
- Improve user experience by eliminating need to re-select device
2025-09-27 23:29:06 +12:00
f9c3d08b0f Add MIDI controller dropdown selection
- Add MIDI port detection and listing functionality
- Create dropdown widget for MIDI controller selection in GUI
- Implement dynamic MIDI controller switching without restart
- Add refresh button to scan for new MIDI devices
- Add status indicator showing connection status
- Add comprehensive error handling for MIDI operations
- Fix initialization timing issues with GUI widgets
- Support graceful fallback when no MIDI devices available
2025-09-27 23:11:42 +12:00
e5cf15d7b0 Fix rainbow pattern step range in lighting controller
- Change step calculation from beat_index % 2 to beat_index % 256
- Provides full 0-255 step range for rainbow pattern color cycling
- Fixes rainbow pattern that was limited to only 0 or 1 step values
- Alternating phase patterns still use % 2 for proper phase offset
2025-09-19 01:29:08 +12:00
c40b5629bf Fix pattern highlighting in lighting controller GUI
- Add pattern name mapping to translate between MIDI handler names and GUI display names
- Fixes highlighting for patterns with underscores (sequential_pulse, alternating_phase, n_chase)
- Now properly highlights selected patterns in the button grid
2025-09-19 01:15:29 +12:00
a4a00021d8 Fix missing n3 attribute and async function issue
- Add missing self.n3 = 1 attribute to MidiHandler initialization
- Fix update_rgb async function to properly yield control with await asyncio.sleep(0)
- Resolves TypeError about expecting coroutine but getting None
- Application now working properly with buttons and dials functional
2025-09-19 00:07:37 +12:00
f2dcdabf29 Fix indentation errors and reduce debug output
- Comment out all debug logging statements to reduce console noise
- Fix empty if/else blocks by adding pass statements
- Remove beat logging, TCP server logging, and MIDI debug messages
- Keep only essential info, warning, and error messages
- Revert radiate delay separation back to using main delay parameter
2025-09-19 00:02:51 +12:00
5f7db51851 Add rate-limited parameter updates and message type system
- Rate limit parameter updates to 100ms minimum interval
- Send immediate updates if rate limit allows, otherwise queue
- Process pending updates during beat handling
- All knob changes (CC30-37) now trigger parameter updates
- Add message type field: 'b' for beats, 'u' for updates
- Optimize message type to single letters to save packet space
- Prevents ESP-NOW network flooding during rapid knob adjustments
- All packets stay under 230-byte limit with automatic splitting
2025-09-18 22:11:17 +12:00
fcbe9e9094 Implement full parameter sending on pattern change and periodic updates
- Send all parameters when pattern changes (may require 2 packets if >200 bytes)
- Send periodic parameter updates every 8 beats to keep bars synchronized
- Beat packets remain minimal for performance
- All packets stay under 230-byte limit
2025-09-18 21:58:39 +12:00
36dfda74b2 Update GUI layout and MIDI CC mappings: CC36=n3, CC37=delay, remove B1/B2 references 2025-09-18 20:35:31 +12:00
8d0c9edf5d ws: adopt nested {'0': {...}} payloads
midi: bind patterns to notes 36+; beat triggers selected pattern; include n index; CC map: 30=R 31=G 32=B 33=brightness 34=n1 35=n2 36=delay; send n1/n2 raw 0-127

gui: show n1 and n2 in status
2025-09-17 20:22:11 +12:00
1da2e30d4c midi: init read of CCs on startup (delay, brightness, RGB, beat enable); track bpm/pattern for GUI\nmain: integrate MidiHandler; add status panel for delay/brightness/RGB/pattern/BPM 2025-09-14 05:23:46 +12:00
9ff38aa875 midi: add CC29 tempo reset, CC37 brightness; local beat flag; logging\nsound: add control server with RESET_TEMPO; logging; always send BPM 2025-09-14 04:53:24 +12:00
3b869851b8 Add patterns 2025-09-09 21:40:27 +12:00
ddbf4a00f4 Add run script 2025-09-08 23:17:50 +12:00
9fc58a827b Move to src. Add midi and sound 2025-09-07 21:15:42 +12:00
b77b29415c Make colors bigger and add more Y padding 2025-07-12 14:21:33 +12:00
5b248a5726 Add temple of techno settings 2025-07-12 10:38:54 +12:00
62611c73c9 Add extra patterns that use a single color 2025-07-12 10:38:33 +12:00
f7f7acbdbf Intial version 2025-07-12 01:18:04 +12:00
c77fd30f8f Done a heap 2025-07-12 00:55:30 +12:00
65774837c7 Change to websocket 2025-07-11 21:33:50 +12:00
f302be85c0 Use Pipenv 2025-07-11 21:33:13 +12:00
910c225542 Inital working version 2025-05-18 22:10:14 +12:00
9d35fb5002 Add config 2025-01-04 19:44:13 +13:00
cc45c919f5 Ignore venv, pycache and config 2025-01-04 19:43:23 +13:00
161fd5e12f Add multiple servers 2024-08-30 17:35:26 +12:00
d1b9de736f Initial commit 2024-08-30 17:23:16 +12:00