MAKCU API
KM Host Protocol — v3.8 · Comprehensive command reference for the MAKCU ecosystem.
Transport & Framing
km.
and end withCRLF followed by the prompt>>>
.\r\n>>>
.- ASCII commands, e.g. move(10,-3), terminated by \r/\n/;
- Optional binary frame: DE AD <lenLE:2> <ASCII or binary payload>
- Format: km.payload\r\n>>>
- Setters echo the input as ACK unless suppressed byecho(0).
- Some streaming replies carry binary after the km. prefix:km.mouse<8 bytes> andkm.buttons<1-byte mask>. Lines still terminate with CRLF and the prompt.
Locks
Whole-axis locks (GET/SET)
km.lock_mx(0/1) >>>
km.lock_mx(0/1) >>>
Directional locks (GET/SET)
km.lock_my+(0/1) >>>
km.lock_my-(0/1) >>>
Motion
move(x,y[,seg][,cx1,cy1[,cx2,cy2]]) — SET
x,y: int16; seg ≥ 1 (default 1, max 512); optional cubic Bézier controls. If only segments are provided (no control points), a random 2-point control curve is generated. If only (cx1,cy1) is provided it is duplicated.
km.move(10,-3) >>>
km.move(100,50,8,40,25,80,10) >>>
Both return the input echo (ACK).
moveto(X,Y[,seg][,cx1,cy1[,cx2,cy2]]) — SET
Clamped to screen; queued as absolute (internally relative). Special: moveto(0,0) with seg=1 and no controls triggers calibration.
km.moveto(640,360) >>>
wheel(w) — SET
km.wheel(-5) >>>
Echo ACK.
silent(x,y) — SET
km.silent(400,300) >>>
Echo ACK.
Streaming
Axis streaming (GET/SET)
km.axis(rel,25) >>>
Returns the resolved mode and current period.
km.axis(act,1) >>>
ACK returns the normalized pair (mode,period); not a verbatim echo; honors echo(0|1).
Mouse composite streaming (GET/SET)
km.mouse(mut,25) >>>
km.mouse(raw,10) >>>
ACK returns normalized (mode,period); honors echo.
While enabled, device emits one fixed-length binary frame per event:
km.mouse<bytes> >>>
Bytes follow the ASCII prefix directly; line still ends with CRLF and the prompt.
- mask: u8 — button bitmask
- x: int16 — X delta/position*
- y: int16 — Y delta/position*
- wheel: int8 — vertical wheel
- pan: int8 — horizontal wheel (tilt-wheel)
- tilt: int8 — additional tilt/aux axis
*Raw: x/y are raw deltas. Mut: post-edit effective. If km.axis(abs) is active, x/y are absolute, clamped to screen.
Non-applicable fields are encoded as 00 to preserve spacing.
km.mouse 07 00 05 00 FB FF 01 FF 00 >>>
mask=0x07, x=+5 (05 00), y=-5 (FB FF), wheel=+1 (01), pan=-1 (FF), tilt=0 (00)
Position & Screen
getpos() — GET
km.(123,456) >>>
Absolute position (clamped to screen(W,H)).
screen() / screen(W,H) — GET/SET
km.screen(1920,1080) >>>
km.screen(2560,1440) >>>
Baud rate
Baud rate (GET/SET)
km.baud(115200) >>>
Returns current baud rate.
km.baud(921600) >>>
Applies immediately; host must re-open serial at new speed.
km.baud(0) >>>
Resets to default 115200 baud.
Baud rate change (Binary)
DE AD 05 00 A5 00 C2 01 00
Breakdown: DE AD | 05 00(len=5) | A5 (cmd) |00 C2 01 00 (115200 LE)
Limits & Parsing
- Bézier segments: default 1, max 512
- Movement integers: int16 with saturation
- Wheel: int8
- Legacy ASCII terminators: \r, \n, ;
- Binary RX supported: DE AD <lenLE> <payload>
- echo(0) suppresses most setter echoes; GETs still reply
- Baud range (baud()): 115200–4000000; baud(0) resets to 115200.