Commit b54bc22
committed
Replace rpicam-still/rpicam-vid with picamera2 daemon, add WebSocket live stream
Single-process picamera2 daemon owns the camera and serves frames via shared
memory + Unix socket IPC. Three camera backends: picamera2 (preferred),
python3-libcamera (raw bindings), libcamera-still (subprocess fallback).
Camera backends (camera_backend.py):
- Picamera2Backend, LibcameraBackend, LibcameraStillBackend with auto-detection
- LibcameraBackend: control lookup via getattr(libcamera.controls, name)
- LibcameraStillBackend: capture lock, timeout wrapper, stale process cleanup,
sticky controls, fixed temp filenames, --awb off support
- requested_exposure/gain injected into metadata from pending controls
Daemon (picamera2_daemon.py):
- Backend-agnostic grab loop, set_backend hot-switch via IPC
- Watchdog thread: auto-restarts backend if grab loop stalls for 120s
- _last_applied tracks controls across frames for OSD synchronization
- _capture_time stamped for frame staleness detection
Stream and display:
- WebSocket preferred (works with gthread via flask-sock/simple-websocket)
- /api/stream/frame.jpg: single-frame polling with requestAnimationFrame pacing
- /api/stream/metadata: reads directly from daemon socket (no stale cache)
- allsky_player.js: _pollInFlight guard, frame_age warning display
- OSD shows requested exposure/gain rounded to 2 decimals
Dashboard camera controls (capture_buttons.js):
- Driver selector (picamera2/libcamera/libcamera-still)
- Auto-exposure toggle (TARGET_ADU_DISABLE) with config reload trigger
- Exposure slider loads from config DB (CCD_EXPOSURE_MAX), not live metadata
- Gain syncs from live metadata, exposure stays at user-set value
- Config saves via UPDATE (upsert), not INSERT, to prevent row proliferation
Config and capture:
- LIBCAMERA.BACKEND field, TARGET_ADU_DISABLE flag
- image.py: skip calculate_exposure when TARGET_ADU_DISABLE is set
- Slider updates CCD_EXPOSURE_MAX + all mode gains simultaneously
- Config level preserved on save, capture worker reload queued on changes
- PYTHONDONTWRITEBYTECODE=1 in systemd services1 parent a01df02 commit b54bc22
22 files changed
Lines changed: 4770 additions & 353 deletions
File tree
- indi_allsky
- camera
- flask
- static
- css
- js
- templates
- requirements
- service
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
0 commit comments