Skip to content

Commit d503b3a

Browse files
marcodejonghclaude
andauthored
Add configurable board settings to Docker container (#263)
* Add configurable board settings to Docker container - Add environment variables for board configuration (BOARD_NAME, BOARD_LAYOUT, BOARD_SIZE, BOARD_SET, BOARD_ANGLE) - Update Python webservice to use environment variables for redirect URL construction - Add comprehensive documentation for board configuration options - Include guidance on finding board settings from BoardSesh URLs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Implement code cleanup and fix board configuration issues ## Code Cleanup & Bug Fixes: - Remove unused imports (ssl, threading, FileResponse, StaticFiles) from main.py - Remove unused STATIC_PATH variable - Fix critical bug in bluetooth_controller.py (missing led_controller parameter) - Remove unused boardsesh_client.py file (232 lines of dead code) - Replace hardcoded "kilter" board names with environment variables - Improve error handling with specific exceptions instead of bare except clauses - Clean up unused database columns from sessions table - Add database cleanup routines for old cache and session data ## Board Configuration Improvements: - Update README with correct URL slug format for board configurations - Document proper Kilter board sets: bolt, screw, screw_bolt - Document proper Tension board sets: plastic, wood, plastic_wood - Document Tension layout naming: two-mirror, two-spray for 2.0 layouts - Add comprehensive examples with correct environment variable usage - Explain how users can find their configuration from BoardSesh URLs ## Technical Improvements: - Replace placeholder API endpoint with proper health check - Add automatic cleanup of orphaned queue items on startup - Improve WebSocket connection error handling - Add proper logging for cache operations - All Python files now pass syntax validation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent e877b91 commit d503b3a

File tree

5 files changed

+164
-263
lines changed

5 files changed

+164
-263
lines changed

board-controller/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,72 @@ SQLite database is created automatically with tables:
136136
- `DB_PATH` - Database file path (default: ./board_controller.db)
137137
- `CACHE_TTL_HOURS` - API cache TTL (default: 24)
138138

139+
#### Board Configuration
140+
141+
These environment variables control the default board configuration for the redirect URL when accessing the controller root endpoint:
142+
143+
- `BOARD_NAME` - Board type: `kilter` or `tension` (default: kilter)
144+
- `BOARD_LAYOUT` - Board layout name (varies by board, default: original)
145+
- `BOARD_SIZE` - Board size (varies by board, default: 12x12)
146+
- `BOARD_SET` - Holds set (varies by board, default: screw_bolt)
147+
- `BOARD_ANGLE` - Board angle: 0-70 in 5-degree increments (default: 40)
148+
149+
**How to Find Your Board Configuration:**
150+
151+
The easiest way to determine your board's configuration is to look at your BoardSesh URL when you navigate to your specific board setup. The URL follows this pattern:
152+
153+
```
154+
https://www.boardsesh.com/{board_name}/{layout}/{size}/{set}/{angle}/list
155+
```
156+
157+
For example:
158+
- `https://www.boardsesh.com/kilter/original/12x12/screw_bolt/40/list`
159+
- `https://www.boardsesh.com/tension/1/8x12/TB2-plastic/30/list`
160+
161+
**Available Options by Board:**
162+
163+
**Kilter Board:**
164+
- **Board Name**: `kilter`
165+
- **Layouts**: URL-friendly layout names:
166+
- `original` (most common layout)
167+
- **Sizes**: Board dimensions as URL slugs:
168+
- `12x12`, `8x10`, `16x12` (standard board sizes)
169+
- **Sets**: Hold set names as URL slugs:
170+
- `bolt`, `screw` (individual hold types)
171+
- `screw_bolt` (both hold types combined, sorted alphabetically descending)
172+
- **Angles**: `0`, `5`, `10`, `15`, `20`, `25`, `30`, `35`, `40`, `45`, `50`, `55`, `60`, `65`, `70`
173+
174+
**Tension Board:**
175+
- **Board Name**: `tension`
176+
- **Layouts**: URL-friendly layout names:
177+
- `1`, `2`, `3`, ..., `28` (for numbered layouts)
178+
- `two-mirror`, `two-spray` (for layouts that start with "2-" in database)
179+
- **Sizes**: Board dimensions as URL slugs:
180+
- `8x10`, `8x12`, `12x10`, `12x12`
181+
- **Sets**: Hold set names as URL slugs:
182+
- `plastic`, `wood` (individual hold types)
183+
- `plastic_wood` (both hold types combined)
184+
- **Angles**: `0`, `5`, `10`, `15`, `20`, `25`, `30`, `35`, `40`, `45`, `50`, `55`, `60`, `65`, `70`
185+
186+
**Note**: The exact available options depend on your specific board configuration and what hold sets you have installed. Visit BoardSesh.com and navigate to your board to see the exact URL parameters for your setup.
187+
188+
**Example configurations:**
189+
```bash
190+
# Kilter 12x12 with screw and bolt holds at 45 degrees
191+
BOARD_NAME=kilter
192+
BOARD_LAYOUT=original
193+
BOARD_SIZE=12x12
194+
BOARD_SET=screw_bolt
195+
BOARD_ANGLE=45
196+
197+
# Tension 8x12 with plastic holds at 30 degrees
198+
BOARD_NAME=tension
199+
BOARD_LAYOUT=two-mirror
200+
BOARD_SIZE=8x12
201+
BOARD_SET=plastic
202+
BOARD_ANGLE=30
203+
```
204+
139205
### Command Line Options
140206

141207
```bash

board-controller/bluetooth_controller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ def _run_bluetooth_service(self):
143143

144144
# Create custom RX characteristic that uses our message buffer
145145
class CustomRxCharacteristic(SimpleRxCharacteristic):
146-
def __init__(self, bus, index, service, message_buffer):
147-
super().__init__(bus, index, service, self.led_controller)
146+
def __init__(self, bus, index, service, message_buffer, led_controller):
147+
super().__init__(bus, index, service, led_controller)
148148
self.message_buffer = message_buffer
149149

150150
uart_service = UartService(bus, 0)
151151
uart_service.characteristics[0] = CustomRxCharacteristic(
152-
bus, 0, uart_service, self.message_buffer
152+
bus, 0, uart_service, self.message_buffer, self.led_controller
153153
)
154154

155155
app.add_service(uart_service)

board-controller/boardsesh_client.py

Lines changed: 0 additions & 232 deletions
This file was deleted.

board-controller/docker-compose.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ services:
1212
environment:
1313
- DB_PATH=/app/data/board_controller.db
1414
- LOG_LEVEL=INFO
15+
# Board configuration for redirect URL
16+
# BOARD_NAME: kilter, tension
17+
# BOARD_LAYOUT: varies by board (e.g., original for kilter)
18+
# BOARD_SIZE: varies by board (e.g., 12x12, 8x10, 16x12, etc.)
19+
# BOARD_SET: varies by board (e.g., screw_bolt, bolt_on, plastic, wood, etc.)
20+
# BOARD_ANGLE: 0-70 in 5-degree increments
21+
- BOARD_NAME=kilter
22+
- BOARD_LAYOUT=original
23+
- BOARD_SIZE=12x12
24+
- BOARD_SET=screw_bolt
25+
- BOARD_ANGLE=40
1526
restart: unless-stopped
1627

1728
# For Bluetooth support (Linux hosts only)
@@ -31,6 +42,17 @@ services:
3142
environment:
3243
- DB_PATH=/app/data/board_controller.db
3344
- LOG_LEVEL=INFO
45+
# Board configuration for redirect URL
46+
# BOARD_NAME: kilter, tension
47+
# BOARD_LAYOUT: varies by board (e.g., original for kilter)
48+
# BOARD_SIZE: varies by board (e.g., 12x12, 8x10, 16x12, etc.)
49+
# BOARD_SET: varies by board (e.g., screw_bolt, bolt_on, plastic, wood, etc.)
50+
# BOARD_ANGLE: 0-70 in 5-degree increments
51+
- BOARD_NAME=kilter
52+
- BOARD_LAYOUT=original
53+
- BOARD_SIZE=12x12
54+
- BOARD_SET=screw_bolt
55+
- BOARD_ANGLE=40
3456
restart: unless-stopped
3557
command: ["python", "main.py", "--no-bluetooth", "--host", "0.0.0.0", "--port", "8000"]
3658
profiles:

0 commit comments

Comments
 (0)