LYNX: set up the throttle, the speed and the maps
Applies to
A motor controller running LYNX (swid contains _LYNX_), after the motor identification playbook has finished with its power cycle. It follows the steps of the LYNX wizard that come after identification.
Before you start
- The rules of the general method and the setup rules of the motor identification playbook ("Before you start") apply: propose each step, run it after the user's yes, check every result.
- Levels: writes,
stopandsave -yneed Allow writes;runneeds Allow dangerous commands (it lets the throttle drive the motor). - Service login. The throttle, IO and speed parameters are hidden without it. The user enters the LYNX service login from the credentials page in Launchpad's options, where it is remembered (entered in emGUI it is lost when emGUI closes), then starts emGUI again from Launchpad. Never ask for the password in the chat. Logged in:
/odothrcan be read. - Vehicle lifted, the wheel free to turn, from step 3 on.
Steps
1. State
/driver/error and /common/error 0; /driver/motor/Rt not 0 (identified; otherwise the motor identification playbook first). /driver/motor/pp: the motor's pole pairs. The default 1 is rarely right and the speed reading depends on it: ask the user and set it. save -y.
2. Throttle input
The throttle is read on GPIO0: /io/IN_acc 8,0 (the default) and /common/ioconf0 0 (no pull resistor). Different values: ask whether the throttle is wired elsewhere (basic throttle).
3. Throttle range
Tell the user: we measure the released and the full throttle so that LYNX knows the range.
stop- the motor stays still while the throttle moves.- Throttle released: read
/acc/asc/in(mV) two or three times; propose it for/acc/asc/min. - Full throttle: read
/acc/asc/in; propose it for/acc/asc/max. - The two must be clearly apart. Equal or nearly equal values mean the throttle does not reach the input (wiring, its +5 V supply,
/common/gpio0not changing): never write them, because an invalid throttle signal can disarm LYNX until the next power cycle. A throttle that reads higher when released is fine (minabovemax). - Throttle released, then
run. LYNX arms once the throttle has stayed at zero for about a second:/disarm_reason0 (safety). Ask the user to open the throttle gently: the motor turns. Map 1 starts with low power and torque limits (step 6), so a weak first spin is expected. save -y.
4. Real speed
At their defaults /odothr (wheel revolutions per km) and /gearthr (motor revolutions per wheel revolution) make every speed - /speed and each map's kph - mean motor RPM (speed). Set them before any speed limit.
- Ask for the wheel diameter or circumference and the drive: a hub motor turns once per wheel revolution; a chain or belt drive has the ratio wheel teeth / motor teeth (times any gearbox).
/odothr= 1000 / circumference in metres (circumference = π × diameter)./gearthr= motor revolutions per wheel revolution. Show the calculation, then write both.- Check: the user spins the wheel with the throttle;
/speedmust read a plausible km/h.save -y.
5. Map button
Tell the user: a button switches between maps, each with its own speed and power limit.
- Wiring: a push button between GPIO1 and IOGND (power off while wiring; battery first, USB second after).
/common/ioconf1= 1 (pull-up) and/io/IN_mapswitch=17,0(the digital reading of GPIO1) (input mapping).save -y.- Wiring check: while the user holds the button,
/common/gpio1reads low (well below 1000 mV); released, high. /maps/mapcntmust be 2 or more (default 3). The button switches only while LYNX runs, not duringstop, and only on a short press (under half a second). Ask the user to press it once:/maps/mapsteps to the next map (1, 2, 3, back to 1) and the motor beeps the map number. Confirm with the user.
6. Maps
list_variables (kind: param, path: /maps, recurse: true) and show the user, for map 1 to mapcnt: kph (speed limit, km/h now; 0 = none), pwr (battery power, W; 0 = none), trqlvl and acclvl (torque and throttle level, 0-1) (map settings). Ask the user what each map is for and its top speed and power (legal limits, for example 25 km/h on an e-bike), propose the values, write them after a yes, and save -y. /maps/initmap is the map after power-up (default 1). Map 0 is never selected by the button.
Check with the user on the lifted vehicle: each map limits the speed it should.
Hand back
save -y once more. The user switches the controller off and on (battery first, USB second), then checks the throttle and the map button again.
Report
- Device: name, serial number,
swid. - Throttle
minandmax;odothr,gearthr, pole pairs. - Map button wiring and the confirmed press; the limits of each map.
- What was saved; what the user still has to do.
Escalate
The throttle does not drive the motor after run: the LYNX not running playbook.