lpf2.local
Ports driven directly by local hub UART (built-in hub sockets).
port = lpf2.port on local LPF2 UART transport.
Instances live in C++, exposed via board module (e.g. hub.ports.A).
Classes
Description of one LPF2 device mode (parsed from Port Mode Info). |
|
Local (on-hub) LPF2 port. |
Package Contents
- class lpf2.local.mode[source]
Description of one LPF2 device mode (parsed from Port Mode Info).
Combines the mode’s name, value range (raw/PCT/SI), I/O mapping flags, dataset layout and the latest raw payload received on the mode.
- class lpf2.local.port[source]
Bases:
lpf2.portLocal (on-hub) LPF2 port.
Same public API as
lpf2.port; explicit subclass so isinstance checks distinguish local from virtual / remote ports.- getDeviceType() int[source]
Reported LPF2 device type (see
lpf2.device_type).
- getValue(mode: int, dataSet: int) float[source]
Parsed value of dataset
dataSetofmode. Format (int8/16/32/float) taken from mode descriptor.
- getValueStr(mode: int) str[source]
Human-readable value of
modeformatted per mode’s figures/decimals.
- gotoAbsPosition(absPos: int, speed: int = 100, maxPower: int = 100, endState: int = 0, useProfile: int = 0) None[source]
Move motor to absolute encoder position
absPosatspeed(0..100) then applyendState.
- setAccTime(time: int, profile: int) None[source]
Set acceleration time (ms) and profile for the motor.
- setDecTime(time: int, profile: int) None[source]
Set deceleration time (ms) and profile for the motor.
- setMode(mode: int, delta: float = 1.0) int[source]
Select active input mode.
delta= minimum raw-unit change that triggers value-change callback (0 = every update). Returns 0 on success.
- setModeCombo(idx: int, deltas: Sequence[float] = ()) int[source]
Activate one of the device’s mode combinations.
deltas= per-mode thresholds in bitmask order; empty = default of 1. Returns 0 on success.
- setRgbColor(r: int, g: int, b: int) None[source]
Set RGB LED by explicit RGB (0..255, uses mode 1).
- setRgbColorIdx(idx: int) None[source]
Set RGB LED by
lpf2.colorindex (uses mode 0).
- startPower(pw: int) None[source]
Set motor power.
pwin [-100..100]: negative = CCW, positive = CW.
- startSpeed(speed: int = 100, maxPower: int = 100, useProfile: int = 0) None[source]
Run motor at
speed(-100..100).maxPowercaps commanded power (0..100).useProfileselects acc/dec profiles (low nibble = acc, next nibble = dec).
- startSpeedForDegrees(degrees: int, speed: int = 100, maxPower: int = 100, endState: int = 0, useProfile: int = 0) None[source]
Move motor by
degrees(positive; direction fromspeedsign) then applyendState.