Flashing Guide

Quick reference for flashing LYNXcat and LYNXtower firmware.

Quick Start

# Flash tower (production)
./f tower 2

# Flash left cat (default: basic keys)
./f cat-l fk tk bn 2

# Flash right cat
./f cat-r fk tk bn 3

Cat Configuration

LYNXcat firmware requires specifying side and module configuration:

./f cat-{l|r} <finger> <thumb> <bottom> <port>

Command Structure

./f  cat-l   fk      tk      bn      2
│    │       │       │       │       │
│    │       │       │       │       └─ Port number (/dev/ttyACM2)
│    │       │       │       └───────── Bottom: bn/bm/bm-*/bg
│    │       │       └───────────────── Thumb: tk/tkj
│    │       └───────────────────────── Finger: fk/fkw
│    └───────────────────────────────── Target: cat-l or cat-r
└────────────────────────────────────── Flash script

Options

ArgumentOptionDescription
Targetcat-l, cat-rLeft or right keyboard half
Fingerfk4x6 key matrix only
fkw4x6 key matrix + scroll wheel
Thumbtk4x3 key matrix only
tkj4x3 key matrix + joystick
BottombnNo bottom module
bmMouse sensor (alias for bm-adns5050)
bm-adns5050ADNS-5050 optical sensor (500kHz bit-bang SPI)
bm-pmw3360PMW-3360 gaming sensor (placeholder)
bm-adns9800ADNS-9800 laser sensor (placeholder)
bgGyro (MPU-6050)

Examples

# MVP setup (both halves, keys only)
./f cat-l fk tk bn 2
./f cat-r fk tk bn 3

# Right with scroll wheel + mouse sensor (default ADNS-5050)
./f cat-r fkw tk bm 3

# Right with explicit mouse sensor variant
./f cat-r fkw tk bm-adns5050 3
./f cat-r fkw tk bm-pmw3360 3   # (placeholder)
./f cat-r fkw tk bm-adns9800 3  # (placeholder)

# Left with joystick + gyro
./f cat-l fk tkj bg 2

# Full featured right half
./f cat-r fkw tkj bm 3

Tower Modes

./f tower 2        # Production: RMK + USB HID (default, board selection only)
./f tower-test 2   # Test mode: ESP-NOW + logging (adds test feature)

Direct Cargo Commands

Build without flashing (inside container):

# Cat builds
cargo build -p cat --release --features "l,fk,tk,bn"
cargo build -p cat --release --features "r,fkw,tk,bm-adns5050"

# Tower builds
cargo build -p tower --release                        # Production (BPI-Leaf)
cargo build -p tower --release --features test        # Test mode (BPI-Leaf)

Port Detection

Find connected boards:

ls /dev/ttyACM*

The ./f script accepts port number only (e.g., 2 for /dev/ttyACM2).

Verify Correct Firmware

After flashing, connect to serial monitor to verify config:

# Monitor serial output (Ctrl+C to exit)
espmonitor /dev/ttyACM2

Look for startup banner with config:

✋ LYNXcat firmware starting...
🐱 Config: side=left, finger=fk, thumb=tk, bottom=bn

If config doesn't match expectation, reflash with correct features.

Troubleshooting

IssueSolution
Permission deniedRun on host: sudo usermod -aG dialout $USER, re-login
Device not in containerAdd --device=/dev/ttyACMX to podman command
Wrong config flashedCheck serial output, reflash with correct features
compile_error! "Must specify side"Use cat-l or cat-r (not just cat)
compile_error! "Cannot specify both"Remove conflicting features (e.g., don't use l,r)
Multiple mouse sensors specifiedUse only one: bm, bm-adns5050, bm-pmw3360, or bm-adns9800
Forgot which cat is which portUnplug one, check which /dev/ttyACM* disappears

Configuration Matrix

Valid combinations: 2 sides × 2 finger × 2 thumb × 5 bottom = 40 configs

Bottom options: bn (none), bm/bm-adns5050, bm-pmw3360, bm-adns9800, bg (gyro)

Common setups:

SetupLeftRight
MVPcat-l fk tk bncat-r fk tk bn
Standardcat-l fk tkj bgcat-r fkw tk bm
Fullcat-l fkw tkj bgcat-r fkw tkj bm-adns5050