Skip to content

Commit 402b6c8

Browse files
authored
Merge pull request #13 from openmv/update_readme
docs: Update Readme and docs.
2 parents b07938c + 9470d67 commit 402b6c8

File tree

2 files changed

+579
-65
lines changed

2 files changed

+579
-65
lines changed

README.md

Lines changed: 61 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,66 @@ pip install openmv
1010

1111
## CLI Usage
1212

13-
### Stream Video
13+
### Examples
1414

1515
```bash
16-
# Stream from specific port
16+
# Basic usage - stream video from camera
1717
openmv --port /dev/ttyACM0
1818

1919
# Run a custom script
20-
openmv --script my_script.py
20+
openmv --port /dev/ttyACM0 --script my_script.py
2121

22-
# Adjust display scale
23-
openmv --scale 2
22+
# Adjust display scale (default is 4x)
23+
openmv --port /dev/ttyACM0 --scale 2
2424

25-
# Enable firmware symbols
26-
openmv --firmware path/to/firmware.elf
27-
```
25+
# Run throughput benchmark
26+
openmv --port /dev/ttyACM0 --bench
2827

29-
### Benchmark Mode
28+
# Load firmware symbols for profiler function names
29+
openmv --port /dev/ttyACM0 --firmware build/firmware.elf
3030

31-
```bash
32-
openmv --bench
33-
```
31+
# Quiet mode (suppress script output)
32+
openmv --port /dev/ttyACM0 --quiet
3433

35-
### Controls (Stream Mode)
34+
# Debug mode (verbose logging)
35+
openmv --port /dev/ttyACM0 --debug
36+
```
3637

37-
- `ESC` - Exit
38-
- `P` - Cycle profiler overlay (Off → Performance → Events)
39-
- `M` - Toggle profiler mode (Inclusive ↔ Exclusive)
40-
- `R` - Reset profiler counters
38+
### Options
39+
40+
| Option | Default | Description |
41+
|--------|---------|-------------|
42+
| `--port PORT` | `/dev/ttyACM0` | Serial port |
43+
| `--script FILE` | None | MicroPython script file to execute |
44+
| `--scale N` | 4 | Display scaling factor |
45+
| `--poll MS` | 4 | Poll rate in milliseconds |
46+
| `--bench` | False | Run throughput benchmark mode |
47+
| `--timeout SEC` | 1.0 | Protocol timeout in seconds |
48+
| `--baudrate N` | 921600 | Serial baudrate |
49+
| `--firmware FILE` | None | Firmware ELF file for profiler symbol resolution |
50+
| `--quiet` | False | Suppress script output text |
51+
| `--debug` | False | Enable debug logging |
52+
53+
#### Protocol Options
54+
55+
| Option | Default | Description |
56+
|--------|---------|-------------|
57+
| `--crc BOOL` | true | Enable CRC validation |
58+
| `--seq BOOL` | true | Enable sequence number validation |
59+
| `--ack BOOL` | true | Enable packet acknowledgment |
60+
| `--events BOOL` | true | Enable event notifications |
61+
| `--max-retry N` | 3 | Maximum number of retries |
62+
| `--max-payload N` | 4096 | Maximum payload size in bytes |
63+
| `--drop-rate N` | 0.0 | Packet drop simulation rate (0.0-1.0, for testing) |
64+
65+
### Keyboard Controls
66+
67+
| Key | Action |
68+
|-----|--------|
69+
| `ESC` | Exit |
70+
| `P` | Cycle profiler overlay (Off → Performance → Events) |
71+
| `M` | Toggle profiler mode (Inclusive ↔ Exclusive) |
72+
| `R` | Reset profiler counters |
4173

4274
## Library Usage
4375

@@ -78,58 +110,22 @@ with Camera('/dev/ttyACM0') as camera:
78110

79111
## API Reference
80112

81-
### Camera
113+
See [docs/api.md](docs/api.md) for full API documentation.
82114

83-
Main class for camera communication.
115+
### Quick Reference
84116

85117
```python
86-
Camera(
87-
port, # Serial port (e.g., '/dev/ttyACM0')
88-
baudrate=921600, # Serial baudrate
89-
crc=True, # Enable CRC validation
90-
seq=True, # Enable sequence number validation
91-
ack=True, # Enable packet acknowledgment
92-
events=True, # Enable event notifications
93-
timeout=1.0, # Protocol timeout in seconds
94-
max_retry=3, # Maximum retries
95-
max_payload=4096, # Maximum payload size
96-
drop_rate=0.0, # Packet drop simulation (testing only)
97-
)
98-
```
99-
100-
#### Methods
101-
102-
**Connection Management:**
103-
- `connect()` / `disconnect()` - Manage connection
104-
- `is_connected()` - Check connection status
118+
from openmv import Camera, OMVException, TimeoutException
105119

106-
**Script Execution:**
107-
- `exec(script)` - Execute a MicroPython script
108-
- `stop()` - Stop the running script
109-
110-
**Video Streaming:**
111-
- `streaming(enable, raw=False, res=None)` - Enable/disable video streaming
112-
- `read_frame()` - Read a video frame (returns dict with width, height, format, depth, data, raw_size)
113-
114-
**Output and Status:**
115-
- `read_stdout()` - Read script output text
116-
- `read_status()` - Poll channel status (returns dict of channel readiness)
117-
118-
**Channel Operations:**
119-
- `has_channel(name)` - Check if a channel exists
120-
- `channel_read(name, size=None)` - Read data from a custom channel
121-
- `channel_write(name, data)` - Write data to a custom channel
122-
- `channel_size(name)` - Get size of available data in a channel
123-
124-
**Profiler (if available):**
125-
- `read_profile()` - Read profiler data
126-
- `profiler_mode(exclusive)` - Set profiler mode (inclusive/exclusive)
127-
- `profiler_reset(config=None)` - Reset profiler counters
128-
- `profiler_event(counter_num, event_id)` - Configure event counter
129-
130-
**System Information:**
131-
- `system_info()` - Get camera system information
132-
- `host_stats()` / `device_stats()` - Get protocol statistics
120+
with Camera('/dev/ttyACM0') as camera:
121+
camera.stop() # Stop running script
122+
camera.exec(script) # Execute script
123+
camera.streaming(True) # Enable streaming
124+
frame = camera.read_frame() # Read video frame
125+
text = camera.read_stdout() # Read script output
126+
status = camera.read_status() # Poll channel status
127+
info = camera.system_info() # Get system info
128+
```
133129

134130
### Exceptions
135131

0 commit comments

Comments
 (0)